1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service;
24  
25  
26  /**
27   * <a href="UserServiceUtil.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides static methods for the
36   * <code>com.liferay.portal.service.UserService</code>
37   * bean. The static methods of this class calls the same methods of the bean
38   * instance. It's convenient to be able to just write one line to call a method
39   * on a bean instead of writing a lookup call and a method call.
40   * </p>
41   *
42   * <p>
43   * <code>com.liferay.portal.service.UserServiceFactory</code>
44   * is responsible for the lookup of the bean.
45   * </p>
46   *
47   * @author Brian Wing Shun Chan
48   *
49   * @see com.liferay.portal.service.UserService
50   * @see com.liferay.portal.service.UserServiceFactory
51   *
52   */
53  public class UserServiceUtil {
54      public static void addGroupUsers(long groupId, long[] userIds)
55          throws com.liferay.portal.PortalException,
56              com.liferay.portal.SystemException, java.rmi.RemoteException {
57          UserService userService = UserServiceFactory.getService();
58  
59          userService.addGroupUsers(groupId, userIds);
60      }
61  
62      public static void addOrganizationUsers(long organizationId, long[] userIds)
63          throws com.liferay.portal.PortalException,
64              com.liferay.portal.SystemException, java.rmi.RemoteException {
65          UserService userService = UserServiceFactory.getService();
66  
67          userService.addOrganizationUsers(organizationId, userIds);
68      }
69  
70      public static void addPasswordPolicyUsers(long passwordPolicyId,
71          long[] userIds)
72          throws com.liferay.portal.PortalException,
73              com.liferay.portal.SystemException, java.rmi.RemoteException {
74          UserService userService = UserServiceFactory.getService();
75  
76          userService.addPasswordPolicyUsers(passwordPolicyId, userIds);
77      }
78  
79      public static void addRoleUsers(long roleId, long[] userIds)
80          throws com.liferay.portal.PortalException,
81              com.liferay.portal.SystemException, java.rmi.RemoteException {
82          UserService userService = UserServiceFactory.getService();
83  
84          userService.addRoleUsers(roleId, userIds);
85      }
86  
87      public static void addUserGroupUsers(long userGroupId, long[] userIds)
88          throws com.liferay.portal.PortalException,
89              com.liferay.portal.SystemException, java.rmi.RemoteException {
90          UserService userService = UserServiceFactory.getService();
91  
92          userService.addUserGroupUsers(userGroupId, userIds);
93      }
94  
95      public static com.liferay.portal.model.User addUser(long companyId,
96          boolean autoPassword, java.lang.String password1,
97          java.lang.String password2, boolean autoScreenName,
98          java.lang.String screenName, java.lang.String emailAddress,
99          java.util.Locale locale, java.lang.String firstName,
100         java.lang.String middleName, java.lang.String lastName, int prefixId,
101         int suffixId, boolean male, int birthdayMonth, int birthdayDay,
102         int birthdayYear, java.lang.String jobTitle, long[] organizationIds,
103         boolean sendEmail)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException, java.rmi.RemoteException {
106         UserService userService = UserServiceFactory.getService();
107 
108         return userService.addUser(companyId, autoPassword, password1,
109             password2, autoScreenName, screenName, emailAddress, locale,
110             firstName, middleName, lastName, prefixId, suffixId, male,
111             birthdayMonth, birthdayDay, birthdayYear, jobTitle,
112             organizationIds, sendEmail);
113     }
114 
115     public static void deleteRoleUser(long roleId, long userId)
116         throws com.liferay.portal.PortalException,
117             com.liferay.portal.SystemException, java.rmi.RemoteException {
118         UserService userService = UserServiceFactory.getService();
119 
120         userService.deleteRoleUser(roleId, userId);
121     }
122 
123     public static void deleteUser(long userId)
124         throws com.liferay.portal.PortalException,
125             com.liferay.portal.SystemException, java.rmi.RemoteException {
126         UserService userService = UserServiceFactory.getService();
127 
128         userService.deleteUser(userId);
129     }
130 
131     public static long getDefaultUserId(long companyId)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException, java.rmi.RemoteException {
134         UserService userService = UserServiceFactory.getService();
135 
136         return userService.getDefaultUserId(companyId);
137     }
138 
139     public static java.util.List<com.liferay.portal.model.User> getGroupUsers(
140         long groupId)
141         throws com.liferay.portal.SystemException, java.rmi.RemoteException {
142         UserService userService = UserServiceFactory.getService();
143 
144         return userService.getGroupUsers(groupId);
145     }
146 
147     public static java.util.List<com.liferay.portal.model.User> getRoleUsers(
148         long roleId)
149         throws com.liferay.portal.SystemException, java.rmi.RemoteException {
150         UserService userService = UserServiceFactory.getService();
151 
152         return userService.getRoleUsers(roleId);
153     }
154 
155     public static com.liferay.portal.model.User getUserByEmailAddress(
156         long companyId, java.lang.String emailAddress)
157         throws com.liferay.portal.PortalException,
158             com.liferay.portal.SystemException, java.rmi.RemoteException {
159         UserService userService = UserServiceFactory.getService();
160 
161         return userService.getUserByEmailAddress(companyId, emailAddress);
162     }
163 
164     public static com.liferay.portal.model.User getUserById(long userId)
165         throws com.liferay.portal.PortalException,
166             com.liferay.portal.SystemException, java.rmi.RemoteException {
167         UserService userService = UserServiceFactory.getService();
168 
169         return userService.getUserById(userId);
170     }
171 
172     public static com.liferay.portal.model.User getUserByScreenName(
173         long companyId, java.lang.String screenName)
174         throws com.liferay.portal.PortalException,
175             com.liferay.portal.SystemException, java.rmi.RemoteException {
176         UserService userService = UserServiceFactory.getService();
177 
178         return userService.getUserByScreenName(companyId, screenName);
179     }
180 
181     public static long getUserIdByEmailAddress(long companyId,
182         java.lang.String emailAddress)
183         throws com.liferay.portal.PortalException,
184             com.liferay.portal.SystemException, java.rmi.RemoteException {
185         UserService userService = UserServiceFactory.getService();
186 
187         return userService.getUserIdByEmailAddress(companyId, emailAddress);
188     }
189 
190     public static long getUserIdByScreenName(long companyId,
191         java.lang.String screenName)
192         throws com.liferay.portal.PortalException,
193             com.liferay.portal.SystemException, java.rmi.RemoteException {
194         UserService userService = UserServiceFactory.getService();
195 
196         return userService.getUserIdByScreenName(companyId, screenName);
197     }
198 
199     public static boolean hasGroupUser(long groupId, long userId)
200         throws com.liferay.portal.SystemException, java.rmi.RemoteException {
201         UserService userService = UserServiceFactory.getService();
202 
203         return userService.hasGroupUser(groupId, userId);
204     }
205 
206     public static boolean hasRoleUser(long roleId, long userId)
207         throws com.liferay.portal.SystemException, java.rmi.RemoteException {
208         UserService userService = UserServiceFactory.getService();
209 
210         return userService.hasRoleUser(roleId, userId);
211     }
212 
213     public static void setRoleUsers(long roleId, long[] userIds)
214         throws com.liferay.portal.PortalException,
215             com.liferay.portal.SystemException, java.rmi.RemoteException {
216         UserService userService = UserServiceFactory.getService();
217 
218         userService.setRoleUsers(roleId, userIds);
219     }
220 
221     public static void setUserGroupUsers(long userGroupId, long[] userIds)
222         throws com.liferay.portal.PortalException,
223             com.liferay.portal.SystemException, java.rmi.RemoteException {
224         UserService userService = UserServiceFactory.getService();
225 
226         userService.setUserGroupUsers(userGroupId, userIds);
227     }
228 
229     public static void unsetGroupUsers(long groupId, long[] userIds)
230         throws com.liferay.portal.PortalException,
231             com.liferay.portal.SystemException, java.rmi.RemoteException {
232         UserService userService = UserServiceFactory.getService();
233 
234         userService.unsetGroupUsers(groupId, userIds);
235     }
236 
237     public static void unsetOrganizationUsers(long organizationId,
238         long[] userIds)
239         throws com.liferay.portal.PortalException,
240             com.liferay.portal.SystemException, java.rmi.RemoteException {
241         UserService userService = UserServiceFactory.getService();
242 
243         userService.unsetOrganizationUsers(organizationId, userIds);
244     }
245 
246     public static void unsetPasswordPolicyUsers(long passwordPolicyId,
247         long[] userIds)
248         throws com.liferay.portal.PortalException,
249             com.liferay.portal.SystemException, java.rmi.RemoteException {
250         UserService userService = UserServiceFactory.getService();
251 
252         userService.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
253     }
254 
255     public static void unsetRoleUsers(long roleId, long[] userIds)
256         throws com.liferay.portal.PortalException,
257             com.liferay.portal.SystemException, java.rmi.RemoteException {
258         UserService userService = UserServiceFactory.getService();
259 
260         userService.unsetRoleUsers(roleId, userIds);
261     }
262 
263     public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
264         throws com.liferay.portal.PortalException,
265             com.liferay.portal.SystemException, java.rmi.RemoteException {
266         UserService userService = UserServiceFactory.getService();
267 
268         userService.unsetUserGroupUsers(userGroupId, userIds);
269     }
270 
271     public static com.liferay.portal.model.User updateActive(long userId,
272         boolean active)
273         throws com.liferay.portal.PortalException,
274             com.liferay.portal.SystemException, java.rmi.RemoteException {
275         UserService userService = UserServiceFactory.getService();
276 
277         return userService.updateActive(userId, active);
278     }
279 
280     public static com.liferay.portal.model.User updateAgreedToTermsOfUse(
281         long userId, boolean agreedToTermsOfUse)
282         throws com.liferay.portal.PortalException,
283             com.liferay.portal.SystemException, java.rmi.RemoteException {
284         UserService userService = UserServiceFactory.getService();
285 
286         return userService.updateAgreedToTermsOfUse(userId, agreedToTermsOfUse);
287     }
288 
289     public static com.liferay.portal.model.User updateLockout(long userId,
290         boolean lockout)
291         throws com.liferay.portal.PortalException,
292             com.liferay.portal.SystemException, java.rmi.RemoteException {
293         UserService userService = UserServiceFactory.getService();
294 
295         return userService.updateLockout(userId, lockout);
296     }
297 
298     public static void updateOrganizations(long userId, long[] organizationIds)
299         throws com.liferay.portal.PortalException,
300             com.liferay.portal.SystemException, java.rmi.RemoteException {
301         UserService userService = UserServiceFactory.getService();
302 
303         userService.updateOrganizations(userId, organizationIds);
304     }
305 
306     public static com.liferay.portal.model.User updatePassword(long userId,
307         java.lang.String password1, java.lang.String password2,
308         boolean passwordReset)
309         throws com.liferay.portal.PortalException,
310             com.liferay.portal.SystemException, java.rmi.RemoteException {
311         UserService userService = UserServiceFactory.getService();
312 
313         return userService.updatePassword(userId, password1, password2,
314             passwordReset);
315     }
316 
317     public static void updatePortrait(long userId, byte[] bytes)
318         throws com.liferay.portal.PortalException,
319             com.liferay.portal.SystemException, java.rmi.RemoteException {
320         UserService userService = UserServiceFactory.getService();
321 
322         userService.updatePortrait(userId, bytes);
323     }
324 
325     public static void updateScreenName(long userId, java.lang.String screenName)
326         throws com.liferay.portal.PortalException,
327             com.liferay.portal.SystemException, java.rmi.RemoteException {
328         UserService userService = UserServiceFactory.getService();
329 
330         userService.updateScreenName(userId, screenName);
331     }
332 
333     public static void updateOpenId(long userId, java.lang.String openId)
334         throws com.liferay.portal.PortalException,
335             com.liferay.portal.SystemException, java.rmi.RemoteException {
336         UserService userService = UserServiceFactory.getService();
337 
338         userService.updateOpenId(userId, openId);
339     }
340 
341     public static com.liferay.portal.model.User updateUser(long userId,
342         java.lang.String oldPassword, boolean passwordReset,
343         java.lang.String screenName, java.lang.String emailAddress,
344         java.lang.String languageId, java.lang.String timeZoneId,
345         java.lang.String greeting, java.lang.String comments,
346         java.lang.String firstName, java.lang.String middleName,
347         java.lang.String lastName, int prefixId, int suffixId, boolean male,
348         int birthdayMonth, int birthdayDay, int birthdayYear,
349         java.lang.String smsSn, java.lang.String aimSn,
350         java.lang.String facebookSn, java.lang.String icqSn,
351         java.lang.String jabberSn, java.lang.String msnSn,
352         java.lang.String mySpaceSn, java.lang.String skypeSn,
353         java.lang.String twitterSn, java.lang.String ymSn,
354         java.lang.String jobTitle, long[] organizationIds)
355         throws com.liferay.portal.PortalException,
356             com.liferay.portal.SystemException, java.rmi.RemoteException {
357         UserService userService = UserServiceFactory.getService();
358 
359         return userService.updateUser(userId, oldPassword, passwordReset,
360             screenName, emailAddress, languageId, timeZoneId, greeting,
361             comments, firstName, middleName, lastName, prefixId, suffixId,
362             male, birthdayMonth, birthdayDay, birthdayYear, smsSn, aimSn,
363             facebookSn, icqSn, jabberSn, msnSn, mySpaceSn, skypeSn, twitterSn,
364             ymSn, jobTitle, organizationIds);
365     }
366 
367     public static com.liferay.portal.model.User updateUser(long userId,
368         java.lang.String oldPassword, java.lang.String newPassword1,
369         java.lang.String newPassword2, boolean passwordReset,
370         java.lang.String screenName, java.lang.String emailAddress,
371         java.lang.String languageId, java.lang.String timeZoneId,
372         java.lang.String greeting, java.lang.String comments,
373         java.lang.String firstName, java.lang.String middleName,
374         java.lang.String lastName, int prefixId, int suffixId, boolean male,
375         int birthdayMonth, int birthdayDay, int birthdayYear,
376         java.lang.String smsSn, java.lang.String aimSn,
377         java.lang.String facebookSn, java.lang.String icqSn,
378         java.lang.String jabberSn, java.lang.String msnSn,
379         java.lang.String mySpaceSn, java.lang.String skypeSn,
380         java.lang.String twitterSn, java.lang.String ymSn,
381         java.lang.String jobTitle, long[] organizationIds)
382         throws com.liferay.portal.PortalException,
383             com.liferay.portal.SystemException, java.rmi.RemoteException {
384         UserService userService = UserServiceFactory.getService();
385 
386         return userService.updateUser(userId, oldPassword, newPassword1,
387             newPassword2, passwordReset, screenName, emailAddress, languageId,
388             timeZoneId, greeting, comments, firstName, middleName, lastName,
389             prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear,
390             smsSn, aimSn, facebookSn, icqSn, jabberSn, msnSn, mySpaceSn,
391             skypeSn, twitterSn, ymSn, jobTitle, organizationIds);
392     }
393 }