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