001    /**
002     * Copyright (c) 2000-2010 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.LongWrapper;
020    import com.liferay.portal.kernel.util.MethodWrapper;
021    import com.liferay.portal.kernel.util.NullWrapper;
022    import com.liferay.portal.security.auth.HttpPrincipal;
023    import com.liferay.portal.service.UserGroupGroupRoleServiceUtil;
024    
025    /**
026     * <p>
027     * This class provides a HTTP utility for the
028     * {@link com.liferay.portal.service.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 com.liferay.portal.security.auth.HttpPrincipal} parameter.
032     * </p>
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       com.liferay.portal.security.auth.HttpPrincipal
052     * @see       com.liferay.portal.service.UserGroupGroupRoleServiceUtil
053     * @generated
054     */
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                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            Object paramObj0 = new LongWrapper(userGroupId);
062    
063                            Object paramObj1 = new LongWrapper(groupId);
064    
065                            Object paramObj2 = roleIds;
066    
067                            if (roleIds == null) {
068                                    paramObj2 = new NullWrapper("[J");
069                            }
070    
071                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
072                                            "addUserGroupGroupRoles",
073                                            new Object[] { paramObj0, paramObj1, paramObj2 });
074    
075                            try {
076                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
077                            }
078                            catch (Exception e) {
079                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
080                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
081                                    }
082    
083                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
084                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
085                                    }
086    
087                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
088                            }
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
098                    long[] userGroupIds, long groupId, long roleId)
099                    throws com.liferay.portal.kernel.exception.PortalException,
100                            com.liferay.portal.kernel.exception.SystemException {
101                    try {
102                            Object paramObj0 = userGroupIds;
103    
104                            if (userGroupIds == null) {
105                                    paramObj0 = new NullWrapper("[J");
106                            }
107    
108                            Object paramObj1 = new LongWrapper(groupId);
109    
110                            Object paramObj2 = new LongWrapper(roleId);
111    
112                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
113                                            "addUserGroupGroupRoles",
114                                            new Object[] { paramObj0, paramObj1, paramObj2 });
115    
116                            try {
117                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
118                            }
119                            catch (Exception e) {
120                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
121                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
122                                    }
123    
124                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
125                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
126                                    }
127    
128                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
129                            }
130                    }
131                    catch (com.liferay.portal.kernel.exception.SystemException se) {
132                            _log.error(se, se);
133    
134                            throw se;
135                    }
136            }
137    
138            public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
139                    long userGroupId, long groupId, long[] roleIds)
140                    throws com.liferay.portal.kernel.exception.PortalException,
141                            com.liferay.portal.kernel.exception.SystemException {
142                    try {
143                            Object paramObj0 = new LongWrapper(userGroupId);
144    
145                            Object paramObj1 = new LongWrapper(groupId);
146    
147                            Object paramObj2 = roleIds;
148    
149                            if (roleIds == null) {
150                                    paramObj2 = new NullWrapper("[J");
151                            }
152    
153                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
154                                            "deleteUserGroupGroupRoles",
155                                            new Object[] { paramObj0, paramObj1, paramObj2 });
156    
157                            try {
158                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
159                            }
160                            catch (Exception e) {
161                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
162                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
163                                    }
164    
165                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
166                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
167                                    }
168    
169                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
170                            }
171                    }
172                    catch (com.liferay.portal.kernel.exception.SystemException se) {
173                            _log.error(se, se);
174    
175                            throw se;
176                    }
177            }
178    
179            public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
180                    long[] userGroupIds, long groupId, long roleId)
181                    throws com.liferay.portal.kernel.exception.PortalException,
182                            com.liferay.portal.kernel.exception.SystemException {
183                    try {
184                            Object paramObj0 = userGroupIds;
185    
186                            if (userGroupIds == null) {
187                                    paramObj0 = new NullWrapper("[J");
188                            }
189    
190                            Object paramObj1 = new LongWrapper(groupId);
191    
192                            Object paramObj2 = new LongWrapper(roleId);
193    
194                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
195                                            "deleteUserGroupGroupRoles",
196                                            new Object[] { paramObj0, paramObj1, paramObj2 });
197    
198                            try {
199                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
200                            }
201                            catch (Exception e) {
202                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
203                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
204                                    }
205    
206                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
207                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
208                                    }
209    
210                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
211                            }
212                    }
213                    catch (com.liferay.portal.kernel.exception.SystemException se) {
214                            _log.error(se, se);
215    
216                            throw se;
217                    }
218            }
219    
220            private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRoleServiceHttp.class);
221    }