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 getGroupUsers(long groupId)
140         throws com.liferay.portal.PortalException, 
141             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 getRoleUsers(long roleId)
148         throws com.liferay.portal.PortalException, 
149             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.PortalException, 
201             com.liferay.portal.SystemException, java.rmi.RemoteException {
202         UserService userService = UserServiceFactory.getService();
203 
204         return userService.hasGroupUser(groupId, userId);
205     }
206 
207     public static boolean hasRoleUser(long roleId, long userId)
208         throws com.liferay.portal.PortalException, 
209             com.liferay.portal.SystemException, java.rmi.RemoteException {
210         UserService userService = UserServiceFactory.getService();
211 
212         return userService.hasRoleUser(roleId, userId);
213     }
214 
215     public static void setRoleUsers(long roleId, long[] userIds)
216         throws com.liferay.portal.PortalException, 
217             com.liferay.portal.SystemException, java.rmi.RemoteException {
218         UserService userService = UserServiceFactory.getService();
219 
220         userService.setRoleUsers(roleId, userIds);
221     }
222 
223     public static void setUserGroupUsers(long userGroupId, long[] userIds)
224         throws com.liferay.portal.PortalException, 
225             com.liferay.portal.SystemException, java.rmi.RemoteException {
226         UserService userService = UserServiceFactory.getService();
227 
228         userService.setUserGroupUsers(userGroupId, userIds);
229     }
230 
231     public static void unsetGroupUsers(long groupId, long[] userIds)
232         throws com.liferay.portal.PortalException, 
233             com.liferay.portal.SystemException, java.rmi.RemoteException {
234         UserService userService = UserServiceFactory.getService();
235 
236         userService.unsetGroupUsers(groupId, userIds);
237     }
238 
239     public static void unsetOrganizationUsers(long organizationId,
240         long[] userIds)
241         throws com.liferay.portal.PortalException, 
242             com.liferay.portal.SystemException, java.rmi.RemoteException {
243         UserService userService = UserServiceFactory.getService();
244 
245         userService.unsetOrganizationUsers(organizationId, userIds);
246     }
247 
248     public static void unsetPasswordPolicyUsers(long passwordPolicyId,
249         long[] userIds)
250         throws com.liferay.portal.PortalException, 
251             com.liferay.portal.SystemException, java.rmi.RemoteException {
252         UserService userService = UserServiceFactory.getService();
253 
254         userService.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
255     }
256 
257     public static void unsetRoleUsers(long roleId, long[] userIds)
258         throws com.liferay.portal.PortalException, 
259             com.liferay.portal.SystemException, java.rmi.RemoteException {
260         UserService userService = UserServiceFactory.getService();
261 
262         userService.unsetRoleUsers(roleId, userIds);
263     }
264 
265     public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
266         throws com.liferay.portal.PortalException, 
267             com.liferay.portal.SystemException, java.rmi.RemoteException {
268         UserService userService = UserServiceFactory.getService();
269 
270         userService.unsetUserGroupUsers(userGroupId, userIds);
271     }
272 
273     public static com.liferay.portal.model.User updateActive(long userId,
274         boolean active)
275         throws com.liferay.portal.PortalException, 
276             com.liferay.portal.SystemException, java.rmi.RemoteException {
277         UserService userService = UserServiceFactory.getService();
278 
279         return userService.updateActive(userId, active);
280     }
281 
282     public static com.liferay.portal.model.User updateAgreedToTermsOfUse(
283         long userId, boolean agreedToTermsOfUse)
284         throws com.liferay.portal.PortalException, 
285             com.liferay.portal.SystemException, java.rmi.RemoteException {
286         UserService userService = UserServiceFactory.getService();
287 
288         return userService.updateAgreedToTermsOfUse(userId, agreedToTermsOfUse);
289     }
290 
291     public static com.liferay.portal.model.User updateLockout(long userId,
292         boolean lockout)
293         throws com.liferay.portal.PortalException, 
294             com.liferay.portal.SystemException, java.rmi.RemoteException {
295         UserService userService = UserServiceFactory.getService();
296 
297         return userService.updateLockout(userId, lockout);
298     }
299 
300     public static void updateOrganizations(long userId, long[] organizationIds)
301         throws com.liferay.portal.PortalException, 
302             com.liferay.portal.SystemException, java.rmi.RemoteException {
303         UserService userService = UserServiceFactory.getService();
304 
305         userService.updateOrganizations(userId, organizationIds);
306     }
307 
308     public static com.liferay.portal.model.User updatePassword(long userId,
309         java.lang.String password1, java.lang.String password2,
310         boolean passwordReset)
311         throws com.liferay.portal.PortalException, 
312             com.liferay.portal.SystemException, java.rmi.RemoteException {
313         UserService userService = UserServiceFactory.getService();
314 
315         return userService.updatePassword(userId, password1, password2,
316             passwordReset);
317     }
318 
319     public static void updatePortrait(long userId, byte[] bytes)
320         throws com.liferay.portal.PortalException, 
321             com.liferay.portal.SystemException, java.rmi.RemoteException {
322         UserService userService = UserServiceFactory.getService();
323 
324         userService.updatePortrait(userId, bytes);
325     }
326 
327     public static com.liferay.portal.model.User updateUser(long userId,
328         java.lang.String oldPassword, boolean passwordReset,
329         java.lang.String screenName, java.lang.String emailAddress,
330         java.lang.String languageId, java.lang.String timeZoneId,
331         java.lang.String greeting, java.lang.String comments,
332         java.lang.String firstName, java.lang.String middleName,
333         java.lang.String lastName, int prefixId, int suffixId, boolean male,
334         int birthdayMonth, int birthdayDay, int birthdayYear,
335         java.lang.String smsSn, java.lang.String aimSn, java.lang.String icqSn,
336         java.lang.String jabberSn, java.lang.String msnSn,
337         java.lang.String skypeSn, java.lang.String ymSn,
338         java.lang.String jobTitle, long[] organizationIds)
339         throws com.liferay.portal.PortalException, 
340             com.liferay.portal.SystemException, java.rmi.RemoteException {
341         UserService userService = UserServiceFactory.getService();
342 
343         return userService.updateUser(userId, oldPassword, passwordReset,
344             screenName, emailAddress, languageId, timeZoneId, greeting,
345             comments, firstName, middleName, lastName, prefixId, suffixId,
346             male, birthdayMonth, birthdayDay, birthdayYear, smsSn, aimSn,
347             icqSn, jabberSn, msnSn, skypeSn, ymSn, jobTitle, organizationIds);
348     }
349 
350     public static com.liferay.portal.model.User updateUser(long userId,
351         java.lang.String oldPassword, java.lang.String newPassword1,
352         java.lang.String newPassword2, boolean passwordReset,
353         java.lang.String screenName, java.lang.String emailAddress,
354         java.lang.String languageId, java.lang.String timeZoneId,
355         java.lang.String greeting, java.lang.String comments,
356         java.lang.String firstName, java.lang.String middleName,
357         java.lang.String lastName, int prefixId, int suffixId, boolean male,
358         int birthdayMonth, int birthdayDay, int birthdayYear,
359         java.lang.String smsSn, java.lang.String aimSn, java.lang.String icqSn,
360         java.lang.String jabberSn, java.lang.String msnSn,
361         java.lang.String skypeSn, java.lang.String ymSn,
362         java.lang.String jobTitle, long[] organizationIds)
363         throws com.liferay.portal.PortalException, 
364             com.liferay.portal.SystemException, java.rmi.RemoteException {
365         UserService userService = UserServiceFactory.getService();
366 
367         return userService.updateUser(userId, oldPassword, newPassword1,
368             newPassword2, passwordReset, screenName, emailAddress, languageId,
369             timeZoneId, greeting, comments, firstName, middleName, lastName,
370             prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear,
371             smsSn, aimSn, icqSn, jabberSn, msnSn, skypeSn, ymSn, jobTitle,
372             organizationIds);
373     }
374 }