001    /**
002     * Copyright (c) 2000-2013 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 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.UserGroupRoleServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.UserGroupRoleServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
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       UserGroupRoleServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.UserGroupRoleServiceUtil
052     * @generated
053     */
054    public class UserGroupRoleServiceHttp {
055            public static void addUserGroupRoles(HttpPrincipal httpPrincipal,
056                    long userId, long groupId, long[] roleIds)
057                    throws com.liferay.portal.kernel.exception.PortalException,
058                            com.liferay.portal.kernel.exception.SystemException {
059                    try {
060                            MethodKey methodKey = new MethodKey(UserGroupRoleServiceUtil.class.getName(),
061                                            "addUserGroupRoles", _addUserGroupRolesParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
064                                            groupId, roleIds);
065    
066                            try {
067                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
068                            }
069                            catch (Exception e) {
070                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
071                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
072                                    }
073    
074                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static void addUserGroupRoles(HttpPrincipal httpPrincipal,
089                    long[] userIds, long groupId, long roleId)
090                    throws com.liferay.portal.kernel.exception.PortalException,
091                            com.liferay.portal.kernel.exception.SystemException {
092                    try {
093                            MethodKey methodKey = new MethodKey(UserGroupRoleServiceUtil.class.getName(),
094                                            "addUserGroupRoles", _addUserGroupRolesParameterTypes1);
095    
096                            MethodHandler methodHandler = new MethodHandler(methodKey, userIds,
097                                            groupId, roleId);
098    
099                            try {
100                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
101                            }
102                            catch (Exception e) {
103                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
104                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
105                                    }
106    
107                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
108                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113                    }
114                    catch (com.liferay.portal.kernel.exception.SystemException se) {
115                            _log.error(se, se);
116    
117                            throw se;
118                    }
119            }
120    
121            public static void deleteUserGroupRoles(HttpPrincipal httpPrincipal,
122                    long userId, long groupId, long[] roleIds)
123                    throws com.liferay.portal.kernel.exception.PortalException,
124                            com.liferay.portal.kernel.exception.SystemException {
125                    try {
126                            MethodKey methodKey = new MethodKey(UserGroupRoleServiceUtil.class.getName(),
127                                            "deleteUserGroupRoles", _deleteUserGroupRolesParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
130                                            groupId, roleIds);
131    
132                            try {
133                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
134                            }
135                            catch (Exception e) {
136                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
137                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
138                                    }
139    
140                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
141                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
142                                    }
143    
144                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
145                            }
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static void deleteUserGroupRoles(HttpPrincipal httpPrincipal,
155                    long[] userIds, long groupId, long roleId)
156                    throws com.liferay.portal.kernel.exception.PortalException,
157                            com.liferay.portal.kernel.exception.SystemException {
158                    try {
159                            MethodKey methodKey = new MethodKey(UserGroupRoleServiceUtil.class.getName(),
160                                            "deleteUserGroupRoles", _deleteUserGroupRolesParameterTypes3);
161    
162                            MethodHandler methodHandler = new MethodHandler(methodKey, userIds,
163                                            groupId, roleId);
164    
165                            try {
166                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
167                            }
168                            catch (Exception e) {
169                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
170                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
171                                    }
172    
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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
181                            _log.error(se, se);
182    
183                            throw se;
184                    }
185            }
186    
187            private static Log _log = LogFactoryUtil.getLog(UserGroupRoleServiceHttp.class);
188            private static final Class<?>[] _addUserGroupRolesParameterTypes0 = new Class[] {
189                            long.class, long.class, long[].class
190                    };
191            private static final Class<?>[] _addUserGroupRolesParameterTypes1 = new Class[] {
192                            long[].class, long.class, long.class
193                    };
194            private static final Class<?>[] _deleteUserGroupRolesParameterTypes2 = new Class[] {
195                            long.class, long.class, long[].class
196                    };
197            private static final Class<?>[] _deleteUserGroupRolesParameterTypes3 = new Class[] {
198                            long[].class, long.class, long.class
199                    };
200    }