001
014
015 package com.liferay.portal.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.MethodHandler;
020 import com.liferay.portal.kernel.util.MethodKey;
021 import com.liferay.portal.security.auth.HttpPrincipal;
022 import com.liferay.portal.service.RoleServiceUtil;
023
024
054 public class RoleServiceHttp {
055 public static com.liferay.portal.model.Role addRole(
056 HttpPrincipal httpPrincipal, java.lang.String name,
057 java.util.Map<java.util.Locale, java.lang.String> titleMap,
058 java.lang.String description, int type)
059 throws com.liferay.portal.kernel.exception.PortalException,
060 com.liferay.portal.kernel.exception.SystemException {
061 try {
062 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
063 "addRole", _addRoleParameterTypes0);
064
065 MethodHandler methodHandler = new MethodHandler(methodKey, name,
066 titleMap, description, type);
067
068 Object returnObj = null;
069
070 try {
071 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072 }
073 catch (Exception e) {
074 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075 throw (com.liferay.portal.kernel.exception.PortalException)e;
076 }
077
078 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
079 throw (com.liferay.portal.kernel.exception.SystemException)e;
080 }
081
082 throw new com.liferay.portal.kernel.exception.SystemException(e);
083 }
084
085 return (com.liferay.portal.model.Role)returnObj;
086 }
087 catch (com.liferay.portal.kernel.exception.SystemException se) {
088 _log.error(se, se);
089
090 throw se;
091 }
092 }
093
094 public static void addUserRoles(HttpPrincipal httpPrincipal, long userId,
095 long[] roleIds)
096 throws com.liferay.portal.kernel.exception.PortalException,
097 com.liferay.portal.kernel.exception.SystemException {
098 try {
099 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
100 "addUserRoles", _addUserRolesParameterTypes1);
101
102 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
103 roleIds);
104
105 try {
106 TunnelUtil.invoke(httpPrincipal, methodHandler);
107 }
108 catch (Exception e) {
109 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110 throw (com.liferay.portal.kernel.exception.PortalException)e;
111 }
112
113 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114 throw (com.liferay.portal.kernel.exception.SystemException)e;
115 }
116
117 throw new com.liferay.portal.kernel.exception.SystemException(e);
118 }
119 }
120 catch (com.liferay.portal.kernel.exception.SystemException se) {
121 _log.error(se, se);
122
123 throw se;
124 }
125 }
126
127 public static void deleteRole(HttpPrincipal httpPrincipal, long roleId)
128 throws com.liferay.portal.kernel.exception.PortalException,
129 com.liferay.portal.kernel.exception.SystemException {
130 try {
131 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
132 "deleteRole", _deleteRoleParameterTypes2);
133
134 MethodHandler methodHandler = new MethodHandler(methodKey, roleId);
135
136 try {
137 TunnelUtil.invoke(httpPrincipal, methodHandler);
138 }
139 catch (Exception e) {
140 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141 throw (com.liferay.portal.kernel.exception.PortalException)e;
142 }
143
144 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145 throw (com.liferay.portal.kernel.exception.SystemException)e;
146 }
147
148 throw new com.liferay.portal.kernel.exception.SystemException(e);
149 }
150 }
151 catch (com.liferay.portal.kernel.exception.SystemException se) {
152 _log.error(se, se);
153
154 throw se;
155 }
156 }
157
158 public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
159 HttpPrincipal httpPrincipal, long groupId)
160 throws com.liferay.portal.kernel.exception.SystemException {
161 try {
162 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
163 "getGroupRoles", _getGroupRolesParameterTypes3);
164
165 MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
166
167 Object returnObj = null;
168
169 try {
170 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
171 }
172 catch (Exception e) {
173 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
174 throw (com.liferay.portal.kernel.exception.SystemException)e;
175 }
176
177 throw new com.liferay.portal.kernel.exception.SystemException(e);
178 }
179
180 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
181 }
182 catch (com.liferay.portal.kernel.exception.SystemException se) {
183 _log.error(se, se);
184
185 throw se;
186 }
187 }
188
189 public static com.liferay.portal.model.Role getRole(
190 HttpPrincipal httpPrincipal, long roleId)
191 throws com.liferay.portal.kernel.exception.PortalException,
192 com.liferay.portal.kernel.exception.SystemException {
193 try {
194 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
195 "getRole", _getRoleParameterTypes4);
196
197 MethodHandler methodHandler = new MethodHandler(methodKey, roleId);
198
199 Object returnObj = null;
200
201 try {
202 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
203 }
204 catch (Exception e) {
205 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
206 throw (com.liferay.portal.kernel.exception.PortalException)e;
207 }
208
209 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
210 throw (com.liferay.portal.kernel.exception.SystemException)e;
211 }
212
213 throw new com.liferay.portal.kernel.exception.SystemException(e);
214 }
215
216 return (com.liferay.portal.model.Role)returnObj;
217 }
218 catch (com.liferay.portal.kernel.exception.SystemException se) {
219 _log.error(se, se);
220
221 throw se;
222 }
223 }
224
225 public static com.liferay.portal.model.Role getRole(
226 HttpPrincipal httpPrincipal, long companyId, java.lang.String name)
227 throws com.liferay.portal.kernel.exception.PortalException,
228 com.liferay.portal.kernel.exception.SystemException {
229 try {
230 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
231 "getRole", _getRoleParameterTypes5);
232
233 MethodHandler methodHandler = new MethodHandler(methodKey,
234 companyId, name);
235
236 Object returnObj = null;
237
238 try {
239 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
240 }
241 catch (Exception e) {
242 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
243 throw (com.liferay.portal.kernel.exception.PortalException)e;
244 }
245
246 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
247 throw (com.liferay.portal.kernel.exception.SystemException)e;
248 }
249
250 throw new com.liferay.portal.kernel.exception.SystemException(e);
251 }
252
253 return (com.liferay.portal.model.Role)returnObj;
254 }
255 catch (com.liferay.portal.kernel.exception.SystemException se) {
256 _log.error(se, se);
257
258 throw se;
259 }
260 }
261
262 public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
263 HttpPrincipal httpPrincipal, long userId, long groupId)
264 throws com.liferay.portal.kernel.exception.SystemException {
265 try {
266 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
267 "getUserGroupGroupRoles",
268 _getUserGroupGroupRolesParameterTypes6);
269
270 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
271 groupId);
272
273 Object returnObj = null;
274
275 try {
276 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
277 }
278 catch (Exception e) {
279 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
280 throw (com.liferay.portal.kernel.exception.SystemException)e;
281 }
282
283 throw new com.liferay.portal.kernel.exception.SystemException(e);
284 }
285
286 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
287 }
288 catch (com.liferay.portal.kernel.exception.SystemException se) {
289 _log.error(se, se);
290
291 throw se;
292 }
293 }
294
295 public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
296 HttpPrincipal httpPrincipal, long userId, long groupId)
297 throws com.liferay.portal.kernel.exception.SystemException {
298 try {
299 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
300 "getUserGroupRoles", _getUserGroupRolesParameterTypes7);
301
302 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
303 groupId);
304
305 Object returnObj = null;
306
307 try {
308 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
309 }
310 catch (Exception e) {
311 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
312 throw (com.liferay.portal.kernel.exception.SystemException)e;
313 }
314
315 throw new com.liferay.portal.kernel.exception.SystemException(e);
316 }
317
318 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
319 }
320 catch (com.liferay.portal.kernel.exception.SystemException se) {
321 _log.error(se, se);
322
323 throw se;
324 }
325 }
326
327 public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
328 HttpPrincipal httpPrincipal, long userId,
329 java.util.List<com.liferay.portal.model.Group> groups)
330 throws com.liferay.portal.kernel.exception.SystemException {
331 try {
332 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
333 "getUserRelatedRoles", _getUserRelatedRolesParameterTypes8);
334
335 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
336 groups);
337
338 Object returnObj = null;
339
340 try {
341 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
342 }
343 catch (Exception e) {
344 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
345 throw (com.liferay.portal.kernel.exception.SystemException)e;
346 }
347
348 throw new com.liferay.portal.kernel.exception.SystemException(e);
349 }
350
351 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
352 }
353 catch (com.liferay.portal.kernel.exception.SystemException se) {
354 _log.error(se, se);
355
356 throw se;
357 }
358 }
359
360 public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
361 HttpPrincipal httpPrincipal, long userId)
362 throws com.liferay.portal.kernel.exception.SystemException {
363 try {
364 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
365 "getUserRoles", _getUserRolesParameterTypes9);
366
367 MethodHandler methodHandler = new MethodHandler(methodKey, userId);
368
369 Object returnObj = null;
370
371 try {
372 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
373 }
374 catch (Exception e) {
375 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
376 throw (com.liferay.portal.kernel.exception.SystemException)e;
377 }
378
379 throw new com.liferay.portal.kernel.exception.SystemException(e);
380 }
381
382 return (java.util.List<com.liferay.portal.model.Role>)returnObj;
383 }
384 catch (com.liferay.portal.kernel.exception.SystemException se) {
385 _log.error(se, se);
386
387 throw se;
388 }
389 }
390
391 public static boolean hasUserRole(HttpPrincipal httpPrincipal, long userId,
392 long companyId, java.lang.String name, boolean inherited)
393 throws com.liferay.portal.kernel.exception.PortalException,
394 com.liferay.portal.kernel.exception.SystemException {
395 try {
396 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
397 "hasUserRole", _hasUserRoleParameterTypes10);
398
399 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
400 companyId, name, inherited);
401
402 Object returnObj = null;
403
404 try {
405 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
406 }
407 catch (Exception e) {
408 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
409 throw (com.liferay.portal.kernel.exception.PortalException)e;
410 }
411
412 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
413 throw (com.liferay.portal.kernel.exception.SystemException)e;
414 }
415
416 throw new com.liferay.portal.kernel.exception.SystemException(e);
417 }
418
419 return ((Boolean)returnObj).booleanValue();
420 }
421 catch (com.liferay.portal.kernel.exception.SystemException se) {
422 _log.error(se, se);
423
424 throw se;
425 }
426 }
427
428 public static boolean hasUserRoles(HttpPrincipal httpPrincipal,
429 long userId, long companyId, java.lang.String[] names, boolean inherited)
430 throws com.liferay.portal.kernel.exception.PortalException,
431 com.liferay.portal.kernel.exception.SystemException {
432 try {
433 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
434 "hasUserRoles", _hasUserRolesParameterTypes11);
435
436 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
437 companyId, names, inherited);
438
439 Object returnObj = null;
440
441 try {
442 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
443 }
444 catch (Exception e) {
445 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
446 throw (com.liferay.portal.kernel.exception.PortalException)e;
447 }
448
449 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
450 throw (com.liferay.portal.kernel.exception.SystemException)e;
451 }
452
453 throw new com.liferay.portal.kernel.exception.SystemException(e);
454 }
455
456 return ((Boolean)returnObj).booleanValue();
457 }
458 catch (com.liferay.portal.kernel.exception.SystemException se) {
459 _log.error(se, se);
460
461 throw se;
462 }
463 }
464
465 public static void unsetUserRoles(HttpPrincipal httpPrincipal, long userId,
466 long[] roleIds)
467 throws com.liferay.portal.kernel.exception.PortalException,
468 com.liferay.portal.kernel.exception.SystemException {
469 try {
470 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
471 "unsetUserRoles", _unsetUserRolesParameterTypes12);
472
473 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
474 roleIds);
475
476 try {
477 TunnelUtil.invoke(httpPrincipal, methodHandler);
478 }
479 catch (Exception e) {
480 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
481 throw (com.liferay.portal.kernel.exception.PortalException)e;
482 }
483
484 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
485 throw (com.liferay.portal.kernel.exception.SystemException)e;
486 }
487
488 throw new com.liferay.portal.kernel.exception.SystemException(e);
489 }
490 }
491 catch (com.liferay.portal.kernel.exception.SystemException se) {
492 _log.error(se, se);
493
494 throw se;
495 }
496 }
497
498 public static com.liferay.portal.model.Role updateRole(
499 HttpPrincipal httpPrincipal, long roleId, java.lang.String name,
500 java.util.Map<java.util.Locale, java.lang.String> titleMap,
501 java.lang.String description, java.lang.String subtype)
502 throws com.liferay.portal.kernel.exception.PortalException,
503 com.liferay.portal.kernel.exception.SystemException {
504 try {
505 MethodKey methodKey = new MethodKey(RoleServiceUtil.class.getName(),
506 "updateRole", _updateRoleParameterTypes13);
507
508 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
509 name, titleMap, description, subtype);
510
511 Object returnObj = null;
512
513 try {
514 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
515 }
516 catch (Exception e) {
517 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
518 throw (com.liferay.portal.kernel.exception.PortalException)e;
519 }
520
521 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
522 throw (com.liferay.portal.kernel.exception.SystemException)e;
523 }
524
525 throw new com.liferay.portal.kernel.exception.SystemException(e);
526 }
527
528 return (com.liferay.portal.model.Role)returnObj;
529 }
530 catch (com.liferay.portal.kernel.exception.SystemException se) {
531 _log.error(se, se);
532
533 throw se;
534 }
535 }
536
537 private static Log _log = LogFactoryUtil.getLog(RoleServiceHttp.class);
538 private static final Class<?>[] _addRoleParameterTypes0 = new Class[] {
539 java.lang.String.class, java.util.Map.class, java.lang.String.class,
540 int.class
541 };
542 private static final Class<?>[] _addUserRolesParameterTypes1 = new Class[] {
543 long.class, long[].class
544 };
545 private static final Class<?>[] _deleteRoleParameterTypes2 = new Class[] {
546 long.class
547 };
548 private static final Class<?>[] _getGroupRolesParameterTypes3 = new Class[] {
549 long.class
550 };
551 private static final Class<?>[] _getRoleParameterTypes4 = new Class[] {
552 long.class
553 };
554 private static final Class<?>[] _getRoleParameterTypes5 = new Class[] {
555 long.class, java.lang.String.class
556 };
557 private static final Class<?>[] _getUserGroupGroupRolesParameterTypes6 = new Class[] {
558 long.class, long.class
559 };
560 private static final Class<?>[] _getUserGroupRolesParameterTypes7 = new Class[] {
561 long.class, long.class
562 };
563 private static final Class<?>[] _getUserRelatedRolesParameterTypes8 = new Class[] {
564 long.class, java.util.List.class
565 };
566 private static final Class<?>[] _getUserRolesParameterTypes9 = new Class[] {
567 long.class
568 };
569 private static final Class<?>[] _hasUserRoleParameterTypes10 = new Class[] {
570 long.class, long.class, java.lang.String.class, boolean.class
571 };
572 private static final Class<?>[] _hasUserRolesParameterTypes11 = new Class[] {
573 long.class, long.class, java.lang.String[].class, boolean.class
574 };
575 private static final Class<?>[] _unsetUserRolesParameterTypes12 = new Class[] {
576 long.class, long[].class
577 };
578 private static final Class<?>[] _updateRoleParameterTypes13 = new Class[] {
579 long.class, java.lang.String.class, java.util.Map.class,
580 java.lang.String.class, java.lang.String.class
581 };
582 }