1
14
15 package com.liferay.portal.service.http;
16
17 import com.liferay.portal.kernel.log.Log;
18 import com.liferay.portal.kernel.log.LogFactoryUtil;
19 import com.liferay.portal.kernel.util.BooleanWrapper;
20 import com.liferay.portal.kernel.util.IntegerWrapper;
21 import com.liferay.portal.kernel.util.LongWrapper;
22 import com.liferay.portal.kernel.util.MethodWrapper;
23 import com.liferay.portal.kernel.util.NullWrapper;
24 import com.liferay.portal.security.auth.HttpPrincipal;
25 import com.liferay.portal.service.RoleServiceUtil;
26
27
64 public class RoleServiceHttp {
65 public static com.liferay.portal.model.Role addRole(
66 HttpPrincipal httpPrincipal, java.lang.String name,
67 java.lang.String description, int type)
68 throws com.liferay.portal.PortalException,
69 com.liferay.portal.SystemException {
70 try {
71 Object paramObj0 = name;
72
73 if (name == null) {
74 paramObj0 = new NullWrapper("java.lang.String");
75 }
76
77 Object paramObj1 = description;
78
79 if (description == null) {
80 paramObj1 = new NullWrapper("java.lang.String");
81 }
82
83 Object paramObj2 = new IntegerWrapper(type);
84
85 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
86 "addRole", new Object[] { paramObj0, paramObj1, paramObj2 });
87
88 Object returnObj = null;
89
90 try {
91 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
92 }
93 catch (Exception e) {
94 if (e instanceof com.liferay.portal.PortalException) {
95 throw (com.liferay.portal.PortalException)e;
96 }
97
98 if (e instanceof com.liferay.portal.SystemException) {
99 throw (com.liferay.portal.SystemException)e;
100 }
101
102 throw new com.liferay.portal.SystemException(e);
103 }
104
105 return (com.liferay.portal.model.Role)returnObj;
106 }
107 catch (com.liferay.portal.SystemException se) {
108 _log.error(se, se);
109
110 throw se;
111 }
112 }
113
114 public static void addUserRoles(HttpPrincipal httpPrincipal, long userId,
115 long[] roleIds)
116 throws com.liferay.portal.PortalException,
117 com.liferay.portal.SystemException {
118 try {
119 Object paramObj0 = new LongWrapper(userId);
120
121 Object paramObj1 = roleIds;
122
123 if (roleIds == null) {
124 paramObj1 = new NullWrapper("[J");
125 }
126
127 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
128 "addUserRoles", new Object[] { paramObj0, paramObj1 });
129
130 try {
131 TunnelUtil.invoke(httpPrincipal, methodWrapper);
132 }
133 catch (Exception e) {
134 if (e instanceof com.liferay.portal.PortalException) {
135 throw (com.liferay.portal.PortalException)e;
136 }
137
138 if (e instanceof com.liferay.portal.SystemException) {
139 throw (com.liferay.portal.SystemException)e;
140 }
141
142 throw new com.liferay.portal.SystemException(e);
143 }
144 }
145 catch (com.liferay.portal.SystemException se) {
146 _log.error(se, se);
147
148 throw se;
149 }
150 }
151
152 public static void deleteRole(HttpPrincipal httpPrincipal, long roleId)
153 throws com.liferay.portal.PortalException,
154 com.liferay.portal.SystemException {
155 try {
156 Object paramObj0 = new LongWrapper(roleId);
157
158 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
159 "deleteRole", new Object[] { paramObj0 });
160
161 try {
162 TunnelUtil.invoke(httpPrincipal, methodWrapper);
163 }
164 catch (Exception e) {
165 if (e instanceof com.liferay.portal.PortalException) {
166 throw (com.liferay.portal.PortalException)e;
167 }
168
169 if (e instanceof com.liferay.portal.SystemException) {
170 throw (com.liferay.portal.SystemException)e;
171 }
172
173 throw new com.liferay.portal.SystemException(e);
174 }
175 }
176 catch (com.liferay.portal.SystemException se) {
177 _log.error(se, se);
178
179 throw se;
180 }
181 }
182
183 public static com.liferay.portal.model.Role getGroupRole(
184 HttpPrincipal httpPrincipal, long companyId, long groupId)
185 throws com.liferay.portal.PortalException,
186 com.liferay.portal.SystemException {
187 try {
188 Object paramObj0 = new LongWrapper(companyId);
189
190 Object paramObj1 = new LongWrapper(groupId);
191
192 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
193 "getGroupRole", new Object[] { paramObj0, paramObj1 });
194
195 Object returnObj = null;
196
197 try {
198 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
199 }
200 catch (Exception e) {
201 if (e instanceof com.liferay.portal.PortalException) {
202 throw (com.liferay.portal.PortalException)e;
203 }
204
205 if (e instanceof com.liferay.portal.SystemException) {
206 throw (com.liferay.portal.SystemException)e;
207 }
208
209 throw new com.liferay.portal.SystemException(e);
210 }
211
212 return (com.liferay.portal.model.Role)returnObj;
213 }
214 catch (com.liferay.portal.SystemException se) {
215 _log.error(se, se);
216
217 throw se;
218 }
219 }
220
221 public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
222 HttpPrincipal httpPrincipal, long groupId)
223 throws com.liferay.portal.SystemException {
224 try {
225 Object paramObj0 = new LongWrapper(groupId);
226
227 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
228 "getGroupRoles", new Object[] { paramObj0 });
229
230 Object returnObj = null;
231
232 try {
233 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
234 }
235 catch (Exception e) {
236 if (e instanceof com.liferay.portal.SystemException) {
237 throw (com.liferay.portal.SystemException)e;
238 }
239
240 throw new com.liferay.portal.SystemException(e);
241 }
242
243 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
244 }
245 catch (com.liferay.portal.SystemException se) {
246 _log.error(se, se);
247
248 throw se;
249 }
250 }
251
252 public static com.liferay.portal.model.Role getRole(
253 HttpPrincipal httpPrincipal, long roleId)
254 throws com.liferay.portal.PortalException,
255 com.liferay.portal.SystemException {
256 try {
257 Object paramObj0 = new LongWrapper(roleId);
258
259 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
260 "getRole", new Object[] { paramObj0 });
261
262 Object returnObj = null;
263
264 try {
265 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
266 }
267 catch (Exception e) {
268 if (e instanceof com.liferay.portal.PortalException) {
269 throw (com.liferay.portal.PortalException)e;
270 }
271
272 if (e instanceof com.liferay.portal.SystemException) {
273 throw (com.liferay.portal.SystemException)e;
274 }
275
276 throw new com.liferay.portal.SystemException(e);
277 }
278
279 return (com.liferay.portal.model.Role)returnObj;
280 }
281 catch (com.liferay.portal.SystemException se) {
282 _log.error(se, se);
283
284 throw se;
285 }
286 }
287
288 public static com.liferay.portal.model.Role getRole(
289 HttpPrincipal httpPrincipal, long companyId, java.lang.String name)
290 throws com.liferay.portal.PortalException,
291 com.liferay.portal.SystemException {
292 try {
293 Object paramObj0 = new LongWrapper(companyId);
294
295 Object paramObj1 = name;
296
297 if (name == null) {
298 paramObj1 = new NullWrapper("java.lang.String");
299 }
300
301 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
302 "getRole", new Object[] { paramObj0, paramObj1 });
303
304 Object returnObj = null;
305
306 try {
307 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
308 }
309 catch (Exception e) {
310 if (e instanceof com.liferay.portal.PortalException) {
311 throw (com.liferay.portal.PortalException)e;
312 }
313
314 if (e instanceof com.liferay.portal.SystemException) {
315 throw (com.liferay.portal.SystemException)e;
316 }
317
318 throw new com.liferay.portal.SystemException(e);
319 }
320
321 return (com.liferay.portal.model.Role)returnObj;
322 }
323 catch (com.liferay.portal.SystemException se) {
324 _log.error(se, se);
325
326 throw se;
327 }
328 }
329
330 public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
331 HttpPrincipal httpPrincipal, long userId, long groupId)
332 throws com.liferay.portal.SystemException {
333 try {
334 Object paramObj0 = new LongWrapper(userId);
335
336 Object paramObj1 = new LongWrapper(groupId);
337
338 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
339 "getUserGroupGroupRoles",
340 new Object[] { paramObj0, paramObj1 });
341
342 Object returnObj = null;
343
344 try {
345 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
346 }
347 catch (Exception e) {
348 if (e instanceof com.liferay.portal.SystemException) {
349 throw (com.liferay.portal.SystemException)e;
350 }
351
352 throw new com.liferay.portal.SystemException(e);
353 }
354
355 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
356 }
357 catch (com.liferay.portal.SystemException se) {
358 _log.error(se, se);
359
360 throw se;
361 }
362 }
363
364 public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
365 HttpPrincipal httpPrincipal, long userId, long groupId)
366 throws com.liferay.portal.SystemException {
367 try {
368 Object paramObj0 = new LongWrapper(userId);
369
370 Object paramObj1 = new LongWrapper(groupId);
371
372 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
373 "getUserGroupRoles", new Object[] { paramObj0, paramObj1 });
374
375 Object returnObj = null;
376
377 try {
378 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
379 }
380 catch (Exception e) {
381 if (e instanceof com.liferay.portal.SystemException) {
382 throw (com.liferay.portal.SystemException)e;
383 }
384
385 throw new com.liferay.portal.SystemException(e);
386 }
387
388 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
389 }
390 catch (com.liferay.portal.SystemException se) {
391 _log.error(se, se);
392
393 throw se;
394 }
395 }
396
397 public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
398 HttpPrincipal httpPrincipal, long userId,
399 java.util.List<com.liferay.portal.model.Group> groups)
400 throws com.liferay.portal.SystemException {
401 try {
402 Object paramObj0 = new LongWrapper(userId);
403
404 Object paramObj1 = groups;
405
406 if (groups == null) {
407 paramObj1 = new NullWrapper("java.util.List");
408 }
409
410 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
411 "getUserRelatedRoles", new Object[] { paramObj0, paramObj1 });
412
413 Object returnObj = null;
414
415 try {
416 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
417 }
418 catch (Exception e) {
419 if (e instanceof com.liferay.portal.SystemException) {
420 throw (com.liferay.portal.SystemException)e;
421 }
422
423 throw new com.liferay.portal.SystemException(e);
424 }
425
426 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
427 }
428 catch (com.liferay.portal.SystemException se) {
429 _log.error(se, se);
430
431 throw se;
432 }
433 }
434
435 public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
436 HttpPrincipal httpPrincipal, long userId)
437 throws com.liferay.portal.SystemException {
438 try {
439 Object paramObj0 = new LongWrapper(userId);
440
441 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
442 "getUserRoles", new Object[] { paramObj0 });
443
444 Object returnObj = null;
445
446 try {
447 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
448 }
449 catch (Exception e) {
450 if (e instanceof com.liferay.portal.SystemException) {
451 throw (com.liferay.portal.SystemException)e;
452 }
453
454 throw new com.liferay.portal.SystemException(e);
455 }
456
457 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
458 }
459 catch (com.liferay.portal.SystemException se) {
460 _log.error(se, se);
461
462 throw se;
463 }
464 }
465
466 public static boolean hasUserRole(HttpPrincipal httpPrincipal, long userId,
467 long companyId, java.lang.String name, boolean inherited)
468 throws com.liferay.portal.PortalException,
469 com.liferay.portal.SystemException {
470 try {
471 Object paramObj0 = new LongWrapper(userId);
472
473 Object paramObj1 = new LongWrapper(companyId);
474
475 Object paramObj2 = name;
476
477 if (name == null) {
478 paramObj2 = new NullWrapper("java.lang.String");
479 }
480
481 Object paramObj3 = new BooleanWrapper(inherited);
482
483 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
484 "hasUserRole",
485 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
486
487 Object returnObj = null;
488
489 try {
490 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
491 }
492 catch (Exception e) {
493 if (e instanceof com.liferay.portal.PortalException) {
494 throw (com.liferay.portal.PortalException)e;
495 }
496
497 if (e instanceof com.liferay.portal.SystemException) {
498 throw (com.liferay.portal.SystemException)e;
499 }
500
501 throw new com.liferay.portal.SystemException(e);
502 }
503
504 return ((Boolean)returnObj).booleanValue();
505 }
506 catch (com.liferay.portal.SystemException se) {
507 _log.error(se, se);
508
509 throw se;
510 }
511 }
512
513 public static boolean hasUserRoles(HttpPrincipal httpPrincipal,
514 long userId, long companyId, java.lang.String[] names, boolean inherited)
515 throws com.liferay.portal.PortalException,
516 com.liferay.portal.SystemException {
517 try {
518 Object paramObj0 = new LongWrapper(userId);
519
520 Object paramObj1 = new LongWrapper(companyId);
521
522 Object paramObj2 = names;
523
524 if (names == null) {
525 paramObj2 = new NullWrapper("[Ljava.lang.String;");
526 }
527
528 Object paramObj3 = new BooleanWrapper(inherited);
529
530 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
531 "hasUserRoles",
532 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
533
534 Object returnObj = null;
535
536 try {
537 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
538 }
539 catch (Exception e) {
540 if (e instanceof com.liferay.portal.PortalException) {
541 throw (com.liferay.portal.PortalException)e;
542 }
543
544 if (e instanceof com.liferay.portal.SystemException) {
545 throw (com.liferay.portal.SystemException)e;
546 }
547
548 throw new com.liferay.portal.SystemException(e);
549 }
550
551 return ((Boolean)returnObj).booleanValue();
552 }
553 catch (com.liferay.portal.SystemException se) {
554 _log.error(se, se);
555
556 throw se;
557 }
558 }
559
560 public static void unsetUserRoles(HttpPrincipal httpPrincipal, long userId,
561 long[] roleIds)
562 throws com.liferay.portal.PortalException,
563 com.liferay.portal.SystemException {
564 try {
565 Object paramObj0 = new LongWrapper(userId);
566
567 Object paramObj1 = roleIds;
568
569 if (roleIds == null) {
570 paramObj1 = new NullWrapper("[J");
571 }
572
573 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
574 "unsetUserRoles", new Object[] { paramObj0, paramObj1 });
575
576 try {
577 TunnelUtil.invoke(httpPrincipal, methodWrapper);
578 }
579 catch (Exception e) {
580 if (e instanceof com.liferay.portal.PortalException) {
581 throw (com.liferay.portal.PortalException)e;
582 }
583
584 if (e instanceof com.liferay.portal.SystemException) {
585 throw (com.liferay.portal.SystemException)e;
586 }
587
588 throw new com.liferay.portal.SystemException(e);
589 }
590 }
591 catch (com.liferay.portal.SystemException se) {
592 _log.error(se, se);
593
594 throw se;
595 }
596 }
597
598 public static com.liferay.portal.model.Role updateRole(
599 HttpPrincipal httpPrincipal, long roleId, java.lang.String name,
600 java.util.Map<java.util.Locale, String> localeTitlesMap,
601 java.lang.String description, java.lang.String subtype)
602 throws com.liferay.portal.PortalException,
603 com.liferay.portal.SystemException {
604 try {
605 Object paramObj0 = new LongWrapper(roleId);
606
607 Object paramObj1 = name;
608
609 if (name == null) {
610 paramObj1 = new NullWrapper("java.lang.String");
611 }
612
613 Object paramObj2 = localeTitlesMap;
614
615 if (localeTitlesMap == null) {
616 paramObj2 = new NullWrapper("java.util.Map");
617 }
618
619 Object paramObj3 = description;
620
621 if (description == null) {
622 paramObj3 = new NullWrapper("java.lang.String");
623 }
624
625 Object paramObj4 = subtype;
626
627 if (subtype == null) {
628 paramObj4 = new NullWrapper("java.lang.String");
629 }
630
631 MethodWrapper methodWrapper = new MethodWrapper(RoleServiceUtil.class.getName(),
632 "updateRole",
633 new Object[] {
634 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
635 });
636
637 Object returnObj = null;
638
639 try {
640 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
641 }
642 catch (Exception e) {
643 if (e instanceof com.liferay.portal.PortalException) {
644 throw (com.liferay.portal.PortalException)e;
645 }
646
647 if (e instanceof com.liferay.portal.SystemException) {
648 throw (com.liferay.portal.SystemException)e;
649 }
650
651 throw new com.liferay.portal.SystemException(e);
652 }
653
654 return (com.liferay.portal.model.Role)returnObj;
655 }
656 catch (com.liferay.portal.SystemException se) {
657 _log.error(se, se);
658
659 throw se;
660 }
661 }
662
663 private static Log _log = LogFactoryUtil.getLog(RoleServiceHttp.class);
664 }