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