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.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.IntegerWrapper;
29  import com.liferay.portal.kernel.util.LongWrapper;
30  import com.liferay.portal.kernel.util.MethodWrapper;
31  import com.liferay.portal.kernel.util.NullWrapper;
32  import com.liferay.portal.security.auth.HttpPrincipal;
33  import com.liferay.portal.service.UserServiceUtil;
34  import com.liferay.portal.service.http.TunnelUtil;
35  
36  /**
37   * <a href="UserServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be overwritten
41   * the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the <code>com.liferay.portal.service.UserServiceUtil</code>
46   * service utility. The static methods of this class calls the same methods of the
47   * service utility. However, the signatures are different because it requires an
48   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code> parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for tunneling
53   * without the cost of serializing to text. The drawback is that it only works with
54   * Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
59   * to configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author Brian Wing Shun Chan
67   *
68   * @see com.liferay.portal.security.auth.HttpPrincipal
69   * @see com.liferay.portal.service.UserServiceUtil
70   * @see com.liferay.portal.service.http.UserServiceSoap
71   *
72   */
73  public class UserServiceHttp {
74      public static void addGroupUsers(HttpPrincipal httpPrincipal, long groupId,
75          long[] userIds)
76          throws com.liferay.portal.SystemException, 
77              com.liferay.portal.PortalException {
78          try {
79              Object paramObj0 = new LongWrapper(groupId);
80              Object paramObj1 = userIds;
81  
82              if (userIds == null) {
83                  paramObj1 = new NullWrapper("[J");
84              }
85  
86              MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
87                      "addGroupUsers", new Object[] { paramObj0, paramObj1 });
88  
89              try {
90                  TunnelUtil.invoke(httpPrincipal, methodWrapper);
91              }
92              catch (Exception e) {
93                  if (e instanceof com.liferay.portal.SystemException) {
94                      throw (com.liferay.portal.SystemException)e;
95                  }
96  
97                  if (e instanceof com.liferay.portal.PortalException) {
98                      throw (com.liferay.portal.PortalException)e;
99                  }
100 
101                 throw new com.liferay.portal.SystemException(e);
102             }
103         }
104         catch (com.liferay.portal.SystemException se) {
105             _log.error(se, se);
106             throw se;
107         }
108     }
109 
110     public static void addPasswordPolicyUsers(HttpPrincipal httpPrincipal,
111         long passwordPolicyId, long[] userIds)
112         throws com.liferay.portal.SystemException, 
113             com.liferay.portal.PortalException {
114         try {
115             Object paramObj0 = new LongWrapper(passwordPolicyId);
116             Object paramObj1 = userIds;
117 
118             if (userIds == null) {
119                 paramObj1 = new NullWrapper("[J");
120             }
121 
122             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
123                     "addPasswordPolicyUsers",
124                     new Object[] { paramObj0, paramObj1 });
125 
126             try {
127                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
128             }
129             catch (Exception e) {
130                 if (e instanceof com.liferay.portal.SystemException) {
131                     throw (com.liferay.portal.SystemException)e;
132                 }
133 
134                 if (e instanceof com.liferay.portal.PortalException) {
135                     throw (com.liferay.portal.PortalException)e;
136                 }
137 
138                 throw new com.liferay.portal.SystemException(e);
139             }
140         }
141         catch (com.liferay.portal.SystemException se) {
142             _log.error(se, se);
143             throw se;
144         }
145     }
146 
147     public static void addRoleUsers(HttpPrincipal httpPrincipal, long roleId,
148         long[] userIds)
149         throws com.liferay.portal.SystemException, 
150             com.liferay.portal.PortalException {
151         try {
152             Object paramObj0 = new LongWrapper(roleId);
153             Object paramObj1 = userIds;
154 
155             if (userIds == null) {
156                 paramObj1 = new NullWrapper("[J");
157             }
158 
159             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
160                     "addRoleUsers", new Object[] { paramObj0, paramObj1 });
161 
162             try {
163                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
164             }
165             catch (Exception e) {
166                 if (e instanceof com.liferay.portal.SystemException) {
167                     throw (com.liferay.portal.SystemException)e;
168                 }
169 
170                 if (e instanceof com.liferay.portal.PortalException) {
171                     throw (com.liferay.portal.PortalException)e;
172                 }
173 
174                 throw new com.liferay.portal.SystemException(e);
175             }
176         }
177         catch (com.liferay.portal.SystemException se) {
178             _log.error(se, se);
179             throw se;
180         }
181     }
182 
183     public static void addUserGroupUsers(HttpPrincipal httpPrincipal,
184         long userGroupId, long[] userIds)
185         throws com.liferay.portal.SystemException, 
186             com.liferay.portal.PortalException {
187         try {
188             Object paramObj0 = new LongWrapper(userGroupId);
189             Object paramObj1 = userIds;
190 
191             if (userIds == null) {
192                 paramObj1 = new NullWrapper("[J");
193             }
194 
195             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
196                     "addUserGroupUsers", new Object[] { paramObj0, paramObj1 });
197 
198             try {
199                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
200             }
201             catch (Exception e) {
202                 if (e instanceof com.liferay.portal.SystemException) {
203                     throw (com.liferay.portal.SystemException)e;
204                 }
205 
206                 if (e instanceof com.liferay.portal.PortalException) {
207                     throw (com.liferay.portal.PortalException)e;
208                 }
209 
210                 throw new com.liferay.portal.SystemException(e);
211             }
212         }
213         catch (com.liferay.portal.SystemException se) {
214             _log.error(se, se);
215             throw se;
216         }
217     }
218 
219     public static com.liferay.portal.model.User addUser(
220         HttpPrincipal httpPrincipal, long companyId, boolean autoPassword,
221         java.lang.String password1, java.lang.String password2,
222         boolean autoScreenName, java.lang.String screenName,
223         java.lang.String emailAddress, java.util.Locale locale,
224         java.lang.String firstName, java.lang.String middleName,
225         java.lang.String lastName, int prefixId, int suffixId, boolean male,
226         int birthdayMonth, int birthdayDay, int birthdayYear,
227         java.lang.String jobTitle, long organizationId, long locationId,
228         boolean sendEmail)
229         throws com.liferay.portal.SystemException, 
230             com.liferay.portal.PortalException {
231         try {
232             Object paramObj0 = new LongWrapper(companyId);
233             Object paramObj1 = new BooleanWrapper(autoPassword);
234             Object paramObj2 = password1;
235 
236             if (password1 == null) {
237                 paramObj2 = new NullWrapper("java.lang.String");
238             }
239 
240             Object paramObj3 = password2;
241 
242             if (password2 == null) {
243                 paramObj3 = new NullWrapper("java.lang.String");
244             }
245 
246             Object paramObj4 = new BooleanWrapper(autoScreenName);
247             Object paramObj5 = screenName;
248 
249             if (screenName == null) {
250                 paramObj5 = new NullWrapper("java.lang.String");
251             }
252 
253             Object paramObj6 = emailAddress;
254 
255             if (emailAddress == null) {
256                 paramObj6 = new NullWrapper("java.lang.String");
257             }
258 
259             Object paramObj7 = locale;
260 
261             if (locale == null) {
262                 paramObj7 = new NullWrapper("java.util.Locale");
263             }
264 
265             Object paramObj8 = firstName;
266 
267             if (firstName == null) {
268                 paramObj8 = new NullWrapper("java.lang.String");
269             }
270 
271             Object paramObj9 = middleName;
272 
273             if (middleName == null) {
274                 paramObj9 = new NullWrapper("java.lang.String");
275             }
276 
277             Object paramObj10 = lastName;
278 
279             if (lastName == null) {
280                 paramObj10 = new NullWrapper("java.lang.String");
281             }
282 
283             Object paramObj11 = new IntegerWrapper(prefixId);
284             Object paramObj12 = new IntegerWrapper(suffixId);
285             Object paramObj13 = new BooleanWrapper(male);
286             Object paramObj14 = new IntegerWrapper(birthdayMonth);
287             Object paramObj15 = new IntegerWrapper(birthdayDay);
288             Object paramObj16 = new IntegerWrapper(birthdayYear);
289             Object paramObj17 = jobTitle;
290 
291             if (jobTitle == null) {
292                 paramObj17 = new NullWrapper("java.lang.String");
293             }
294 
295             Object paramObj18 = new LongWrapper(organizationId);
296             Object paramObj19 = new LongWrapper(locationId);
297             Object paramObj20 = new BooleanWrapper(sendEmail);
298             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
299                     "addUser",
300                     new Object[] {
301                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
302                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
303                         paramObj10, paramObj11, paramObj12, paramObj13,
304                         paramObj14, paramObj15, paramObj16, paramObj17,
305                         paramObj18, paramObj19, paramObj20
306                     });
307             Object returnObj = null;
308 
309             try {
310                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
311             }
312             catch (Exception e) {
313                 if (e instanceof com.liferay.portal.SystemException) {
314                     throw (com.liferay.portal.SystemException)e;
315                 }
316 
317                 if (e instanceof com.liferay.portal.PortalException) {
318                     throw (com.liferay.portal.PortalException)e;
319                 }
320 
321                 throw new com.liferay.portal.SystemException(e);
322             }
323 
324             return (com.liferay.portal.model.User)returnObj;
325         }
326         catch (com.liferay.portal.SystemException se) {
327             _log.error(se, se);
328             throw se;
329         }
330     }
331 
332     public static void deleteRoleUser(HttpPrincipal httpPrincipal, long roleId,
333         long userId)
334         throws com.liferay.portal.SystemException, 
335             com.liferay.portal.PortalException {
336         try {
337             Object paramObj0 = new LongWrapper(roleId);
338             Object paramObj1 = new LongWrapper(userId);
339             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
340                     "deleteRoleUser", new Object[] { paramObj0, paramObj1 });
341 
342             try {
343                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
344             }
345             catch (Exception e) {
346                 if (e instanceof com.liferay.portal.SystemException) {
347                     throw (com.liferay.portal.SystemException)e;
348                 }
349 
350                 if (e instanceof com.liferay.portal.PortalException) {
351                     throw (com.liferay.portal.PortalException)e;
352                 }
353 
354                 throw new com.liferay.portal.SystemException(e);
355             }
356         }
357         catch (com.liferay.portal.SystemException se) {
358             _log.error(se, se);
359             throw se;
360         }
361     }
362 
363     public static void deleteUser(HttpPrincipal httpPrincipal, long userId)
364         throws com.liferay.portal.SystemException, 
365             com.liferay.portal.PortalException {
366         try {
367             Object paramObj0 = new LongWrapper(userId);
368             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
369                     "deleteUser", new Object[] { paramObj0 });
370 
371             try {
372                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
373             }
374             catch (Exception e) {
375                 if (e instanceof com.liferay.portal.SystemException) {
376                     throw (com.liferay.portal.SystemException)e;
377                 }
378 
379                 if (e instanceof com.liferay.portal.PortalException) {
380                     throw (com.liferay.portal.PortalException)e;
381                 }
382 
383                 throw new com.liferay.portal.SystemException(e);
384             }
385         }
386         catch (com.liferay.portal.SystemException se) {
387             _log.error(se, se);
388             throw se;
389         }
390     }
391 
392     public static long getDefaultUserId(HttpPrincipal httpPrincipal,
393         long companyId)
394         throws com.liferay.portal.SystemException, 
395             com.liferay.portal.PortalException {
396         try {
397             Object paramObj0 = new LongWrapper(companyId);
398             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
399                     "getDefaultUserId", new Object[] { paramObj0 });
400             Object returnObj = null;
401 
402             try {
403                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
404             }
405             catch (Exception e) {
406                 if (e instanceof com.liferay.portal.SystemException) {
407                     throw (com.liferay.portal.SystemException)e;
408                 }
409 
410                 if (e instanceof com.liferay.portal.PortalException) {
411                     throw (com.liferay.portal.PortalException)e;
412                 }
413 
414                 throw new com.liferay.portal.SystemException(e);
415             }
416 
417             return ((Long)returnObj).longValue();
418         }
419         catch (com.liferay.portal.SystemException se) {
420             _log.error(se, se);
421             throw se;
422         }
423     }
424 
425     public static java.util.List getGroupUsers(HttpPrincipal httpPrincipal,
426         long groupId)
427         throws com.liferay.portal.SystemException, 
428             com.liferay.portal.PortalException {
429         try {
430             Object paramObj0 = new LongWrapper(groupId);
431             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
432                     "getGroupUsers", new Object[] { paramObj0 });
433             Object returnObj = null;
434 
435             try {
436                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
437             }
438             catch (Exception e) {
439                 if (e instanceof com.liferay.portal.SystemException) {
440                     throw (com.liferay.portal.SystemException)e;
441                 }
442 
443                 if (e instanceof com.liferay.portal.PortalException) {
444                     throw (com.liferay.portal.PortalException)e;
445                 }
446 
447                 throw new com.liferay.portal.SystemException(e);
448             }
449 
450             return (java.util.List)returnObj;
451         }
452         catch (com.liferay.portal.SystemException se) {
453             _log.error(se, se);
454             throw se;
455         }
456     }
457 
458     public static java.util.List getRoleUsers(HttpPrincipal httpPrincipal,
459         long roleId)
460         throws com.liferay.portal.SystemException, 
461             com.liferay.portal.PortalException {
462         try {
463             Object paramObj0 = new LongWrapper(roleId);
464             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
465                     "getRoleUsers", new Object[] { paramObj0 });
466             Object returnObj = null;
467 
468             try {
469                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
470             }
471             catch (Exception e) {
472                 if (e instanceof com.liferay.portal.SystemException) {
473                     throw (com.liferay.portal.SystemException)e;
474                 }
475 
476                 if (e instanceof com.liferay.portal.PortalException) {
477                     throw (com.liferay.portal.PortalException)e;
478                 }
479 
480                 throw new com.liferay.portal.SystemException(e);
481             }
482 
483             return (java.util.List)returnObj;
484         }
485         catch (com.liferay.portal.SystemException se) {
486             _log.error(se, se);
487             throw se;
488         }
489     }
490 
491     public static com.liferay.portal.model.User getUserByEmailAddress(
492         HttpPrincipal httpPrincipal, long companyId,
493         java.lang.String emailAddress)
494         throws com.liferay.portal.SystemException, 
495             com.liferay.portal.PortalException {
496         try {
497             Object paramObj0 = new LongWrapper(companyId);
498             Object paramObj1 = emailAddress;
499 
500             if (emailAddress == null) {
501                 paramObj1 = new NullWrapper("java.lang.String");
502             }
503 
504             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
505                     "getUserByEmailAddress",
506                     new Object[] { paramObj0, paramObj1 });
507             Object returnObj = null;
508 
509             try {
510                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
511             }
512             catch (Exception e) {
513                 if (e instanceof com.liferay.portal.SystemException) {
514                     throw (com.liferay.portal.SystemException)e;
515                 }
516 
517                 if (e instanceof com.liferay.portal.PortalException) {
518                     throw (com.liferay.portal.PortalException)e;
519                 }
520 
521                 throw new com.liferay.portal.SystemException(e);
522             }
523 
524             return (com.liferay.portal.model.User)returnObj;
525         }
526         catch (com.liferay.portal.SystemException se) {
527             _log.error(se, se);
528             throw se;
529         }
530     }
531 
532     public static com.liferay.portal.model.User getUserById(
533         HttpPrincipal httpPrincipal, long userId)
534         throws com.liferay.portal.SystemException, 
535             com.liferay.portal.PortalException {
536         try {
537             Object paramObj0 = new LongWrapper(userId);
538             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
539                     "getUserById", new Object[] { paramObj0 });
540             Object returnObj = null;
541 
542             try {
543                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
544             }
545             catch (Exception e) {
546                 if (e instanceof com.liferay.portal.SystemException) {
547                     throw (com.liferay.portal.SystemException)e;
548                 }
549 
550                 if (e instanceof com.liferay.portal.PortalException) {
551                     throw (com.liferay.portal.PortalException)e;
552                 }
553 
554                 throw new com.liferay.portal.SystemException(e);
555             }
556 
557             return (com.liferay.portal.model.User)returnObj;
558         }
559         catch (com.liferay.portal.SystemException se) {
560             _log.error(se, se);
561             throw se;
562         }
563     }
564 
565     public static com.liferay.portal.model.User getUserByScreenName(
566         HttpPrincipal httpPrincipal, long companyId, java.lang.String screenName)
567         throws com.liferay.portal.SystemException, 
568             com.liferay.portal.PortalException {
569         try {
570             Object paramObj0 = new LongWrapper(companyId);
571             Object paramObj1 = screenName;
572 
573             if (screenName == null) {
574                 paramObj1 = new NullWrapper("java.lang.String");
575             }
576 
577             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
578                     "getUserByScreenName", new Object[] { paramObj0, paramObj1 });
579             Object returnObj = null;
580 
581             try {
582                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
583             }
584             catch (Exception e) {
585                 if (e instanceof com.liferay.portal.SystemException) {
586                     throw (com.liferay.portal.SystemException)e;
587                 }
588 
589                 if (e instanceof com.liferay.portal.PortalException) {
590                     throw (com.liferay.portal.PortalException)e;
591                 }
592 
593                 throw new com.liferay.portal.SystemException(e);
594             }
595 
596             return (com.liferay.portal.model.User)returnObj;
597         }
598         catch (com.liferay.portal.SystemException se) {
599             _log.error(se, se);
600             throw se;
601         }
602     }
603 
604     public static boolean hasGroupUser(HttpPrincipal httpPrincipal,
605         long groupId, long userId)
606         throws com.liferay.portal.SystemException, 
607             com.liferay.portal.PortalException {
608         try {
609             Object paramObj0 = new LongWrapper(groupId);
610             Object paramObj1 = new LongWrapper(userId);
611             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
612                     "hasGroupUser", new Object[] { paramObj0, paramObj1 });
613             Object returnObj = null;
614 
615             try {
616                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
617             }
618             catch (Exception e) {
619                 if (e instanceof com.liferay.portal.SystemException) {
620                     throw (com.liferay.portal.SystemException)e;
621                 }
622 
623                 if (e instanceof com.liferay.portal.PortalException) {
624                     throw (com.liferay.portal.PortalException)e;
625                 }
626 
627                 throw new com.liferay.portal.SystemException(e);
628             }
629 
630             return ((Boolean)returnObj).booleanValue();
631         }
632         catch (com.liferay.portal.SystemException se) {
633             _log.error(se, se);
634             throw se;
635         }
636     }
637 
638     public static boolean hasRoleUser(HttpPrincipal httpPrincipal, long roleId,
639         long userId)
640         throws com.liferay.portal.SystemException, 
641             com.liferay.portal.PortalException {
642         try {
643             Object paramObj0 = new LongWrapper(roleId);
644             Object paramObj1 = new LongWrapper(userId);
645             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
646                     "hasRoleUser", new Object[] { paramObj0, paramObj1 });
647             Object returnObj = null;
648 
649             try {
650                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
651             }
652             catch (Exception e) {
653                 if (e instanceof com.liferay.portal.SystemException) {
654                     throw (com.liferay.portal.SystemException)e;
655                 }
656 
657                 if (e instanceof com.liferay.portal.PortalException) {
658                     throw (com.liferay.portal.PortalException)e;
659                 }
660 
661                 throw new com.liferay.portal.SystemException(e);
662             }
663 
664             return ((Boolean)returnObj).booleanValue();
665         }
666         catch (com.liferay.portal.SystemException se) {
667             _log.error(se, se);
668             throw se;
669         }
670     }
671 
672     public static void setGroupUsers(HttpPrincipal httpPrincipal, long groupId,
673         long[] userIds)
674         throws com.liferay.portal.SystemException, 
675             com.liferay.portal.PortalException {
676         try {
677             Object paramObj0 = new LongWrapper(groupId);
678             Object paramObj1 = userIds;
679 
680             if (userIds == null) {
681                 paramObj1 = new NullWrapper("[J");
682             }
683 
684             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
685                     "setGroupUsers", new Object[] { paramObj0, paramObj1 });
686 
687             try {
688                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
689             }
690             catch (Exception e) {
691                 if (e instanceof com.liferay.portal.SystemException) {
692                     throw (com.liferay.portal.SystemException)e;
693                 }
694 
695                 if (e instanceof com.liferay.portal.PortalException) {
696                     throw (com.liferay.portal.PortalException)e;
697                 }
698 
699                 throw new com.liferay.portal.SystemException(e);
700             }
701         }
702         catch (com.liferay.portal.SystemException se) {
703             _log.error(se, se);
704             throw se;
705         }
706     }
707 
708     public static void setRoleUsers(HttpPrincipal httpPrincipal, long roleId,
709         long[] userIds)
710         throws com.liferay.portal.SystemException, 
711             com.liferay.portal.PortalException {
712         try {
713             Object paramObj0 = new LongWrapper(roleId);
714             Object paramObj1 = userIds;
715 
716             if (userIds == null) {
717                 paramObj1 = new NullWrapper("[J");
718             }
719 
720             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
721                     "setRoleUsers", new Object[] { paramObj0, paramObj1 });
722 
723             try {
724                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
725             }
726             catch (Exception e) {
727                 if (e instanceof com.liferay.portal.SystemException) {
728                     throw (com.liferay.portal.SystemException)e;
729                 }
730 
731                 if (e instanceof com.liferay.portal.PortalException) {
732                     throw (com.liferay.portal.PortalException)e;
733                 }
734 
735                 throw new com.liferay.portal.SystemException(e);
736             }
737         }
738         catch (com.liferay.portal.SystemException se) {
739             _log.error(se, se);
740             throw se;
741         }
742     }
743 
744     public static void setUserGroupUsers(HttpPrincipal httpPrincipal,
745         long userGroupId, long[] userIds)
746         throws com.liferay.portal.SystemException, 
747             com.liferay.portal.PortalException {
748         try {
749             Object paramObj0 = new LongWrapper(userGroupId);
750             Object paramObj1 = userIds;
751 
752             if (userIds == null) {
753                 paramObj1 = new NullWrapper("[J");
754             }
755 
756             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
757                     "setUserGroupUsers", new Object[] { paramObj0, paramObj1 });
758 
759             try {
760                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
761             }
762             catch (Exception e) {
763                 if (e instanceof com.liferay.portal.SystemException) {
764                     throw (com.liferay.portal.SystemException)e;
765                 }
766 
767                 if (e instanceof com.liferay.portal.PortalException) {
768                     throw (com.liferay.portal.PortalException)e;
769                 }
770 
771                 throw new com.liferay.portal.SystemException(e);
772             }
773         }
774         catch (com.liferay.portal.SystemException se) {
775             _log.error(se, se);
776             throw se;
777         }
778     }
779 
780     public static void unsetGroupUsers(HttpPrincipal httpPrincipal,
781         long groupId, long[] userIds)
782         throws com.liferay.portal.SystemException, 
783             com.liferay.portal.PortalException {
784         try {
785             Object paramObj0 = new LongWrapper(groupId);
786             Object paramObj1 = userIds;
787 
788             if (userIds == null) {
789                 paramObj1 = new NullWrapper("[J");
790             }
791 
792             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
793                     "unsetGroupUsers", new Object[] { paramObj0, paramObj1 });
794 
795             try {
796                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
797             }
798             catch (Exception e) {
799                 if (e instanceof com.liferay.portal.SystemException) {
800                     throw (com.liferay.portal.SystemException)e;
801                 }
802 
803                 if (e instanceof com.liferay.portal.PortalException) {
804                     throw (com.liferay.portal.PortalException)e;
805                 }
806 
807                 throw new com.liferay.portal.SystemException(e);
808             }
809         }
810         catch (com.liferay.portal.SystemException se) {
811             _log.error(se, se);
812             throw se;
813         }
814     }
815 
816     public static void unsetPasswordPolicyUsers(HttpPrincipal httpPrincipal,
817         long passwordPolicyId, long[] userIds)
818         throws com.liferay.portal.SystemException, 
819             com.liferay.portal.PortalException {
820         try {
821             Object paramObj0 = new LongWrapper(passwordPolicyId);
822             Object paramObj1 = userIds;
823 
824             if (userIds == null) {
825                 paramObj1 = new NullWrapper("[J");
826             }
827 
828             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
829                     "unsetPasswordPolicyUsers",
830                     new Object[] { paramObj0, paramObj1 });
831 
832             try {
833                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
834             }
835             catch (Exception e) {
836                 if (e instanceof com.liferay.portal.SystemException) {
837                     throw (com.liferay.portal.SystemException)e;
838                 }
839 
840                 if (e instanceof com.liferay.portal.PortalException) {
841                     throw (com.liferay.portal.PortalException)e;
842                 }
843 
844                 throw new com.liferay.portal.SystemException(e);
845             }
846         }
847         catch (com.liferay.portal.SystemException se) {
848             _log.error(se, se);
849             throw se;
850         }
851     }
852 
853     public static void unsetRoleUsers(HttpPrincipal httpPrincipal, long roleId,
854         long[] userIds)
855         throws com.liferay.portal.SystemException, 
856             com.liferay.portal.PortalException {
857         try {
858             Object paramObj0 = new LongWrapper(roleId);
859             Object paramObj1 = userIds;
860 
861             if (userIds == null) {
862                 paramObj1 = new NullWrapper("[J");
863             }
864 
865             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
866                     "unsetRoleUsers", new Object[] { paramObj0, paramObj1 });
867 
868             try {
869                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
870             }
871             catch (Exception e) {
872                 if (e instanceof com.liferay.portal.SystemException) {
873                     throw (com.liferay.portal.SystemException)e;
874                 }
875 
876                 if (e instanceof com.liferay.portal.PortalException) {
877                     throw (com.liferay.portal.PortalException)e;
878                 }
879 
880                 throw new com.liferay.portal.SystemException(e);
881             }
882         }
883         catch (com.liferay.portal.SystemException se) {
884             _log.error(se, se);
885             throw se;
886         }
887     }
888 
889     public static void unsetUserGroupUsers(HttpPrincipal httpPrincipal,
890         long userGroupId, long[] userIds)
891         throws com.liferay.portal.SystemException, 
892             com.liferay.portal.PortalException {
893         try {
894             Object paramObj0 = new LongWrapper(userGroupId);
895             Object paramObj1 = userIds;
896 
897             if (userIds == null) {
898                 paramObj1 = new NullWrapper("[J");
899             }
900 
901             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
902                     "unsetUserGroupUsers", new Object[] { paramObj0, paramObj1 });
903 
904             try {
905                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
906             }
907             catch (Exception e) {
908                 if (e instanceof com.liferay.portal.SystemException) {
909                     throw (com.liferay.portal.SystemException)e;
910                 }
911 
912                 if (e instanceof com.liferay.portal.PortalException) {
913                     throw (com.liferay.portal.PortalException)e;
914                 }
915 
916                 throw new com.liferay.portal.SystemException(e);
917             }
918         }
919         catch (com.liferay.portal.SystemException se) {
920             _log.error(se, se);
921             throw se;
922         }
923     }
924 
925     public static com.liferay.portal.model.User updateActive(
926         HttpPrincipal httpPrincipal, long userId, boolean active)
927         throws com.liferay.portal.SystemException, 
928             com.liferay.portal.PortalException {
929         try {
930             Object paramObj0 = new LongWrapper(userId);
931             Object paramObj1 = new BooleanWrapper(active);
932             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
933                     "updateActive", new Object[] { paramObj0, paramObj1 });
934             Object returnObj = null;
935 
936             try {
937                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
938             }
939             catch (Exception e) {
940                 if (e instanceof com.liferay.portal.SystemException) {
941                     throw (com.liferay.portal.SystemException)e;
942                 }
943 
944                 if (e instanceof com.liferay.portal.PortalException) {
945                     throw (com.liferay.portal.PortalException)e;
946                 }
947 
948                 throw new com.liferay.portal.SystemException(e);
949             }
950 
951             return (com.liferay.portal.model.User)returnObj;
952         }
953         catch (com.liferay.portal.SystemException se) {
954             _log.error(se, se);
955             throw se;
956         }
957     }
958 
959     public static com.liferay.portal.model.User updateAgreedToTermsOfUse(
960         HttpPrincipal httpPrincipal, long userId, boolean agreedToTermsOfUse)
961         throws com.liferay.portal.SystemException, 
962             com.liferay.portal.PortalException {
963         try {
964             Object paramObj0 = new LongWrapper(userId);
965             Object paramObj1 = new BooleanWrapper(agreedToTermsOfUse);
966             MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
967                     "updateAgreedToTermsOfUse",
968                     new Object[] { paramObj0, paramObj1 });
969             Object returnObj = null;
970 
971             try {
972                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
973             }
974             catch (Exception e) {
975                 if (e instanceof com.liferay.portal.SystemException) {
976                     throw (com.liferay.portal.SystemException)e;
977                 }
978 
979                 if (e instanceof com.liferay.portal.PortalException) {
980                     throw (com.liferay.portal.PortalException)e;
981                 }
982 
983                 throw new com.liferay.portal.SystemException(e);
984             }
985 
986             return (com.liferay.portal.model.User)returnObj;
987         }
988         catch (com.liferay.portal.SystemException se) {
989             _log.error(se, se);
990             throw se;
991         }
992     }
993 
994     public static com.liferay.portal.model.User updateLockout(
995         HttpPrincipal httpPrincipal, long userId, boolean lockout)
996         throws com.liferay.portal.SystemException, 
997             com.liferay.portal.PortalException {
998         try {
999             Object paramObj0 = new LongWrapper(userId);
1000            Object paramObj1 = new BooleanWrapper(lockout);
1001            MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
1002                    "updateLockout", new Object[] { paramObj0, paramObj1 });
1003            Object returnObj = null;
1004
1005            try {
1006                returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
1007            }
1008            catch (Exception e) {
1009                if (e instanceof com.liferay.portal.SystemException) {
1010                    throw (com.liferay.portal.SystemException)e;
1011                }
1012
1013                if (e instanceof com.liferay.portal.PortalException) {
1014                    throw (com.liferay.portal.PortalException)e;
1015                }
1016
1017                throw new com.liferay.portal.SystemException(e);
1018            }
1019
1020            return (com.liferay.portal.model.User)returnObj;
1021        }
1022        catch (com.liferay.portal.SystemException se) {
1023            _log.error(se, se);
1024            throw se;
1025        }
1026    }
1027
1028    public static void updateOrganizations(HttpPrincipal httpPrincipal,
1029        long userId, long organizationId, long locationId)
1030        throws com.liferay.portal.SystemException, 
1031            com.liferay.portal.PortalException {
1032        try {
1033            Object paramObj0 = new LongWrapper(userId);
1034            Object paramObj1 = new LongWrapper(organizationId);
1035            Object paramObj2 = new LongWrapper(locationId);
1036            MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
1037                    "updateOrganizations",
1038                    new Object[] { paramObj0, paramObj1, paramObj2 });
1039
1040            try {
1041                TunnelUtil.invoke(httpPrincipal, methodWrapper);
1042            }
1043            catch (Exception e) {
1044                if (e instanceof com.liferay.portal.SystemException) {
1045                    throw (com.liferay.portal.SystemException)e;
1046                }
1047
1048                if (e instanceof com.liferay.portal.PortalException) {
1049                    throw (com.liferay.portal.PortalException)e;
1050                }
1051
1052                throw new com.liferay.portal.SystemException(e);
1053            }
1054        }
1055        catch (com.liferay.portal.SystemException se) {
1056            _log.error(se, se);
1057            throw se;
1058        }
1059    }
1060
1061    public static com.liferay.portal.model.User updatePassword(
1062        HttpPrincipal httpPrincipal, long userId, java.lang.String password1,
1063        java.lang.String password2, boolean passwordReset)
1064        throws com.liferay.portal.SystemException, 
1065            com.liferay.portal.PortalException {
1066        try {
1067            Object paramObj0 = new LongWrapper(userId);
1068            Object paramObj1 = password1;
1069
1070            if (password1 == null) {
1071                paramObj1 = new NullWrapper("java.lang.String");
1072            }
1073
1074            Object paramObj2 = password2;
1075
1076            if (password2 == null) {
1077                paramObj2 = new NullWrapper("java.lang.String");
1078            }
1079
1080            Object paramObj3 = new BooleanWrapper(passwordReset);
1081            MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
1082                    "updatePassword",
1083                    new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
1084            Object returnObj = null;
1085
1086            try {
1087                returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
1088            }
1089            catch (Exception e) {
1090                if (e instanceof com.liferay.portal.SystemException) {
1091                    throw (com.liferay.portal.SystemException)e;
1092                }
1093
1094                if (e instanceof com.liferay.portal.PortalException) {
1095                    throw (com.liferay.portal.PortalException)e;
1096                }
1097
1098                throw new com.liferay.portal.SystemException(e);
1099            }
1100
1101            return (com.liferay.portal.model.User)returnObj;
1102        }
1103        catch (com.liferay.portal.SystemException se) {
1104            _log.error(se, se);
1105            throw se;
1106        }
1107    }
1108
1109    public static void updatePortrait(HttpPrincipal httpPrincipal, long userId,
1110        byte[] bytes)
1111        throws com.liferay.portal.SystemException, 
1112            com.liferay.portal.PortalException {
1113        try {
1114            Object paramObj0 = new LongWrapper(userId);
1115            Object paramObj1 = bytes;
1116
1117            if (bytes == null) {
1118                paramObj1 = new NullWrapper("[B");
1119            }
1120
1121            MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
1122                    "updatePortrait", new Object[] { paramObj0, paramObj1 });
1123
1124            try {
1125                TunnelUtil.invoke(httpPrincipal, methodWrapper);
1126            }
1127            catch (Exception e) {
1128                if (e instanceof com.liferay.portal.SystemException) {
1129                    throw (com.liferay.portal.SystemException)e;
1130                }
1131
1132                if (e instanceof com.liferay.portal.PortalException) {
1133                    throw (com.liferay.portal.PortalException)e;
1134                }
1135
1136                throw new com.liferay.portal.SystemException(e);
1137            }
1138        }
1139        catch (com.liferay.portal.SystemException se) {
1140            _log.error(se, se);
1141            throw se;
1142        }
1143    }
1144
1145    public static com.liferay.portal.model.User updateUser(
1146        HttpPrincipal httpPrincipal, long userId, java.lang.String password,
1147        java.lang.String screenName, java.lang.String emailAddress,
1148        java.lang.String languageId, java.lang.String timeZoneId,
1149        java.lang.String greeting, java.lang.String comments,
1150        java.lang.String firstName, java.lang.String middleName,
1151        java.lang.String lastName, int prefixId, int suffixId, boolean male,
1152        int birthdayMonth, int birthdayDay, int birthdayYear,
1153        java.lang.String smsSn, java.lang.String aimSn, java.lang.String icqSn,
1154        java.lang.String jabberSn, java.lang.String msnSn,
1155        java.lang.String skypeSn, java.lang.String ymSn,
1156        java.lang.String jobTitle, long organizationId, long locationId)
1157        throws com.liferay.portal.SystemException, 
1158            com.liferay.portal.PortalException {
1159        try {
1160            Object paramObj0 = new LongWrapper(userId);
1161            Object paramObj1 = password;
1162
1163            if (password == null) {
1164                paramObj1 = new NullWrapper("java.lang.String");
1165            }
1166
1167            Object paramObj2 = screenName;
1168
1169            if (screenName == null) {
1170                paramObj2 = new NullWrapper("java.lang.String");
1171            }
1172
1173            Object paramObj3 = emailAddress;
1174
1175            if (emailAddress == null) {
1176                paramObj3 = new NullWrapper("java.lang.String");
1177            }
1178
1179            Object paramObj4 = languageId;
1180
1181            if (languageId == null) {
1182                paramObj4 = new NullWrapper("java.lang.String");
1183            }
1184
1185            Object paramObj5 = timeZoneId;
1186
1187            if (timeZoneId == null) {
1188                paramObj5 = new NullWrapper("java.lang.String");
1189            }
1190
1191            Object paramObj6 = greeting;
1192
1193            if (greeting == null) {
1194                paramObj6 = new NullWrapper("java.lang.String");
1195            }
1196
1197            Object paramObj7 = comments;
1198
1199            if (comments == null) {
1200                paramObj7 = new NullWrapper("java.lang.String");
1201            }
1202
1203            Object paramObj8 = firstName;
1204
1205            if (firstName == null) {
1206                paramObj8 = new NullWrapper("java.lang.String");
1207            }
1208
1209            Object paramObj9 = middleName;
1210
1211            if (middleName == null) {
1212                paramObj9 = new NullWrapper("java.lang.String");
1213            }
1214
1215            Object paramObj10 = lastName;
1216
1217            if (lastName == null) {
1218                paramObj10 = new NullWrapper("java.lang.String");
1219            }
1220
1221            Object paramObj11 = new IntegerWrapper(prefixId);
1222            Object paramObj12 = new IntegerWrapper(suffixId);
1223            Object paramObj13 = new BooleanWrapper(male);
1224            Object paramObj14 = new IntegerWrapper(birthdayMonth);
1225            Object paramObj15 = new IntegerWrapper(birthdayDay);
1226            Object paramObj16 = new IntegerWrapper(birthdayYear);
1227            Object paramObj17 = smsSn;
1228
1229            if (smsSn == null) {
1230                paramObj17 = new NullWrapper("java.lang.String");
1231            }
1232
1233            Object paramObj18 = aimSn;
1234
1235            if (aimSn == null) {
1236                paramObj18 = new NullWrapper("java.lang.String");
1237            }
1238
1239            Object paramObj19 = icqSn;
1240
1241            if (icqSn == null) {
1242                paramObj19 = new NullWrapper("java.lang.String");
1243            }
1244
1245            Object paramObj20 = jabberSn;
1246
1247            if (jabberSn == null) {
1248                paramObj20 = new NullWrapper("java.lang.String");
1249            }
1250
1251            Object paramObj21 = msnSn;
1252
1253            if (msnSn == null) {
1254                paramObj21 = new NullWrapper("java.lang.String");
1255            }
1256
1257            Object paramObj22 = skypeSn;
1258
1259            if (skypeSn == null) {
1260                paramObj22 = new NullWrapper("java.lang.String");
1261            }
1262
1263            Object paramObj23 = ymSn;
1264
1265            if (ymSn == null) {
1266                paramObj23 = new NullWrapper("java.lang.String");
1267            }
1268
1269            Object paramObj24 = jobTitle;
1270
1271            if (jobTitle == null) {
1272                paramObj24 = new NullWrapper("java.lang.String");
1273            }
1274
1275            Object paramObj25 = new LongWrapper(organizationId);
1276            Object paramObj26 = new LongWrapper(locationId);
1277            MethodWrapper methodWrapper = new MethodWrapper(UserServiceUtil.class.getName(),
1278                    "updateUser",
1279                    new Object[] {
1280                        paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
1281                        paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
1282                        paramObj10, paramObj11, paramObj12, paramObj13,
1283                        paramObj14, paramObj15, paramObj16, paramObj17,
1284                        paramObj18, paramObj19, paramObj20, paramObj21,
1285                        paramObj22, paramObj23, paramObj24, paramObj25,
1286                        paramObj26
1287                    });
1288            Object returnObj = null;
1289
1290            try {
1291                returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
1292            }
1293            catch (Exception e) {
1294                if (e instanceof com.liferay.portal.SystemException) {
1295                    throw (com.liferay.portal.SystemException)e;
1296                }
1297
1298                if (e instanceof com.liferay.portal.PortalException) {
1299                    throw (com.liferay.portal.PortalException)e;
1300                }
1301
1302                throw new com.liferay.portal.SystemException(e);
1303            }
1304
1305            return (com.liferay.portal.model.User)returnObj;
1306        }
1307        catch (com.liferay.portal.SystemException se) {
1308            _log.error(se, se);
1309            throw se;
1310        }
1311    }
1312
1313    private static Log _log = LogFactoryUtil.getLog(UserServiceHttp.class);
1314}