1   /**
2    * Copyright (c) 2000-2007 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   * <a href="UserServiceUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * <p>
29   * ServiceBuilder generated this class. Modifications in this class will be overwritten
30   * the next time is generated.
31   * </p>
32   *
33   * <p>
34   * This class provides static methods for the <code>com.liferay.portal.service.UserService</code>
35   * bean. The static methods of this class calls the same methods of the bean instance.
36   * It's convenient to be able to just write one line to call a method on a bean
37   * instead of writing a lookup call and a method call.
38   * </p>
39   *
40   * <p>
41   * <code>com.liferay.portal.service.UserServiceFactory</code> is responsible for
42   * the lookup of the bean.
43   * </p>
44   *
45   * @author Brian Wing Shun Chan
46   *
47   * @see com.liferay.portal.service.UserService
48   * @see com.liferay.portal.service.UserServiceFactory
49   *
50   */
51  public class UserServiceUtil {
52      public static void addGroupUsers(long groupId, long[] userIds)
53          throws com.liferay.portal.PortalException, 
54              com.liferay.portal.SystemException, java.rmi.RemoteException {
55          UserService userService = UserServiceFactory.getService();
56          userService.addGroupUsers(groupId, userIds);
57      }
58  
59      public static void addPasswordPolicyUsers(long passwordPolicyId,
60          long[] userIds)
61          throws com.liferay.portal.PortalException, 
62              com.liferay.portal.SystemException, java.rmi.RemoteException {
63          UserService userService = UserServiceFactory.getService();
64          userService.addPasswordPolicyUsers(passwordPolicyId, userIds);
65      }
66  
67      public static void addRoleUsers(long roleId, long[] userIds)
68          throws com.liferay.portal.PortalException, 
69              com.liferay.portal.SystemException, java.rmi.RemoteException {
70          UserService userService = UserServiceFactory.getService();
71          userService.addRoleUsers(roleId, userIds);
72      }
73  
74      public static void addUserGroupUsers(long userGroupId, long[] userIds)
75          throws com.liferay.portal.PortalException, 
76              com.liferay.portal.SystemException, java.rmi.RemoteException {
77          UserService userService = UserServiceFactory.getService();
78          userService.addUserGroupUsers(userGroupId, userIds);
79      }
80  
81      public static com.liferay.portal.model.User addUser(long companyId,
82          boolean autoPassword, java.lang.String password1,
83          java.lang.String password2, boolean autoScreenName,
84          java.lang.String screenName, java.lang.String emailAddress,
85          java.util.Locale locale, java.lang.String firstName,
86          java.lang.String middleName, java.lang.String lastName, int prefixId,
87          int suffixId, boolean male, int birthdayMonth, int birthdayDay,
88          int birthdayYear, java.lang.String jobTitle, long organizationId,
89          long locationId, boolean sendEmail)
90          throws com.liferay.portal.PortalException, 
91              com.liferay.portal.SystemException, java.rmi.RemoteException {
92          UserService userService = UserServiceFactory.getService();
93  
94          return userService.addUser(companyId, autoPassword, password1,
95              password2, autoScreenName, screenName, emailAddress, locale,
96              firstName, middleName, lastName, prefixId, suffixId, male,
97              birthdayMonth, birthdayDay, birthdayYear, jobTitle, organizationId,
98              locationId, sendEmail);
99      }
100 
101     public static void deleteRoleUser(long roleId, long userId)
102         throws com.liferay.portal.PortalException, 
103             com.liferay.portal.SystemException, java.rmi.RemoteException {
104         UserService userService = UserServiceFactory.getService();
105         userService.deleteRoleUser(roleId, userId);
106     }
107 
108     public static void deleteUser(long userId)
109         throws com.liferay.portal.PortalException, 
110             com.liferay.portal.SystemException, java.rmi.RemoteException {
111         UserService userService = UserServiceFactory.getService();
112         userService.deleteUser(userId);
113     }
114 
115     public static long getDefaultUserId(long companyId)
116         throws com.liferay.portal.PortalException, 
117             com.liferay.portal.SystemException, java.rmi.RemoteException {
118         UserService userService = UserServiceFactory.getService();
119 
120         return userService.getDefaultUserId(companyId);
121     }
122 
123     public static java.util.List getGroupUsers(long groupId)
124         throws com.liferay.portal.PortalException, 
125             com.liferay.portal.SystemException, java.rmi.RemoteException {
126         UserService userService = UserServiceFactory.getService();
127 
128         return userService.getGroupUsers(groupId);
129     }
130 
131     public static java.util.List getRoleUsers(long roleId)
132         throws com.liferay.portal.PortalException, 
133             com.liferay.portal.SystemException, java.rmi.RemoteException {
134         UserService userService = UserServiceFactory.getService();
135 
136         return userService.getRoleUsers(roleId);
137     }
138 
139     public static com.liferay.portal.model.User getUserByEmailAddress(
140         long companyId, java.lang.String emailAddress)
141         throws com.liferay.portal.PortalException, 
142             com.liferay.portal.SystemException, java.rmi.RemoteException {
143         UserService userService = UserServiceFactory.getService();
144 
145         return userService.getUserByEmailAddress(companyId, emailAddress);
146     }
147 
148     public static com.liferay.portal.model.User getUserById(long userId)
149         throws com.liferay.portal.PortalException, 
150             com.liferay.portal.SystemException, java.rmi.RemoteException {
151         UserService userService = UserServiceFactory.getService();
152 
153         return userService.getUserById(userId);
154     }
155 
156     public static com.liferay.portal.model.User getUserByScreenName(
157         long companyId, java.lang.String screenName)
158         throws com.liferay.portal.PortalException, 
159             com.liferay.portal.SystemException, java.rmi.RemoteException {
160         UserService userService = UserServiceFactory.getService();
161 
162         return userService.getUserByScreenName(companyId, screenName);
163     }
164 
165     public static boolean hasGroupUser(long groupId, long userId)
166         throws com.liferay.portal.PortalException, 
167             com.liferay.portal.SystemException, java.rmi.RemoteException {
168         UserService userService = UserServiceFactory.getService();
169 
170         return userService.hasGroupUser(groupId, userId);
171     }
172 
173     public static boolean hasRoleUser(long roleId, long userId)
174         throws com.liferay.portal.PortalException, 
175             com.liferay.portal.SystemException, java.rmi.RemoteException {
176         UserService userService = UserServiceFactory.getService();
177 
178         return userService.hasRoleUser(roleId, userId);
179     }
180 
181     public static void setGroupUsers(long groupId, long[] userIds)
182         throws com.liferay.portal.PortalException, 
183             com.liferay.portal.SystemException, java.rmi.RemoteException {
184         UserService userService = UserServiceFactory.getService();
185         userService.setGroupUsers(groupId, userIds);
186     }
187 
188     public static void setRoleUsers(long roleId, long[] userIds)
189         throws com.liferay.portal.PortalException, 
190             com.liferay.portal.SystemException, java.rmi.RemoteException {
191         UserService userService = UserServiceFactory.getService();
192         userService.setRoleUsers(roleId, userIds);
193     }
194 
195     public static void setUserGroupUsers(long userGroupId, long[] userIds)
196         throws com.liferay.portal.PortalException, 
197             com.liferay.portal.SystemException, java.rmi.RemoteException {
198         UserService userService = UserServiceFactory.getService();
199         userService.setUserGroupUsers(userGroupId, userIds);
200     }
201 
202     public static void unsetGroupUsers(long groupId, long[] userIds)
203         throws com.liferay.portal.PortalException, 
204             com.liferay.portal.SystemException, java.rmi.RemoteException {
205         UserService userService = UserServiceFactory.getService();
206         userService.unsetGroupUsers(groupId, userIds);
207     }
208 
209     public static void unsetPasswordPolicyUsers(long passwordPolicyId,
210         long[] userIds)
211         throws com.liferay.portal.PortalException, 
212             com.liferay.portal.SystemException, java.rmi.RemoteException {
213         UserService userService = UserServiceFactory.getService();
214         userService.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
215     }
216 
217     public static void unsetRoleUsers(long roleId, long[] userIds)
218         throws com.liferay.portal.PortalException, 
219             com.liferay.portal.SystemException, java.rmi.RemoteException {
220         UserService userService = UserServiceFactory.getService();
221         userService.unsetRoleUsers(roleId, userIds);
222     }
223 
224     public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
225         throws com.liferay.portal.PortalException, 
226             com.liferay.portal.SystemException, java.rmi.RemoteException {
227         UserService userService = UserServiceFactory.getService();
228         userService.unsetUserGroupUsers(userGroupId, userIds);
229     }
230 
231     public static com.liferay.portal.model.User updateActive(long userId,
232         boolean active)
233         throws com.liferay.portal.PortalException, 
234             com.liferay.portal.SystemException, java.rmi.RemoteException {
235         UserService userService = UserServiceFactory.getService();
236 
237         return userService.updateActive(userId, active);
238     }
239 
240     public static com.liferay.portal.model.User updateAgreedToTermsOfUse(
241         long userId, boolean agreedToTermsOfUse)
242         throws com.liferay.portal.PortalException, 
243             com.liferay.portal.SystemException, java.rmi.RemoteException {
244         UserService userService = UserServiceFactory.getService();
245 
246         return userService.updateAgreedToTermsOfUse(userId, agreedToTermsOfUse);
247     }
248 
249     public static com.liferay.portal.model.User updateLockout(long userId,
250         boolean lockout)
251         throws com.liferay.portal.PortalException, 
252             com.liferay.portal.SystemException, java.rmi.RemoteException {
253         UserService userService = UserServiceFactory.getService();
254 
255         return userService.updateLockout(userId, lockout);
256     }
257 
258     public static void updateOrganizations(long userId, long organizationId,
259         long locationId)
260         throws com.liferay.portal.PortalException, 
261             com.liferay.portal.SystemException, java.rmi.RemoteException {
262         UserService userService = UserServiceFactory.getService();
263         userService.updateOrganizations(userId, organizationId, locationId);
264     }
265 
266     public static com.liferay.portal.model.User updatePassword(long userId,
267         java.lang.String password1, java.lang.String password2,
268         boolean passwordReset)
269         throws com.liferay.portal.PortalException, 
270             com.liferay.portal.SystemException, java.rmi.RemoteException {
271         UserService userService = UserServiceFactory.getService();
272 
273         return userService.updatePassword(userId, password1, password2,
274             passwordReset);
275     }
276 
277     public static void updatePortrait(long userId, byte[] bytes)
278         throws com.liferay.portal.PortalException, 
279             com.liferay.portal.SystemException, java.rmi.RemoteException {
280         UserService userService = UserServiceFactory.getService();
281         userService.updatePortrait(userId, bytes);
282     }
283 
284     public static com.liferay.portal.model.User updateUser(long userId,
285         java.lang.String password, java.lang.String screenName,
286         java.lang.String emailAddress, java.lang.String languageId,
287         java.lang.String timeZoneId, java.lang.String greeting,
288         java.lang.String comments, java.lang.String firstName,
289         java.lang.String middleName, java.lang.String lastName, int prefixId,
290         int suffixId, boolean male, int birthdayMonth, int birthdayDay,
291         int birthdayYear, java.lang.String smsSn, java.lang.String aimSn,
292         java.lang.String icqSn, java.lang.String jabberSn,
293         java.lang.String msnSn, java.lang.String skypeSn,
294         java.lang.String ymSn, java.lang.String jobTitle, long organizationId,
295         long locationId)
296         throws com.liferay.portal.PortalException, 
297             com.liferay.portal.SystemException, java.rmi.RemoteException {
298         UserService userService = UserServiceFactory.getService();
299 
300         return userService.updateUser(userId, password, screenName,
301             emailAddress, languageId, timeZoneId, greeting, comments,
302             firstName, middleName, lastName, prefixId, suffixId, male,
303             birthdayMonth, birthdayDay, birthdayYear, smsSn, aimSn, icqSn,
304             jabberSn, msnSn, skypeSn, ymSn, jobTitle, organizationId, locationId);
305     }
306 }