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.UserGroupGroupRoleServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link UserGroupGroupRoleServiceUtil} 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 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 UserGroupGroupRoleServiceSoap
050     * @see HttpPrincipal
051     * @see UserGroupGroupRoleServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class UserGroupGroupRoleServiceHttp {
056            public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
057                    long userGroupId, long groupId, long[] roleIds)
058                    throws com.liferay.portal.kernel.exception.PortalException {
059                    try {
060                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
061                                            "addUserGroupGroupRoles",
062                                            _addUserGroupGroupRolesParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey,
065                                            userGroupId, groupId, roleIds);
066    
067                            try {
068                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
069                            }
070                            catch (Exception e) {
071                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
072                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
073                                    }
074    
075                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
076                            }
077                    }
078                    catch (com.liferay.portal.kernel.exception.SystemException se) {
079                            _log.error(se, se);
080    
081                            throw se;
082                    }
083            }
084    
085            public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
086                    long[] userGroupIds, long groupId, long roleId)
087                    throws com.liferay.portal.kernel.exception.PortalException {
088                    try {
089                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
090                                            "addUserGroupGroupRoles",
091                                            _addUserGroupGroupRolesParameterTypes1);
092    
093                            MethodHandler methodHandler = new MethodHandler(methodKey,
094                                            userGroupIds, groupId, roleId);
095    
096                            try {
097                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
098                            }
099                            catch (Exception e) {
100                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
101                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
102                                    }
103    
104                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
105                            }
106                    }
107                    catch (com.liferay.portal.kernel.exception.SystemException se) {
108                            _log.error(se, se);
109    
110                            throw se;
111                    }
112            }
113    
114            public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
115                    long userGroupId, long groupId, long[] roleIds)
116                    throws com.liferay.portal.kernel.exception.PortalException {
117                    try {
118                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
119                                            "deleteUserGroupGroupRoles",
120                                            _deleteUserGroupGroupRolesParameterTypes2);
121    
122                            MethodHandler methodHandler = new MethodHandler(methodKey,
123                                            userGroupId, groupId, roleIds);
124    
125                            try {
126                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
127                            }
128                            catch (Exception e) {
129                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
130                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
131                                    }
132    
133                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
134                            }
135                    }
136                    catch (com.liferay.portal.kernel.exception.SystemException se) {
137                            _log.error(se, se);
138    
139                            throw se;
140                    }
141            }
142    
143            public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
144                    long[] userGroupIds, long groupId, long roleId)
145                    throws com.liferay.portal.kernel.exception.PortalException {
146                    try {
147                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
148                                            "deleteUserGroupGroupRoles",
149                                            _deleteUserGroupGroupRolesParameterTypes3);
150    
151                            MethodHandler methodHandler = new MethodHandler(methodKey,
152                                            userGroupIds, groupId, roleId);
153    
154                            try {
155                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
156                            }
157                            catch (Exception e) {
158                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
159                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
160                                    }
161    
162                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
163                            }
164                    }
165                    catch (com.liferay.portal.kernel.exception.SystemException se) {
166                            _log.error(se, se);
167    
168                            throw se;
169                    }
170            }
171    
172            private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRoleServiceHttp.class);
173            private static final Class<?>[] _addUserGroupGroupRolesParameterTypes0 = new Class[] {
174                            long.class, long.class, long[].class
175                    };
176            private static final Class<?>[] _addUserGroupGroupRolesParameterTypes1 = new Class[] {
177                            long[].class, long.class, long.class
178                    };
179            private static final Class<?>[] _deleteUserGroupGroupRolesParameterTypes2 = new Class[] {
180                            long.class, long.class, long[].class
181                    };
182            private static final Class<?>[] _deleteUserGroupGroupRolesParameterTypes3 = new Class[] {
183                            long[].class, long.class, long.class
184                    };
185    }