1
22
23 package com.liferay.portal.service.http;
24
25 import com.liferay.portal.kernel.json.JSONArray;
26 import com.liferay.portal.kernel.json.JSONObject;
27 import com.liferay.portal.service.UserServiceUtil;
28
29
75 public class UserServiceJSON {
76 public static void addGroupUsers(long groupId, long[] userIds)
77 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
78 com.liferay.portal.SystemException {
79 UserServiceUtil.addGroupUsers(groupId, userIds);
80 }
81
82 public static void addOrganizationUsers(long organizationId, long[] userIds)
83 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
84 com.liferay.portal.SystemException {
85 UserServiceUtil.addOrganizationUsers(organizationId, userIds);
86 }
87
88 public static void addPasswordPolicyUsers(long passwordPolicyId,
89 long[] userIds)
90 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
91 com.liferay.portal.SystemException {
92 UserServiceUtil.addPasswordPolicyUsers(passwordPolicyId, userIds);
93 }
94
95 public static void addRoleUsers(long roleId, long[] userIds)
96 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
97 com.liferay.portal.SystemException {
98 UserServiceUtil.addRoleUsers(roleId, userIds);
99 }
100
101 public static void addUserGroupUsers(long userGroupId, long[] userIds)
102 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
103 com.liferay.portal.SystemException {
104 UserServiceUtil.addUserGroupUsers(userGroupId, userIds);
105 }
106
107 public static JSONObject addUser(long companyId, boolean autoPassword,
108 java.lang.String password1, java.lang.String password2,
109 boolean autoScreenName, java.lang.String screenName,
110 java.lang.String emailAddress, String locale,
111 java.lang.String firstName, java.lang.String middleName,
112 java.lang.String lastName, int prefixId, int suffixId, boolean male,
113 int birthdayMonth, int birthdayDay, int birthdayYear,
114 java.lang.String jobTitle, long[] organizationIds, boolean sendEmail)
115 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
116 com.liferay.portal.SystemException {
117 com.liferay.portal.model.User returnValue = UserServiceUtil.addUser(companyId,
118 autoPassword, password1, password2, autoScreenName, screenName,
119 emailAddress, new java.util.Locale(locale), firstName,
120 middleName, lastName, prefixId, suffixId, male, birthdayMonth,
121 birthdayDay, birthdayYear, jobTitle, organizationIds, sendEmail);
122
123 return UserJSONSerializer.toJSONObject(returnValue);
124 }
125
126 public static void deleteRoleUser(long roleId, long userId)
127 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
128 com.liferay.portal.SystemException {
129 UserServiceUtil.deleteRoleUser(roleId, userId);
130 }
131
132 public static void deleteUser(long userId)
133 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
134 com.liferay.portal.SystemException {
135 UserServiceUtil.deleteUser(userId);
136 }
137
138 public static long getDefaultUserId(long companyId)
139 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
140 com.liferay.portal.SystemException {
141 long returnValue = UserServiceUtil.getDefaultUserId(companyId);
142
143 return returnValue;
144 }
145
146 public static JSONArray getGroupUsers(long groupId)
147 throws java.rmi.RemoteException, com.liferay.portal.SystemException {
148 java.util.List<com.liferay.portal.model.User> returnValue = UserServiceUtil.getGroupUsers(groupId);
149
150 return UserJSONSerializer.toJSONArray(returnValue);
151 }
152
153 public static JSONArray getRoleUsers(long roleId)
154 throws java.rmi.RemoteException, com.liferay.portal.SystemException {
155 java.util.List<com.liferay.portal.model.User> returnValue = UserServiceUtil.getRoleUsers(roleId);
156
157 return UserJSONSerializer.toJSONArray(returnValue);
158 }
159
160 public static JSONObject getUserByEmailAddress(long companyId,
161 java.lang.String emailAddress)
162 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
163 com.liferay.portal.SystemException {
164 com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByEmailAddress(companyId,
165 emailAddress);
166
167 return UserJSONSerializer.toJSONObject(returnValue);
168 }
169
170 public static JSONObject getUserById(long userId)
171 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
172 com.liferay.portal.SystemException {
173 com.liferay.portal.model.User returnValue = UserServiceUtil.getUserById(userId);
174
175 return UserJSONSerializer.toJSONObject(returnValue);
176 }
177
178 public static JSONObject getUserByScreenName(long companyId,
179 java.lang.String screenName)
180 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
181 com.liferay.portal.SystemException {
182 com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByScreenName(companyId,
183 screenName);
184
185 return UserJSONSerializer.toJSONObject(returnValue);
186 }
187
188 public static long getUserIdByEmailAddress(long companyId,
189 java.lang.String emailAddress)
190 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
191 com.liferay.portal.SystemException {
192 long returnValue = UserServiceUtil.getUserIdByEmailAddress(companyId,
193 emailAddress);
194
195 return returnValue;
196 }
197
198 public static long getUserIdByScreenName(long companyId,
199 java.lang.String screenName)
200 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
201 com.liferay.portal.SystemException {
202 long returnValue = UserServiceUtil.getUserIdByScreenName(companyId,
203 screenName);
204
205 return returnValue;
206 }
207
208 public static boolean hasGroupUser(long groupId, long userId)
209 throws java.rmi.RemoteException, com.liferay.portal.SystemException {
210 boolean returnValue = UserServiceUtil.hasGroupUser(groupId, userId);
211
212 return returnValue;
213 }
214
215 public static boolean hasRoleUser(long roleId, long userId)
216 throws java.rmi.RemoteException, com.liferay.portal.SystemException {
217 boolean returnValue = UserServiceUtil.hasRoleUser(roleId, userId);
218
219 return returnValue;
220 }
221
222 public static void setRoleUsers(long roleId, long[] userIds)
223 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
224 com.liferay.portal.SystemException {
225 UserServiceUtil.setRoleUsers(roleId, userIds);
226 }
227
228 public static void setUserGroupUsers(long userGroupId, long[] userIds)
229 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
230 com.liferay.portal.SystemException {
231 UserServiceUtil.setUserGroupUsers(userGroupId, userIds);
232 }
233
234 public static void unsetGroupUsers(long groupId, long[] userIds)
235 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
236 com.liferay.portal.SystemException {
237 UserServiceUtil.unsetGroupUsers(groupId, userIds);
238 }
239
240 public static void unsetOrganizationUsers(long organizationId,
241 long[] userIds)
242 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
243 com.liferay.portal.SystemException {
244 UserServiceUtil.unsetOrganizationUsers(organizationId, userIds);
245 }
246
247 public static void unsetPasswordPolicyUsers(long passwordPolicyId,
248 long[] userIds)
249 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
250 com.liferay.portal.SystemException {
251 UserServiceUtil.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
252 }
253
254 public static void unsetRoleUsers(long roleId, long[] userIds)
255 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
256 com.liferay.portal.SystemException {
257 UserServiceUtil.unsetRoleUsers(roleId, userIds);
258 }
259
260 public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
261 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
262 com.liferay.portal.SystemException {
263 UserServiceUtil.unsetUserGroupUsers(userGroupId, userIds);
264 }
265
266 public static JSONObject updateActive(long userId, boolean active)
267 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
268 com.liferay.portal.SystemException {
269 com.liferay.portal.model.User returnValue = UserServiceUtil.updateActive(userId,
270 active);
271
272 return UserJSONSerializer.toJSONObject(returnValue);
273 }
274
275 public static JSONObject updateAgreedToTermsOfUse(long userId,
276 boolean agreedToTermsOfUse)
277 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
278 com.liferay.portal.SystemException {
279 com.liferay.portal.model.User returnValue = UserServiceUtil.updateAgreedToTermsOfUse(userId,
280 agreedToTermsOfUse);
281
282 return UserJSONSerializer.toJSONObject(returnValue);
283 }
284
285 public static JSONObject updateLockout(long userId, boolean lockout)
286 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
287 com.liferay.portal.SystemException {
288 com.liferay.portal.model.User returnValue = UserServiceUtil.updateLockout(userId,
289 lockout);
290
291 return UserJSONSerializer.toJSONObject(returnValue);
292 }
293
294 public static void updateOrganizations(long userId, long[] organizationIds)
295 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
296 com.liferay.portal.SystemException {
297 UserServiceUtil.updateOrganizations(userId, organizationIds);
298 }
299
300 public static JSONObject updatePassword(long userId,
301 java.lang.String password1, java.lang.String password2,
302 boolean passwordReset)
303 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
304 com.liferay.portal.SystemException {
305 com.liferay.portal.model.User returnValue = UserServiceUtil.updatePassword(userId,
306 password1, password2, passwordReset);
307
308 return UserJSONSerializer.toJSONObject(returnValue);
309 }
310
311 public static void updatePortrait(long userId, byte[] bytes)
312 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
313 com.liferay.portal.SystemException {
314 UserServiceUtil.updatePortrait(userId, bytes);
315 }
316
317 public static void updateScreenName(long userId, java.lang.String screenName)
318 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
319 com.liferay.portal.SystemException {
320 UserServiceUtil.updateScreenName(userId, screenName);
321 }
322
323 public static void updateOpenId(long userId, java.lang.String openId)
324 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
325 com.liferay.portal.SystemException {
326 UserServiceUtil.updateOpenId(userId, openId);
327 }
328
329 public static JSONObject updateUser(long userId,
330 java.lang.String oldPassword, boolean passwordReset,
331 java.lang.String screenName, java.lang.String emailAddress,
332 java.lang.String languageId, java.lang.String timeZoneId,
333 java.lang.String greeting, java.lang.String comments,
334 java.lang.String firstName, java.lang.String middleName,
335 java.lang.String lastName, int prefixId, int suffixId, boolean male,
336 int birthdayMonth, int birthdayDay, int birthdayYear,
337 java.lang.String smsSn, java.lang.String aimSn,
338 java.lang.String facebookSn, java.lang.String icqSn,
339 java.lang.String jabberSn, java.lang.String msnSn,
340 java.lang.String mySpaceSn, java.lang.String skypeSn,
341 java.lang.String twitterSn, java.lang.String ymSn,
342 java.lang.String jobTitle, long[] organizationIds)
343 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
344 com.liferay.portal.SystemException {
345 com.liferay.portal.model.User returnValue = UserServiceUtil.updateUser(userId,
346 oldPassword, passwordReset, screenName, emailAddress,
347 languageId, timeZoneId, greeting, comments, firstName,
348 middleName, lastName, prefixId, suffixId, male, birthdayMonth,
349 birthdayDay, birthdayYear, smsSn, aimSn, facebookSn, icqSn,
350 jabberSn, msnSn, mySpaceSn, skypeSn, twitterSn, ymSn, jobTitle,
351 organizationIds);
352
353 return UserJSONSerializer.toJSONObject(returnValue);
354 }
355
356 public static JSONObject updateUser(long userId,
357 java.lang.String oldPassword, java.lang.String newPassword1,
358 java.lang.String newPassword2, boolean passwordReset,
359 java.lang.String screenName, java.lang.String emailAddress,
360 java.lang.String languageId, java.lang.String timeZoneId,
361 java.lang.String greeting, java.lang.String comments,
362 java.lang.String firstName, java.lang.String middleName,
363 java.lang.String lastName, int prefixId, int suffixId, boolean male,
364 int birthdayMonth, int birthdayDay, int birthdayYear,
365 java.lang.String smsSn, java.lang.String aimSn,
366 java.lang.String facebookSn, java.lang.String icqSn,
367 java.lang.String jabberSn, java.lang.String msnSn,
368 java.lang.String mySpaceSn, java.lang.String skypeSn,
369 java.lang.String twitterSn, java.lang.String ymSn,
370 java.lang.String jobTitle, long[] organizationIds)
371 throws java.rmi.RemoteException, com.liferay.portal.PortalException,
372 com.liferay.portal.SystemException {
373 com.liferay.portal.model.User returnValue = UserServiceUtil.updateUser(userId,
374 oldPassword, newPassword1, newPassword2, passwordReset,
375 screenName, emailAddress, languageId, timeZoneId, greeting,
376 comments, firstName, middleName, lastName, prefixId, suffixId,
377 male, birthdayMonth, birthdayDay, birthdayYear, smsSn, aimSn,
378 facebookSn, icqSn, jabberSn, msnSn, mySpaceSn, skypeSn,
379 twitterSn, ymSn, jobTitle, organizationIds);
380
381 return UserJSONSerializer.toJSONObject(returnValue);
382 }
383 }