001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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",
063                                            _addResourcePermissionParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
066                                            companyId, name, scope, primKey, roleId, actionId);
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
077                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
078                                    }
079    
080                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082                    }
083                    catch (com.liferay.portal.kernel.exception.SystemException se) {
084                            _log.error(se, se);
085    
086                            throw se;
087                    }
088            }
089    
090            public static void setIndividualResourcePermissions(
091                    HttpPrincipal httpPrincipal, long groupId, long companyId,
092                    java.lang.String name, java.lang.String primKey, long roleId,
093                    java.lang.String[] actionIds)
094                    throws com.liferay.portal.kernel.exception.PortalException,
095                            com.liferay.portal.kernel.exception.SystemException {
096                    try {
097                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
098                                            "setIndividualResourcePermissions",
099                                            _setIndividualResourcePermissionsParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
102                                            companyId, name, primKey, roleId, actionIds);
103    
104                            try {
105                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
109                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
110                                    }
111    
112                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
113                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static void removeResourcePermission(HttpPrincipal httpPrincipal,
127                    long groupId, long companyId, java.lang.String name, int scope,
128                    java.lang.String primKey, long roleId, java.lang.String actionId)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    try {
132                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
133                                            "removeResourcePermission",
134                                            _removeResourcePermissionParameterTypes2);
135    
136                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
137                                            companyId, name, scope, primKey, roleId, actionId);
138    
139                            try {
140                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
141                            }
142                            catch (Exception e) {
143                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
145                                    }
146    
147                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
149                                    }
150    
151                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
152                            }
153                    }
154                    catch (com.liferay.portal.kernel.exception.SystemException se) {
155                            _log.error(se, se);
156    
157                            throw se;
158                    }
159            }
160    
161            public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
162                    long groupId, long companyId, java.lang.String name, int scope,
163                    long roleId, java.lang.String actionId)
164                    throws com.liferay.portal.kernel.exception.PortalException,
165                            com.liferay.portal.kernel.exception.SystemException {
166                    try {
167                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
168                                            "removeResourcePermissions",
169                                            _removeResourcePermissionsParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
172                                            companyId, name, scope, roleId, actionId);
173    
174                            try {
175                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
176                            }
177                            catch (Exception e) {
178                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
179                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
180                                    }
181    
182                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
183                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
184                                    }
185    
186                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
187                            }
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
197            private static final Class<?>[] _addResourcePermissionParameterTypes0 = new Class[] {
198                            long.class, long.class, java.lang.String.class, int.class,
199                            java.lang.String.class, long.class, java.lang.String.class
200                    };
201            private static final Class<?>[] _setIndividualResourcePermissionsParameterTypes1 =
202                    new Class[] {
203                            long.class, long.class, java.lang.String.class,
204                            java.lang.String.class, long.class, java.lang.String[].class
205                    };
206            private static final Class<?>[] _removeResourcePermissionParameterTypes2 = new Class[] {
207                            long.class, long.class, java.lang.String.class, int.class,
208                            java.lang.String.class, long.class, java.lang.String.class
209                    };
210            private static final Class<?>[] _removeResourcePermissionsParameterTypes3 = new Class[] {
211                            long.class, long.class, java.lang.String.class, int.class,
212                            long.class, java.lang.String.class
213                    };
214    }