1
22
23 package com.liferay.portal.service.http;
24
25 import com.liferay.portal.service.UserServiceUtil;
26
27 import org.json.JSONArray;
28 import org.json.JSONObject;
29
30
71 public class UserServiceJSON {
72 public static void addGroupUsers(long groupId, long[] userIds)
73 throws com.liferay.portal.SystemException,
74 com.liferay.portal.PortalException, java.rmi.RemoteException {
75 UserServiceUtil.addGroupUsers(groupId, userIds);
76 }
77
78 public static void addPasswordPolicyUsers(long passwordPolicyId,
79 long[] userIds)
80 throws com.liferay.portal.SystemException,
81 com.liferay.portal.PortalException, java.rmi.RemoteException {
82 UserServiceUtil.addPasswordPolicyUsers(passwordPolicyId, userIds);
83 }
84
85 public static void addRoleUsers(long roleId, long[] userIds)
86 throws com.liferay.portal.SystemException,
87 com.liferay.portal.PortalException, java.rmi.RemoteException {
88 UserServiceUtil.addRoleUsers(roleId, userIds);
89 }
90
91 public static void addUserGroupUsers(long userGroupId, long[] userIds)
92 throws com.liferay.portal.SystemException,
93 com.liferay.portal.PortalException, java.rmi.RemoteException {
94 UserServiceUtil.addUserGroupUsers(userGroupId, userIds);
95 }
96
97 public static JSONObject addUser(long companyId, boolean autoPassword,
98 java.lang.String password1, java.lang.String password2,
99 boolean autoScreenName, java.lang.String screenName,
100 java.lang.String emailAddress, String locale,
101 java.lang.String firstName, java.lang.String middleName,
102 java.lang.String lastName, int prefixId, int suffixId, boolean male,
103 int birthdayMonth, int birthdayDay, int birthdayYear,
104 java.lang.String jobTitle, long organizationId, long locationId,
105 boolean sendEmail)
106 throws com.liferay.portal.SystemException,
107 com.liferay.portal.PortalException, java.rmi.RemoteException {
108 com.liferay.portal.model.User returnValue = UserServiceUtil.addUser(companyId,
109 autoPassword, password1, password2, autoScreenName, screenName,
110 emailAddress, new java.util.Locale(locale), firstName,
111 middleName, lastName, prefixId, suffixId, male, birthdayMonth,
112 birthdayDay, birthdayYear, jobTitle, organizationId,
113 locationId, sendEmail);
114
115 return UserJSONSerializer.toJSONObject(returnValue);
116 }
117
118 public static void deleteRoleUser(long roleId, long userId)
119 throws com.liferay.portal.SystemException,
120 com.liferay.portal.PortalException, java.rmi.RemoteException {
121 UserServiceUtil.deleteRoleUser(roleId, userId);
122 }
123
124 public static void deleteUser(long userId)
125 throws com.liferay.portal.SystemException,
126 com.liferay.portal.PortalException, java.rmi.RemoteException {
127 UserServiceUtil.deleteUser(userId);
128 }
129
130 public static long getDefaultUserId(long companyId)
131 throws com.liferay.portal.SystemException,
132 com.liferay.portal.PortalException, java.rmi.RemoteException {
133 long returnValue = UserServiceUtil.getDefaultUserId(companyId);
134
135 return returnValue;
136 }
137
138 public static JSONArray getGroupUsers(long groupId)
139 throws com.liferay.portal.SystemException,
140 com.liferay.portal.PortalException, java.rmi.RemoteException {
141 java.util.List returnValue = UserServiceUtil.getGroupUsers(groupId);
142
143 return UserJSONSerializer.toJSONArray(returnValue);
144 }
145
146 public static JSONArray getRoleUsers(long roleId)
147 throws com.liferay.portal.SystemException,
148 com.liferay.portal.PortalException, java.rmi.RemoteException {
149 java.util.List returnValue = UserServiceUtil.getRoleUsers(roleId);
150
151 return UserJSONSerializer.toJSONArray(returnValue);
152 }
153
154 public static JSONObject getUserByEmailAddress(long companyId,
155 java.lang.String emailAddress)
156 throws com.liferay.portal.SystemException,
157 com.liferay.portal.PortalException, java.rmi.RemoteException {
158 com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByEmailAddress(companyId,
159 emailAddress);
160
161 return UserJSONSerializer.toJSONObject(returnValue);
162 }
163
164 public static JSONObject getUserById(long userId)
165 throws com.liferay.portal.SystemException,
166 com.liferay.portal.PortalException, java.rmi.RemoteException {
167 com.liferay.portal.model.User returnValue = UserServiceUtil.getUserById(userId);
168
169 return UserJSONSerializer.toJSONObject(returnValue);
170 }
171
172 public static JSONObject getUserByScreenName(long companyId,
173 java.lang.String screenName)
174 throws com.liferay.portal.SystemException,
175 com.liferay.portal.PortalException, java.rmi.RemoteException {
176 com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByScreenName(companyId,
177 screenName);
178
179 return UserJSONSerializer.toJSONObject(returnValue);
180 }
181
182 public static boolean hasGroupUser(long groupId, long userId)
183 throws com.liferay.portal.SystemException,
184 com.liferay.portal.PortalException, java.rmi.RemoteException {
185 boolean returnValue = UserServiceUtil.hasGroupUser(groupId, userId);
186
187 return returnValue;
188 }
189
190 public static boolean hasRoleUser(long roleId, long userId)
191 throws com.liferay.portal.SystemException,
192 com.liferay.portal.PortalException, java.rmi.RemoteException {
193 boolean returnValue = UserServiceUtil.hasRoleUser(roleId, userId);
194
195 return returnValue;
196 }
197
198 public static void setGroupUsers(long groupId, long[] userIds)
199 throws com.liferay.portal.SystemException,
200 com.liferay.portal.PortalException, java.rmi.RemoteException {
201 UserServiceUtil.setGroupUsers(groupId, userIds);
202 }
203
204 public static void setRoleUsers(long roleId, long[] userIds)
205 throws com.liferay.portal.SystemException,
206 com.liferay.portal.PortalException, java.rmi.RemoteException {
207 UserServiceUtil.setRoleUsers(roleId, userIds);
208 }
209
210 public static void setUserGroupUsers(long userGroupId, long[] userIds)
211 throws com.liferay.portal.SystemException,
212 com.liferay.portal.PortalException, java.rmi.RemoteException {
213 UserServiceUtil.setUserGroupUsers(userGroupId, userIds);
214 }
215
216 public static void unsetGroupUsers(long groupId, long[] userIds)
217 throws com.liferay.portal.SystemException,
218 com.liferay.portal.PortalException, java.rmi.RemoteException {
219 UserServiceUtil.unsetGroupUsers(groupId, userIds);
220 }
221
222 public static void unsetPasswordPolicyUsers(long passwordPolicyId,
223 long[] userIds)
224 throws com.liferay.portal.SystemException,
225 com.liferay.portal.PortalException, java.rmi.RemoteException {
226 UserServiceUtil.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
227 }
228
229 public static void unsetRoleUsers(long roleId, long[] userIds)
230 throws com.liferay.portal.SystemException,
231 com.liferay.portal.PortalException, java.rmi.RemoteException {
232 UserServiceUtil.unsetRoleUsers(roleId, userIds);
233 }
234
235 public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
236 throws com.liferay.portal.SystemException,
237 com.liferay.portal.PortalException, java.rmi.RemoteException {
238 UserServiceUtil.unsetUserGroupUsers(userGroupId, userIds);
239 }
240
241 public static JSONObject updateActive(long userId, boolean active)
242 throws com.liferay.portal.SystemException,
243 com.liferay.portal.PortalException, java.rmi.RemoteException {
244 com.liferay.portal.model.User returnValue = UserServiceUtil.updateActive(userId,
245 active);
246
247 return UserJSONSerializer.toJSONObject(returnValue);
248 }
249
250 public static JSONObject updateAgreedToTermsOfUse(long userId,
251 boolean agreedToTermsOfUse)
252 throws com.liferay.portal.SystemException,
253 com.liferay.portal.PortalException, java.rmi.RemoteException {
254 com.liferay.portal.model.User returnValue = UserServiceUtil.updateAgreedToTermsOfUse(userId,
255 agreedToTermsOfUse);
256
257 return UserJSONSerializer.toJSONObject(returnValue);
258 }
259
260 public static JSONObject updateLockout(long userId, boolean lockout)
261 throws com.liferay.portal.SystemException,
262 com.liferay.portal.PortalException, java.rmi.RemoteException {
263 com.liferay.portal.model.User returnValue = UserServiceUtil.updateLockout(userId,
264 lockout);
265
266 return UserJSONSerializer.toJSONObject(returnValue);
267 }
268
269 public static void updateOrganizations(long userId, long organizationId,
270 long locationId)
271 throws com.liferay.portal.SystemException,
272 com.liferay.portal.PortalException, java.rmi.RemoteException {
273 UserServiceUtil.updateOrganizations(userId, organizationId, locationId);
274 }
275
276 public static JSONObject updatePassword(long userId,
277 java.lang.String password1, java.lang.String password2,
278 boolean passwordReset)
279 throws com.liferay.portal.SystemException,
280 com.liferay.portal.PortalException, java.rmi.RemoteException {
281 com.liferay.portal.model.User returnValue = UserServiceUtil.updatePassword(userId,
282 password1, password2, passwordReset);
283
284 return UserJSONSerializer.toJSONObject(returnValue);
285 }
286
287 public static void updatePortrait(long userId, byte[] bytes)
288 throws com.liferay.portal.SystemException,
289 com.liferay.portal.PortalException, java.rmi.RemoteException {
290 UserServiceUtil.updatePortrait(userId, bytes);
291 }
292
293 public static JSONObject updateUser(long userId, java.lang.String password,
294 java.lang.String screenName, java.lang.String emailAddress,
295 java.lang.String languageId, java.lang.String timeZoneId,
296 java.lang.String greeting, java.lang.String comments,
297 java.lang.String firstName, java.lang.String middleName,
298 java.lang.String lastName, int prefixId, int suffixId, boolean male,
299 int birthdayMonth, int birthdayDay, int birthdayYear,
300 java.lang.String smsSn, java.lang.String aimSn, java.lang.String icqSn,
301 java.lang.String jabberSn, java.lang.String msnSn,
302 java.lang.String skypeSn, java.lang.String ymSn,
303 java.lang.String jobTitle, long organizationId, long locationId)
304 throws com.liferay.portal.SystemException,
305 com.liferay.portal.PortalException, java.rmi.RemoteException {
306 com.liferay.portal.model.User returnValue = UserServiceUtil.updateUser(userId,
307 password, screenName, emailAddress, languageId, timeZoneId,
308 greeting, comments, firstName, middleName, lastName, prefixId,
309 suffixId, male, birthdayMonth, birthdayDay, birthdayYear,
310 smsSn, aimSn, icqSn, jabberSn, msnSn, skypeSn, ymSn, jobTitle,
311 organizationId, locationId);
312
313 return UserJSONSerializer.toJSONObject(returnValue);
314 }
315 }