001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.RoleServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link com.liferay.portal.service.RoleServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see RoleServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portal.service.RoleServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class RoleServiceHttp {
056            public static com.liferay.portal.model.Role addRole(
057                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
058                    java.lang.String name,
059                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
060                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
061                    int type, java.lang.String subtype,
062                    com.liferay.portal.service.ServiceContext serviceContext)
063                    throws com.liferay.portal.kernel.exception.PortalException {
064                    try {
065                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
066                                            "addRole", _addRoleParameterTypes0);
067    
068                            MethodHandler methodHandler = new MethodHandler(methodKey,
069                                            className, classPK, name, titleMap, descriptionMap, type,
070                                            subtype, serviceContext);
071    
072                            Object returnObj = null;
073    
074                            try {
075                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
076                            }
077                            catch (Exception e) {
078                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
079                                            throw (com.liferay.portal.kernel.exception.PortalException)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 com.liferay.portal.model.Role addRole(
095                    HttpPrincipal httpPrincipal, java.lang.String name,
096                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
097                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
098                    int type) throws com.liferay.portal.kernel.exception.PortalException {
099                    try {
100                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
101                                            "addRole", _addRoleParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
104                                            titleMap, descriptionMap, type);
105    
106                            Object returnObj = null;
107    
108                            try {
109                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
113                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118    
119                            return (com.liferay.portal.model.Role)returnObj;
120                    }
121                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static void addUserRoles(HttpPrincipal httpPrincipal, long userId,
129                    long[] roleIds)
130                    throws com.liferay.portal.kernel.exception.PortalException {
131                    try {
132                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
133                                            "addUserRoles", _addUserRolesParameterTypes2);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
136                                            roleIds);
137    
138                            try {
139                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
147                            }
148                    }
149                    catch (com.liferay.portal.kernel.exception.SystemException se) {
150                            _log.error(se, se);
151    
152                            throw se;
153                    }
154            }
155    
156            public static void deleteRole(HttpPrincipal httpPrincipal, long roleId)
157                    throws com.liferay.portal.kernel.exception.PortalException {
158                    try {
159                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
160                                            "deleteRole", _deleteRoleParameterTypes3);
161    
162                            MethodHandler methodHandler = new MethodHandler(methodKey, roleId);
163    
164                            try {
165                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
166                            }
167                            catch (Exception e) {
168                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
169                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
170                                    }
171    
172                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
173                            }
174                    }
175                    catch (com.liferay.portal.kernel.exception.SystemException se) {
176                            _log.error(se, se);
177    
178                            throw se;
179                    }
180            }
181    
182            public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
183                    HttpPrincipal httpPrincipal, long groupId)
184                    throws com.liferay.portal.kernel.exception.PortalException {
185                    try {
186                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
187                                            "getGroupRoles", _getGroupRolesParameterTypes4);
188    
189                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
190    
191                            Object returnObj = null;
192    
193                            try {
194                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
195                            }
196                            catch (Exception e) {
197                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
198                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
199                                    }
200    
201                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
202                            }
203    
204                            return (java.util.List<com.liferay.portal.model.Role>)returnObj;
205                    }
206                    catch (com.liferay.portal.kernel.exception.SystemException se) {
207                            _log.error(se, se);
208    
209                            throw se;
210                    }
211            }
212    
213            public static com.liferay.portal.model.Role getRole(
214                    HttpPrincipal httpPrincipal, long roleId)
215                    throws com.liferay.portal.kernel.exception.PortalException {
216                    try {
217                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
218                                            "getRole", _getRoleParameterTypes5);
219    
220                            MethodHandler methodHandler = new MethodHandler(methodKey, roleId);
221    
222                            Object returnObj = null;
223    
224                            try {
225                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
226                            }
227                            catch (Exception e) {
228                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
229                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
230                                    }
231    
232                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
233                            }
234    
235                            return (com.liferay.portal.model.Role)returnObj;
236                    }
237                    catch (com.liferay.portal.kernel.exception.SystemException se) {
238                            _log.error(se, se);
239    
240                            throw se;
241                    }
242            }
243    
244            public static com.liferay.portal.model.Role getRole(
245                    HttpPrincipal httpPrincipal, long companyId, java.lang.String name)
246                    throws com.liferay.portal.kernel.exception.PortalException {
247                    try {
248                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
249                                            "getRole", _getRoleParameterTypes6);
250    
251                            MethodHandler methodHandler = new MethodHandler(methodKey,
252                                            companyId, name);
253    
254                            Object returnObj = null;
255    
256                            try {
257                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
258                            }
259                            catch (Exception e) {
260                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
261                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
262                                    }
263    
264                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
265                            }
266    
267                            return (com.liferay.portal.model.Role)returnObj;
268                    }
269                    catch (com.liferay.portal.kernel.exception.SystemException se) {
270                            _log.error(se, se);
271    
272                            throw se;
273                    }
274            }
275    
276            public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
277                    HttpPrincipal httpPrincipal, long userId, long groupId)
278                    throws com.liferay.portal.kernel.exception.PortalException {
279                    try {
280                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
281                                            "getUserGroupGroupRoles",
282                                            _getUserGroupGroupRolesParameterTypes7);
283    
284                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
285                                            groupId);
286    
287                            Object returnObj = null;
288    
289                            try {
290                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
291                            }
292                            catch (Exception e) {
293                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
294                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
295                                    }
296    
297                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
298                            }
299    
300                            return (java.util.List<com.liferay.portal.model.Role>)returnObj;
301                    }
302                    catch (com.liferay.portal.kernel.exception.SystemException se) {
303                            _log.error(se, se);
304    
305                            throw se;
306                    }
307            }
308    
309            public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
310                    HttpPrincipal httpPrincipal, long userId, long groupId)
311                    throws com.liferay.portal.kernel.exception.PortalException {
312                    try {
313                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
314                                            "getUserGroupRoles", _getUserGroupRolesParameterTypes8);
315    
316                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
317                                            groupId);
318    
319                            Object returnObj = null;
320    
321                            try {
322                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
323                            }
324                            catch (Exception e) {
325                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
326                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
327                                    }
328    
329                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
330                            }
331    
332                            return (java.util.List<com.liferay.portal.model.Role>)returnObj;
333                    }
334                    catch (com.liferay.portal.kernel.exception.SystemException se) {
335                            _log.error(se, se);
336    
337                            throw se;
338                    }
339            }
340    
341            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
342                    HttpPrincipal httpPrincipal, long userId,
343                    java.util.List<com.liferay.portal.model.Group> groups)
344                    throws com.liferay.portal.kernel.exception.PortalException {
345                    try {
346                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
347                                            "getUserRelatedRoles", _getUserRelatedRolesParameterTypes9);
348    
349                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
350                                            groups);
351    
352                            Object returnObj = null;
353    
354                            try {
355                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
356                            }
357                            catch (Exception e) {
358                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
359                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
360                                    }
361    
362                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
363                            }
364    
365                            return (java.util.List<com.liferay.portal.model.Role>)returnObj;
366                    }
367                    catch (com.liferay.portal.kernel.exception.SystemException se) {
368                            _log.error(se, se);
369    
370                            throw se;
371                    }
372            }
373    
374            public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
375                    HttpPrincipal httpPrincipal, long userId)
376                    throws com.liferay.portal.kernel.exception.PortalException {
377                    try {
378                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
379                                            "getUserRoles", _getUserRolesParameterTypes10);
380    
381                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
382    
383                            Object returnObj = null;
384    
385                            try {
386                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
387                            }
388                            catch (Exception e) {
389                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
390                                            throw (com.liferay.portal.kernel.exception.PortalException)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 boolean hasUserRole(HttpPrincipal httpPrincipal, long userId,
406                    long companyId, java.lang.String name, boolean inherited)
407                    throws com.liferay.portal.kernel.exception.PortalException {
408                    try {
409                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
410                                            "hasUserRole", _hasUserRoleParameterTypes11);
411    
412                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
413                                            companyId, name, inherited);
414    
415                            Object returnObj = null;
416    
417                            try {
418                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
419                            }
420                            catch (Exception e) {
421                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
422                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
423                                    }
424    
425                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
426                            }
427    
428                            return ((Boolean)returnObj).booleanValue();
429                    }
430                    catch (com.liferay.portal.kernel.exception.SystemException se) {
431                            _log.error(se, se);
432    
433                            throw se;
434                    }
435            }
436    
437            public static boolean hasUserRoles(HttpPrincipal httpPrincipal,
438                    long userId, long companyId, java.lang.String[] names, boolean inherited)
439                    throws com.liferay.portal.kernel.exception.PortalException {
440                    try {
441                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
442                                            "hasUserRoles", _hasUserRolesParameterTypes12);
443    
444                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
445                                            companyId, names, inherited);
446    
447                            Object returnObj = null;
448    
449                            try {
450                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
451                            }
452                            catch (Exception e) {
453                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
454                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
455                                    }
456    
457                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
458                            }
459    
460                            return ((Boolean)returnObj).booleanValue();
461                    }
462                    catch (com.liferay.portal.kernel.exception.SystemException se) {
463                            _log.error(se, se);
464    
465                            throw se;
466                    }
467            }
468    
469            public static void unsetUserRoles(HttpPrincipal httpPrincipal, long userId,
470                    long[] roleIds)
471                    throws com.liferay.portal.kernel.exception.PortalException {
472                    try {
473                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
474                                            "unsetUserRoles", _unsetUserRolesParameterTypes13);
475    
476                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
477                                            roleIds);
478    
479                            try {
480                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
481                            }
482                            catch (Exception e) {
483                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
484                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
485                                    }
486    
487                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
488                            }
489                    }
490                    catch (com.liferay.portal.kernel.exception.SystemException se) {
491                            _log.error(se, se);
492    
493                            throw se;
494                    }
495            }
496    
497            public static com.liferay.portal.model.Role updateRole(
498                    HttpPrincipal httpPrincipal, long roleId, java.lang.String name,
499                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
500                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
501                    java.lang.String subtype,
502                    com.liferay.portal.service.ServiceContext serviceContext)
503                    throws com.liferay.portal.kernel.exception.PortalException {
504                    try {
505                            MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
506                                            "updateRole", _updateRoleParameterTypes14);
507    
508                            MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
509                                            name, titleMap, descriptionMap, subtype, serviceContext);
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
522                            }
523    
524                            return (com.liferay.portal.model.Role)returnObj;
525                    }
526                    catch (com.liferay.portal.kernel.exception.SystemException se) {
527                            _log.error(se, se);
528    
529                            throw se;
530                    }
531            }
532    
533            private static Log _log = LogFactoryUtil.getLog(RoleServiceHttp.class);
534            private static final Class<?>[] _addRoleParameterTypes0 = new Class[] {
535                            java.lang.String.class, long.class, java.lang.String.class,
536                            java.util.Map.class, java.util.Map.class, int.class,
537                            java.lang.String.class,
538                            com.liferay.portal.service.ServiceContext.class
539                    };
540            private static final Class<?>[] _addRoleParameterTypes1 = new Class[] {
541                            java.lang.String.class, java.util.Map.class, java.util.Map.class,
542                            int.class
543                    };
544            private static final Class<?>[] _addUserRolesParameterTypes2 = new Class[] {
545                            long.class, long[].class
546                    };
547            private static final Class<?>[] _deleteRoleParameterTypes3 = new Class[] {
548                            long.class
549                    };
550            private static final Class<?>[] _getGroupRolesParameterTypes4 = new Class[] {
551                            long.class
552                    };
553            private static final Class<?>[] _getRoleParameterTypes5 = new Class[] {
554                            long.class
555                    };
556            private static final Class<?>[] _getRoleParameterTypes6 = new Class[] {
557                            long.class, java.lang.String.class
558                    };
559            private static final Class<?>[] _getUserGroupGroupRolesParameterTypes7 = new Class[] {
560                            long.class, long.class
561                    };
562            private static final Class<?>[] _getUserGroupRolesParameterTypes8 = new Class[] {
563                            long.class, long.class
564                    };
565            private static final Class<?>[] _getUserRelatedRolesParameterTypes9 = new Class[] {
566                            long.class, java.util.List.class
567                    };
568            private static final Class<?>[] _getUserRolesParameterTypes10 = new Class[] {
569                            long.class
570                    };
571            private static final Class<?>[] _hasUserRoleParameterTypes11 = new Class[] {
572                            long.class, long.class, java.lang.String.class, boolean.class
573                    };
574            private static final Class<?>[] _hasUserRolesParameterTypes12 = new Class[] {
575                            long.class, long.class, java.lang.String[].class, boolean.class
576                    };
577            private static final Class<?>[] _unsetUserRolesParameterTypes13 = new Class[] {
578                            long.class, long[].class
579                    };
580            private static final Class<?>[] _updateRoleParameterTypes14 = new Class[] {
581                            long.class, java.lang.String.class, java.util.Map.class,
582                            java.util.Map.class, java.lang.String.class,
583                            com.liferay.portal.service.ServiceContext.class
584                    };
585    }