Created
October 29, 2011 04:33
-
-
Save rotty3000/1324090 to your computer and use it in GitHub Desktop.
JSON RPC Services Deserialize Locale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit 337cd8f5629e36ede6fc2ac704d68873824dcd10 | |
| Author: Raymond Auge <[email protected]> | |
| Date: Sat Oct 29 00:26:54 2011 -0400 | |
| JSON RPC Services Deserialize Locale | |
| diff --git a/portal-impl/src/com/liferay/portal/action/JSONServiceAction.java b/portal-impl/src/com/liferay/portal/action/JSONServiceAction.java | |
| index 87bd7dd..ca22bca 100644 | |
| --- a/portal-impl/src/com/liferay/portal/action/JSONServiceAction.java | |
| +++ b/portal-impl/src/com/liferay/portal/action/JSONServiceAction.java | |
| @@ -41,6 +41,7 @@ import java.lang.reflect.Type; | |
| import java.util.Arrays; | |
| import java.util.Date; | |
| import java.util.HashMap; | |
| +import java.util.Locale; | |
| import java.util.Map; | |
| import java.util.Set; | |
| import java.util.regex.Matcher; | |
| @@ -182,6 +183,14 @@ public class JSONServiceAction extends JSONAction { | |
| else if (typeNameOrClassDescriptor.equals(Date.class.getName())) { | |
| return new Date(ParamUtil.getLong(request, parameter)); | |
| } | |
| + else if (typeNameOrClassDescriptor.equals(Locale.class.getName())) { | |
| + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(value); | |
| + | |
| + return new Locale( | |
| + jsonObject.getString("language"), | |
| + jsonObject.getString("country"), | |
| + jsonObject.getString("variant")); | |
| + } | |
| else if (typeNameOrClassDescriptor.equals( | |
| ServiceContext.class.getName())) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Liferay.Service.Portal.User.addUser( | |
| { | |
| companyId:themeDisplay.getCompanyId(), | |
| autoPassword:true, | |
| password1:' ', | |
| password2:' ', | |
| autoScreenName:false, | |
| screenName:'dude2', | |
| emailAddress:'[email protected]', | |
| facebookId:0, | |
| openId:'dude2', | |
| locale:AUI().JSON.stringify({country:'US',language:'en'}), | |
| firstName:'dude2', | |
| middleName:'', | |
| lastName:'dudems', | |
| prefixId:0, | |
| suffixId:0, | |
| male:true, | |
| birthdayMonth:1, | |
| birthdayDay:1, | |
| birthdayYear:1960, | |
| jobTitle:'', | |
| groupIds:null, | |
| organizationIds:null, | |
| roleIds:null, | |
| userGroupIds:null, | |
| sendEmail:false, | |
| serviceContext:AUI().JSON.stringify({}), | |
| serviceParameterTypes:AUI().JSON.stringify([ | |
| 'long', | |
| 'boolean', | |
| 'java.lang.String', | |
| 'java.lang.String', | |
| 'boolean', | |
| 'java.lang.String', | |
| 'java.lang.String', | |
| 'long', | |
| 'java.lang.String', | |
| 'java.util.Locale', | |
| 'java.lang.String', | |
| 'java.lang.String', | |
| 'java.lang.String', | |
| 'int', | |
| 'int', | |
| 'boolean', | |
| 'int', | |
| 'int', | |
| 'int', | |
| 'java.lang.String', | |
| '[J', | |
| '[J', | |
| '[J', | |
| '[J', | |
| 'boolean', | |
| 'com.liferay.portal.service.ServiceContext' | |
| ]) | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment