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.PortalException,
142             com.liferay.portal.SystemException, java.rmi.RemoteException {
143         UserService userService = UserServiceFactory.getService();
144 
145         return userService.getGroupUsers(groupId);
146     }
147 
148     public static java.util.List<com.liferay.portal.model.User> getRoleUsers(
149         long roleId)
150         throws com.liferay.portal.PortalException,
151             com.liferay.portal.SystemException, java.rmi.RemoteException {
152         UserService userService = UserServiceFactory.getService();
153 
154         return userService.getRoleUsers(roleId);
155     }
156 
157     public static com.liferay.portal.model.User getUserByEmailAddress(
158         long companyId, java.lang.String emailAddress)
159         throws com.liferay.portal.PortalException,
160             com.liferay.portal.SystemException, java.rmi.RemoteException {
161         UserService userService = UserServiceFactory.getService();
162 
163         return userService.getUserByEmailAddress(companyId, emailAddress);
164     }
165 
166     public static com.liferay.portal.model.User getUserById(long userId)
167         throws com.liferay.portal.PortalException,
168             com.liferay.portal.SystemException, java.rmi.RemoteException {
169         UserService userService = UserServiceFactory.getService();
170 
171         return userService.getUserById(userId);
172     }
173 
174     public static com.liferay.portal.model.User getUserByScreenName(
175         long companyId, java.lang.String screenName)
176         throws com.liferay.portal.PortalException,
177             com.liferay.portal.SystemException, java.rmi.RemoteException {
178         UserService userService = UserServiceFactory.getService();
179 
180         return userService.getUserByScreenName(companyId, screenName);
181     }
182 
183     public static long getUserIdByEmailAddress(long companyId,
184         java.lang.String emailAddress)
185         throws com.liferay.portal.PortalException,
186             com.liferay.portal.SystemException, java.rmi.RemoteException {
187         UserService userService = UserServiceFactory.getService();
188 
189         return userService.getUserIdByEmailAddress(companyId, emailAddress);
190     }
191 
192     public static long getUserIdByScreenName(long companyId,
193         java.lang.String screenName)
194         throws com.liferay.portal.PortalException,
195             com.liferay.portal.SystemException, java.rmi.RemoteException {
196         UserService userService = UserServiceFactory.getService();
197 
198         return userService.getUserIdByScreenName(companyId, screenName);
199     }
200 
201     public static boolean hasGroupUser(long groupId, long userId)
202         throws com.liferay.portal.PortalException,
203             com.liferay.portal.SystemException, java.rmi.RemoteException {
204         UserService userService = UserServiceFactory.getService();
205 
206         return userService.hasGroupUser(groupId, userId);
207     }
208 
209     public static boolean hasRoleUser(long roleId, long userId)
210         throws com.liferay.portal.PortalException,
211             com.liferay.portal.SystemException, java.rmi.RemoteException {
212         UserService userService = UserServiceFactory.getService();
213 
214         return userService.hasRoleUser(roleId, userId);
215     }
216 
217     public static void setRoleUsers(long roleId, long[] userIds)
218         throws com.liferay.portal.PortalException,
219             com.liferay.portal.SystemException, java.rmi.RemoteException {
220         UserService userService = UserServiceFactory.getService();
221 
222         userService.setRoleUsers(roleId, userIds);
223     }
224 
225     public static void setUserGroupUsers(long userGroupId, long[] userIds)
226         throws com.liferay.portal.PortalException,
227             com.liferay.portal.SystemException, java.rmi.RemoteException {
228         UserService userService = UserServiceFactory.getService();
229 
230         userService.setUserGroupUsers(userGroupId, userIds);
231     }
232 
233     public static void unsetGroupUsers(long groupId, long[] userIds)
234         throws com.liferay.portal.PortalException,
235             com.liferay.portal.SystemException, java.rmi.RemoteException {
236         UserService userService = UserServiceFactory.getService();
237 
238         userService.unsetGroupUsers(groupId, userIds);
239     }
240 
241     public static void unsetOrganizationUsers(long organizationId,
242         long[] userIds)
243         throws com.liferay.portal.PortalException,
244             com.liferay.portal.SystemException, java.rmi.RemoteException {
245         UserService userService = UserServiceFactory.getService();
246 
247         userService.unsetOrganizationUsers(organizationId, userIds);
248     }
249 
250     public static void unsetPasswordPolicyUsers(long passwordPolicyId,
251         long[] userIds)
252         throws com.liferay.portal.PortalException,
253             com.liferay.portal.SystemException, java.rmi.RemoteException {
254         UserService userService = UserServiceFactory.getService();
255 
256         userService.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
257     }
258 
259     public static void unsetRoleUsers(long roleId, long[] userIds)
260         throws com.liferay.portal.PortalException,
261             com.liferay.portal.SystemException, java.rmi.RemoteException {
262         UserService userService = UserServiceFactory.getService();
263 
264         userService.unsetRoleUsers(roleId, userIds);
265     }
266 
267     public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
268         throws com.liferay.portal.PortalException,
269             com.liferay.portal.SystemException, java.rmi.RemoteException {
270         UserService userService = UserServiceFactory.getService();
271 
272         userService.unsetUserGroupUsers(userGroupId, userIds);
273     }
274 
275     public static com.liferay.portal.model.User updateActive(long userId,
276         boolean active)
277         throws com.liferay.portal.PortalException,
278             com.liferay.portal.SystemException, java.rmi.RemoteException {
279         UserService userService = UserServiceFactory.getService();
280 
281         return userService.updateActive(userId, active);
282     }
283 
284     public static com.liferay.portal.model.User updateAgreedToTermsOfUse(
285         long userId, boolean agreedToTermsOfUse)
286         throws com.liferay.portal.PortalException,
287             com.liferay.portal.SystemException, java.rmi.RemoteException {
288         UserService userService = UserServiceFactory.getService();
289 
290         return userService.updateAgreedToTermsOfUse(userId, agreedToTermsOfUse);
291     }
292 
293     public static com.liferay.portal.model.User updateLockout(long userId,
294         boolean lockout)
295         throws com.liferay.portal.PortalException,
296             com.liferay.portal.SystemException, java.rmi.RemoteException {
297         UserService userService = UserServiceFactory.getService();
298 
299         return userService.updateLockout(userId, lockout);
300     }
301 
302     public static void updateOrganizations(long userId, long[] organizationIds)
303         throws com.liferay.portal.PortalException,
304             com.liferay.portal.SystemException, java.rmi.RemoteException {
305         UserService userService = UserServiceFactory.getService();
306 
307         userService.updateOrganizations(userId, organizationIds);
308     }
309 
310     public static com.liferay.portal.model.User updatePassword(long userId,
311         java.lang.String password1, java.lang.String password2,
312         boolean passwordReset)
313         throws com.liferay.portal.PortalException,
314             com.liferay.portal.SystemException, java.rmi.RemoteException {
315         UserService userService = UserServiceFactory.getService();
316 
317         return userService.updatePassword(userId, password1, password2,
318             passwordReset);
319     }
320 
321     public static void updatePortrait(long userId, byte[] bytes)
322         throws com.liferay.portal.PortalException,
323             com.liferay.portal.SystemException, java.rmi.RemoteException {
324         UserService userService = UserServiceFactory.getService();
325 
326         userService.updatePortrait(userId, bytes);
327     }
328 
329     public static void updateScreenName(long userId, java.lang.String screenName)
330         throws com.liferay.portal.PortalException,
331             com.liferay.portal.SystemException, java.rmi.RemoteException {
332         UserService userService = UserServiceFactory.getService();
333 
334         userService.updateScreenName(userId, screenName);
335     }
336 
337     public static com.liferay.portal.model.User updateUser(long userId,
338         java.lang.String oldPassword, boolean passwordReset,
339         java.lang.String screenName, java.lang.String emailAddress,
340         java.lang.String languageId, java.lang.String timeZoneId,
341         java.lang.String greeting, java.lang.String comments,
342         java.lang.String firstName, java.lang.String middleName,
343         java.lang.String lastName, int prefixId, int suffixId, boolean male,
344         int birthdayMonth, int birthdayDay, int birthdayYear,
345         java.lang.String smsSn, java.lang.String aimSn, java.lang.String icqSn,
346         java.lang.String jabberSn, java.lang.String msnSn,
347         java.lang.String skypeSn, java.lang.String ymSn,
348         java.lang.String jobTitle, long[] organizationIds)
349         throws com.liferay.portal.PortalException,
350             com.liferay.portal.SystemException, java.rmi.RemoteException {
351         UserService userService = UserServiceFactory.getService();
352 
353         return userService.updateUser(userId, oldPassword, passwordReset,
354             screenName, emailAddress, languageId, timeZoneId, greeting,
355             comments, firstName, middleName, lastName, prefixId, suffixId,
356             male, birthdayMonth, birthdayDay, birthdayYear, smsSn, aimSn,
357             icqSn, jabberSn, msnSn, skypeSn, ymSn, jobTitle, organizationIds);
358     }
359 
360     public static com.liferay.portal.model.User updateUser(long userId,
361         java.lang.String oldPassword, java.lang.String newPassword1,
362         java.lang.String newPassword2, boolean passwordReset,
363         java.lang.String screenName, java.lang.String emailAddress,
364         java.lang.String languageId, java.lang.String timeZoneId,
365         java.lang.String greeting, java.lang.String comments,
366         java.lang.String firstName, java.lang.String middleName,
367         java.lang.String lastName, int prefixId, int suffixId, boolean male,
368         int birthdayMonth, int birthdayDay, int birthdayYear,
369         java.lang.String smsSn, java.lang.String aimSn, java.lang.String icqSn,
370         java.lang.String jabberSn, java.lang.String msnSn,
371         java.lang.String skypeSn, java.lang.String ymSn,
372         java.lang.String jobTitle, long[] organizationIds)
373         throws com.liferay.portal.PortalException,
374             com.liferay.portal.SystemException, java.rmi.RemoteException {
375         UserService userService = UserServiceFactory.getService();
376 
377         return userService.updateUser(userId, oldPassword, newPassword1,
378             newPassword2, passwordReset, screenName, emailAddress, languageId,
379             timeZoneId, greeting, comments, firstName, middleName, lastName,
380             prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear,
381             smsSn, aimSn, icqSn, jabberSn, msnSn, skypeSn, ymSn, jobTitle,
382             organizationIds);
383     }
384 }