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.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.UserGroupGroupRoleServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link UserGroupGroupRoleServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see UserGroupGroupRoleServiceSoap
051     * @see HttpPrincipal
052     * @see UserGroupGroupRoleServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class UserGroupGroupRoleServiceHttp {
057            public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
058                    long userGroupId, long groupId, long[] roleIds)
059                    throws com.liferay.portal.kernel.exception.PortalException {
060                    try {
061                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
062                                            "addUserGroupGroupRoles",
063                                            _addUserGroupGroupRolesParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            userGroupId, groupId, roleIds);
067    
068                            try {
069                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
070                            }
071                            catch (Exception e) {
072                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
073                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
074                                    }
075    
076                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
077                            }
078                    }
079                    catch (com.liferay.portal.kernel.exception.SystemException se) {
080                            _log.error(se, se);
081    
082                            throw se;
083                    }
084            }
085    
086            public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
087                    long[] userGroupIds, long groupId, long roleId)
088                    throws com.liferay.portal.kernel.exception.PortalException {
089                    try {
090                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
091                                            "addUserGroupGroupRoles",
092                                            _addUserGroupGroupRolesParameterTypes1);
093    
094                            MethodHandler methodHandler = new MethodHandler(methodKey,
095                                            userGroupIds, groupId, roleId);
096    
097                            try {
098                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
099                            }
100                            catch (Exception e) {
101                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
102                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
103                                    }
104    
105                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
106                            }
107                    }
108                    catch (com.liferay.portal.kernel.exception.SystemException se) {
109                            _log.error(se, se);
110    
111                            throw se;
112                    }
113            }
114    
115            public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
116                    long userGroupId, long groupId, long[] roleIds)
117                    throws com.liferay.portal.kernel.exception.PortalException {
118                    try {
119                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
120                                            "deleteUserGroupGroupRoles",
121                                            _deleteUserGroupGroupRolesParameterTypes2);
122    
123                            MethodHandler methodHandler = new MethodHandler(methodKey,
124                                            userGroupId, groupId, roleIds);
125    
126                            try {
127                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
128                            }
129                            catch (Exception e) {
130                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
131                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
132                                    }
133    
134                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
135                            }
136                    }
137                    catch (com.liferay.portal.kernel.exception.SystemException se) {
138                            _log.error(se, se);
139    
140                            throw se;
141                    }
142            }
143    
144            public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
145                    long[] userGroupIds, long groupId, long roleId)
146                    throws com.liferay.portal.kernel.exception.PortalException {
147                    try {
148                            MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class,
149                                            "deleteUserGroupGroupRoles",
150                                            _deleteUserGroupGroupRolesParameterTypes3);
151    
152                            MethodHandler methodHandler = new MethodHandler(methodKey,
153                                            userGroupIds, groupId, roleId);
154    
155                            try {
156                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
157                            }
158                            catch (Exception e) {
159                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
160                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
161                                    }
162    
163                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
164                            }
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRoleServiceHttp.class);
174            private static final Class<?>[] _addUserGroupGroupRolesParameterTypes0 = new Class[] {
175                            long.class, long.class, long[].class
176                    };
177            private static final Class<?>[] _addUserGroupGroupRolesParameterTypes1 = new Class[] {
178                            long[].class, long.class, long.class
179                    };
180            private static final Class<?>[] _deleteUserGroupGroupRolesParameterTypes2 = new Class[] {
181                            long.class, long.class, long[].class
182                    };
183            private static final Class<?>[] _deleteUserGroupGroupRolesParameterTypes3 = new Class[] {
184                            long[].class, long.class, long.class
185                    };
186    }