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.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.service.UserServiceUtil;
28  
29  import java.rmi.RemoteException;
30  
31  /**
32   * <a href="UserServiceSoap.java.html"><b><i>View Source</i></b></a>
33   *
34   * <p>
35   * ServiceBuilder generated this class. Modifications in this class will be overwritten
36   * the next time is generated.
37   * </p>
38   *
39   * <p>
40   * This class provides a SOAP utility for the <code>com.liferay.portal.service.UserServiceUtil</code>
41   * service utility. The static methods of this class calls the same methods of the
42   * service utility. However, the signatures are different because it is difficult
43   * for SOAP to support certain types.
44   * </p>
45   *
46   * <p>
47   * ServiceBuilder follows certain rules in translating the methods. For example,
48   * if the method in the service utility returns a <code>java.util.List</code>, that
49   * is translated to an array of <code>com.liferay.portal.model.UserSoap</code>.
50   * If the method in the service utility returns a <code>com.liferay.portal.model.User</code>,
51   * that is translated to a <code>com.liferay.portal.model.UserSoap</code>. Methods
52   * that SOAP cannot safely wire are skipped.
53   * </p>
54   *
55   * <p>
56   * The benefits of using the SOAP utility is that it is cross platform compatible.
57   * SOAP allows different languages like Java, .NET, C++, PHP, and even Perl, to
58   * call the generated services. One drawback of SOAP is that it is slow because
59   * it needs to serialize all calls into a text format (XML).
60   * </p>
61   *
62   * <p>
63   * You can see a list of services at http://localhost:8080/tunnel-web/secure/axis.
64   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
65   * to configure security.
66   * </p>
67   *
68   * <p>
69   * The SOAP utility is only generated for remote services.
70   * </p>
71   *
72   * @author Brian Wing Shun Chan
73   *
74   * @see com.liferay.portal.service.UserServiceUtil
75   * @see com.liferay.portal.service.http.UserServiceHttp
76   * @see com.liferay.portal.service.model.UserSoap
77   *
78   */
79  public class UserServiceSoap {
80      public static void addGroupUsers(long groupId, long[] userIds)
81          throws RemoteException {
82          try {
83              UserServiceUtil.addGroupUsers(groupId, userIds);
84          }
85          catch (Exception e) {
86              _log.error(e, e);
87              throw new RemoteException(e.getMessage());
88          }
89      }
90  
91      public static void addPasswordPolicyUsers(long passwordPolicyId,
92          long[] userIds) throws RemoteException {
93          try {
94              UserServiceUtil.addPasswordPolicyUsers(passwordPolicyId, userIds);
95          }
96          catch (Exception e) {
97              _log.error(e, e);
98              throw new RemoteException(e.getMessage());
99          }
100     }
101 
102     public static void addRoleUsers(long roleId, long[] userIds)
103         throws RemoteException {
104         try {
105             UserServiceUtil.addRoleUsers(roleId, userIds);
106         }
107         catch (Exception e) {
108             _log.error(e, e);
109             throw new RemoteException(e.getMessage());
110         }
111     }
112 
113     public static void addUserGroupUsers(long userGroupId, long[] userIds)
114         throws RemoteException {
115         try {
116             UserServiceUtil.addUserGroupUsers(userGroupId, userIds);
117         }
118         catch (Exception e) {
119             _log.error(e, e);
120             throw new RemoteException(e.getMessage());
121         }
122     }
123 
124     public static com.liferay.portal.model.UserSoap addUser(long companyId,
125         boolean autoPassword, java.lang.String password1,
126         java.lang.String password2, boolean autoScreenName,
127         java.lang.String screenName, java.lang.String emailAddress,
128         String locale, java.lang.String firstName, java.lang.String middleName,
129         java.lang.String lastName, int prefixId, int suffixId, boolean male,
130         int birthdayMonth, int birthdayDay, int birthdayYear,
131         java.lang.String jobTitle, long organizationId, long locationId,
132         boolean sendEmail) throws RemoteException {
133         try {
134             com.liferay.portal.model.User returnValue = UserServiceUtil.addUser(companyId,
135                     autoPassword, password1, password2, autoScreenName,
136                     screenName, emailAddress, new java.util.Locale(locale),
137                     firstName, middleName, lastName, prefixId, suffixId, male,
138                     birthdayMonth, birthdayDay, birthdayYear, jobTitle,
139                     organizationId, locationId, sendEmail);
140 
141             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
142         }
143         catch (Exception e) {
144             _log.error(e, e);
145             throw new RemoteException(e.getMessage());
146         }
147     }
148 
149     public static void deleteRoleUser(long roleId, long userId)
150         throws RemoteException {
151         try {
152             UserServiceUtil.deleteRoleUser(roleId, userId);
153         }
154         catch (Exception e) {
155             _log.error(e, e);
156             throw new RemoteException(e.getMessage());
157         }
158     }
159 
160     public static void deleteUser(long userId) throws RemoteException {
161         try {
162             UserServiceUtil.deleteUser(userId);
163         }
164         catch (Exception e) {
165             _log.error(e, e);
166             throw new RemoteException(e.getMessage());
167         }
168     }
169 
170     public static long getDefaultUserId(long companyId)
171         throws RemoteException {
172         try {
173             long returnValue = UserServiceUtil.getDefaultUserId(companyId);
174 
175             return returnValue;
176         }
177         catch (Exception e) {
178             _log.error(e, e);
179             throw new RemoteException(e.getMessage());
180         }
181     }
182 
183     public static com.liferay.portal.model.UserSoap[] getGroupUsers(
184         long groupId) throws RemoteException {
185         try {
186             java.util.List returnValue = UserServiceUtil.getGroupUsers(groupId);
187 
188             return com.liferay.portal.model.UserSoap.toSoapModels(returnValue);
189         }
190         catch (Exception e) {
191             _log.error(e, e);
192             throw new RemoteException(e.getMessage());
193         }
194     }
195 
196     public static com.liferay.portal.model.UserSoap[] getRoleUsers(long roleId)
197         throws RemoteException {
198         try {
199             java.util.List returnValue = UserServiceUtil.getRoleUsers(roleId);
200 
201             return com.liferay.portal.model.UserSoap.toSoapModels(returnValue);
202         }
203         catch (Exception e) {
204             _log.error(e, e);
205             throw new RemoteException(e.getMessage());
206         }
207     }
208 
209     public static com.liferay.portal.model.UserSoap getUserByEmailAddress(
210         long companyId, java.lang.String emailAddress)
211         throws RemoteException {
212         try {
213             com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByEmailAddress(companyId,
214                     emailAddress);
215 
216             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
217         }
218         catch (Exception e) {
219             _log.error(e, e);
220             throw new RemoteException(e.getMessage());
221         }
222     }
223 
224     public static com.liferay.portal.model.UserSoap getUserById(long userId)
225         throws RemoteException {
226         try {
227             com.liferay.portal.model.User returnValue = UserServiceUtil.getUserById(userId);
228 
229             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
230         }
231         catch (Exception e) {
232             _log.error(e, e);
233             throw new RemoteException(e.getMessage());
234         }
235     }
236 
237     public static com.liferay.portal.model.UserSoap getUserByScreenName(
238         long companyId, java.lang.String screenName) throws RemoteException {
239         try {
240             com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByScreenName(companyId,
241                     screenName);
242 
243             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
244         }
245         catch (Exception e) {
246             _log.error(e, e);
247             throw new RemoteException(e.getMessage());
248         }
249     }
250 
251     public static boolean hasGroupUser(long groupId, long userId)
252         throws RemoteException {
253         try {
254             boolean returnValue = UserServiceUtil.hasGroupUser(groupId, userId);
255 
256             return returnValue;
257         }
258         catch (Exception e) {
259             _log.error(e, e);
260             throw new RemoteException(e.getMessage());
261         }
262     }
263 
264     public static boolean hasRoleUser(long roleId, long userId)
265         throws RemoteException {
266         try {
267             boolean returnValue = UserServiceUtil.hasRoleUser(roleId, userId);
268 
269             return returnValue;
270         }
271         catch (Exception e) {
272             _log.error(e, e);
273             throw new RemoteException(e.getMessage());
274         }
275     }
276 
277     public static void setGroupUsers(long groupId, long[] userIds)
278         throws RemoteException {
279         try {
280             UserServiceUtil.setGroupUsers(groupId, userIds);
281         }
282         catch (Exception e) {
283             _log.error(e, e);
284             throw new RemoteException(e.getMessage());
285         }
286     }
287 
288     public static void setRoleUsers(long roleId, long[] userIds)
289         throws RemoteException {
290         try {
291             UserServiceUtil.setRoleUsers(roleId, userIds);
292         }
293         catch (Exception e) {
294             _log.error(e, e);
295             throw new RemoteException(e.getMessage());
296         }
297     }
298 
299     public static void setUserGroupUsers(long userGroupId, long[] userIds)
300         throws RemoteException {
301         try {
302             UserServiceUtil.setUserGroupUsers(userGroupId, userIds);
303         }
304         catch (Exception e) {
305             _log.error(e, e);
306             throw new RemoteException(e.getMessage());
307         }
308     }
309 
310     public static void unsetGroupUsers(long groupId, long[] userIds)
311         throws RemoteException {
312         try {
313             UserServiceUtil.unsetGroupUsers(groupId, userIds);
314         }
315         catch (Exception e) {
316             _log.error(e, e);
317             throw new RemoteException(e.getMessage());
318         }
319     }
320 
321     public static void unsetPasswordPolicyUsers(long passwordPolicyId,
322         long[] userIds) throws RemoteException {
323         try {
324             UserServiceUtil.unsetPasswordPolicyUsers(passwordPolicyId, userIds);
325         }
326         catch (Exception e) {
327             _log.error(e, e);
328             throw new RemoteException(e.getMessage());
329         }
330     }
331 
332     public static void unsetRoleUsers(long roleId, long[] userIds)
333         throws RemoteException {
334         try {
335             UserServiceUtil.unsetRoleUsers(roleId, userIds);
336         }
337         catch (Exception e) {
338             _log.error(e, e);
339             throw new RemoteException(e.getMessage());
340         }
341     }
342 
343     public static void unsetUserGroupUsers(long userGroupId, long[] userIds)
344         throws RemoteException {
345         try {
346             UserServiceUtil.unsetUserGroupUsers(userGroupId, userIds);
347         }
348         catch (Exception e) {
349             _log.error(e, e);
350             throw new RemoteException(e.getMessage());
351         }
352     }
353 
354     public static com.liferay.portal.model.UserSoap updateActive(long userId,
355         boolean active) throws RemoteException {
356         try {
357             com.liferay.portal.model.User returnValue = UserServiceUtil.updateActive(userId,
358                     active);
359 
360             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
361         }
362         catch (Exception e) {
363             _log.error(e, e);
364             throw new RemoteException(e.getMessage());
365         }
366     }
367 
368     public static com.liferay.portal.model.UserSoap updateAgreedToTermsOfUse(
369         long userId, boolean agreedToTermsOfUse) throws RemoteException {
370         try {
371             com.liferay.portal.model.User returnValue = UserServiceUtil.updateAgreedToTermsOfUse(userId,
372                     agreedToTermsOfUse);
373 
374             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
375         }
376         catch (Exception e) {
377             _log.error(e, e);
378             throw new RemoteException(e.getMessage());
379         }
380     }
381 
382     public static com.liferay.portal.model.UserSoap updateLockout(long userId,
383         boolean lockout) throws RemoteException {
384         try {
385             com.liferay.portal.model.User returnValue = UserServiceUtil.updateLockout(userId,
386                     lockout);
387 
388             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
389         }
390         catch (Exception e) {
391             _log.error(e, e);
392             throw new RemoteException(e.getMessage());
393         }
394     }
395 
396     public static void updateOrganizations(long userId, long organizationId,
397         long locationId) throws RemoteException {
398         try {
399             UserServiceUtil.updateOrganizations(userId, organizationId,
400                 locationId);
401         }
402         catch (Exception e) {
403             _log.error(e, e);
404             throw new RemoteException(e.getMessage());
405         }
406     }
407 
408     public static com.liferay.portal.model.UserSoap updatePassword(
409         long userId, java.lang.String password1, java.lang.String password2,
410         boolean passwordReset) throws RemoteException {
411         try {
412             com.liferay.portal.model.User returnValue = UserServiceUtil.updatePassword(userId,
413                     password1, password2, passwordReset);
414 
415             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
416         }
417         catch (Exception e) {
418             _log.error(e, e);
419             throw new RemoteException(e.getMessage());
420         }
421     }
422 
423     public static void updatePortrait(long userId, byte[] bytes)
424         throws RemoteException {
425         try {
426             UserServiceUtil.updatePortrait(userId, bytes);
427         }
428         catch (Exception e) {
429             _log.error(e, e);
430             throw new RemoteException(e.getMessage());
431         }
432     }
433 
434     public static com.liferay.portal.model.UserSoap updateUser(long userId,
435         java.lang.String password, java.lang.String screenName,
436         java.lang.String emailAddress, java.lang.String languageId,
437         java.lang.String timeZoneId, java.lang.String greeting,
438         java.lang.String comments, java.lang.String firstName,
439         java.lang.String middleName, java.lang.String lastName, int prefixId,
440         int suffixId, boolean male, int birthdayMonth, int birthdayDay,
441         int birthdayYear, java.lang.String smsSn, java.lang.String aimSn,
442         java.lang.String icqSn, java.lang.String jabberSn,
443         java.lang.String msnSn, java.lang.String skypeSn,
444         java.lang.String ymSn, java.lang.String jobTitle, long organizationId,
445         long locationId) throws RemoteException {
446         try {
447             com.liferay.portal.model.User returnValue = UserServiceUtil.updateUser(userId,
448                     password, screenName, emailAddress, languageId, timeZoneId,
449                     greeting, comments, firstName, middleName, lastName,
450                     prefixId, suffixId, male, birthdayMonth, birthdayDay,
451                     birthdayYear, smsSn, aimSn, icqSn, jabberSn, msnSn,
452                     skypeSn, ymSn, jobTitle, organizationId, locationId);
453 
454             return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
455         }
456         catch (Exception e) {
457             _log.error(e, e);
458             throw new RemoteException(e.getMessage());
459         }
460     }
461 
462     private static Log _log = LogFactoryUtil.getLog(UserServiceSoap.class);
463 }