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