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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.ResourcePermissionServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.ResourcePermissionServiceUtil} 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       ResourcePermissionServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.ResourcePermissionServiceUtil
052     * @generated
053     */
054    public class ResourcePermissionServiceHttp {
055            public static void addResourcePermission(HttpPrincipal httpPrincipal,
056                    long groupId, long companyId, java.lang.String name, int scope,
057                    java.lang.String primKey, long roleId, java.lang.String actionId)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
062                                            "addResourcePermission", long.class, long.class,
063                                            java.lang.String.class, int.class, java.lang.String.class,
064                                            long.class, java.lang.String.class);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
067                                            companyId, name, scope, primKey, roleId, actionId);
068    
069                            try {
070                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static void setIndividualResourcePermissions(
092                    HttpPrincipal httpPrincipal, long groupId, long companyId,
093                    java.lang.String name, java.lang.String primKey, long roleId,
094                    java.lang.String[] actionIds)
095                    throws com.liferay.portal.kernel.exception.PortalException,
096                            com.liferay.portal.kernel.exception.SystemException {
097                    try {
098                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
099                                            "setIndividualResourcePermissions", long.class, long.class,
100                                            java.lang.String.class, java.lang.String.class, long.class,
101                                            java.lang.String[].class);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
104                                            companyId, name, primKey, roleId, actionIds);
105    
106                            try {
107                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
108                            }
109                            catch (Exception e) {
110                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
112                                    }
113    
114                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
115                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
116                                    }
117    
118                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
119                            }
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 removeResourcePermission(HttpPrincipal httpPrincipal,
129                    long groupId, long companyId, java.lang.String name, int scope,
130                    java.lang.String primKey, long roleId, java.lang.String actionId)
131                    throws com.liferay.portal.kernel.exception.PortalException,
132                            com.liferay.portal.kernel.exception.SystemException {
133                    try {
134                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
135                                            "removeResourcePermission", long.class, long.class,
136                                            java.lang.String.class, int.class, java.lang.String.class,
137                                            long.class, java.lang.String.class);
138    
139                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
140                                            companyId, name, scope, primKey, roleId, actionId);
141    
142                            try {
143                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
144                            }
145                            catch (Exception e) {
146                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
148                                    }
149    
150                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
151                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
152                                    }
153    
154                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
155                            }
156                    }
157                    catch (com.liferay.portal.kernel.exception.SystemException se) {
158                            _log.error(se, se);
159    
160                            throw se;
161                    }
162            }
163    
164            public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
165                    long groupId, long companyId, java.lang.String name, int scope,
166                    long roleId, java.lang.String actionId)
167                    throws com.liferay.portal.kernel.exception.PortalException,
168                            com.liferay.portal.kernel.exception.SystemException {
169                    try {
170                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
171                                            "removeResourcePermissions", long.class, long.class,
172                                            java.lang.String.class, int.class, long.class,
173                                            java.lang.String.class);
174    
175                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
176                                            companyId, name, scope, roleId, actionId);
177    
178                            try {
179                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
180                            }
181                            catch (Exception e) {
182                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
183                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
184                                    }
185    
186                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
187                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
188                                    }
189    
190                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
191                            }
192                    }
193                    catch (com.liferay.portal.kernel.exception.SystemException se) {
194                            _log.error(se, se);
195    
196                            throw se;
197                    }
198            }
199    
200            private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
201    }