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