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.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 removeResourcePermission(HttpPrincipal httpPrincipal,
091                    long groupId, long companyId, java.lang.String name, int scope,
092                    java.lang.String primKey, long roleId, java.lang.String actionId)
093                    throws com.liferay.portal.kernel.exception.PortalException,
094                            com.liferay.portal.kernel.exception.SystemException {
095                    try {
096                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
097                                            "removeResourcePermission",
098                                            _removeResourcePermissionParameterTypes1);
099    
100                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
101                                            companyId, name, scope, primKey, roleId, actionId);
102    
103                            try {
104                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
112                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
113                                    }
114    
115                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
116                            }
117                    }
118                    catch (com.liferay.portal.kernel.exception.SystemException se) {
119                            _log.error(se, se);
120    
121                            throw se;
122                    }
123            }
124    
125            public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
126                    long groupId, long companyId, java.lang.String name, int scope,
127                    long roleId, java.lang.String actionId)
128                    throws com.liferay.portal.kernel.exception.PortalException,
129                            com.liferay.portal.kernel.exception.SystemException {
130                    try {
131                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
132                                            "removeResourcePermissions",
133                                            _removeResourcePermissionsParameterTypes2);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
136                                            companyId, name, scope, roleId, actionId);
137    
138                            try {
139                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
140                            }
141                            catch (Exception e) {
142                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
143                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
144                                    }
145    
146                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
147                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
148                                    }
149    
150                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
151                            }
152                    }
153                    catch (com.liferay.portal.kernel.exception.SystemException se) {
154                            _log.error(se, se);
155    
156                            throw se;
157                    }
158            }
159    
160            public static void setIndividualResourcePermissions(
161                    HttpPrincipal httpPrincipal, long groupId, long companyId,
162                    java.lang.String name, java.lang.String primKey, long roleId,
163                    java.lang.String[] actionIds)
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                                            "setIndividualResourcePermissions",
169                                            _setIndividualResourcePermissionsParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
172                                            companyId, name, primKey, roleId, actionIds);
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            public static void setIndividualResourcePermissions(
197                    HttpPrincipal httpPrincipal, long groupId, long companyId,
198                    java.lang.String name, java.lang.String primKey,
199                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds)
200                    throws com.liferay.portal.kernel.exception.PortalException,
201                            com.liferay.portal.kernel.exception.SystemException {
202                    try {
203                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
204                                            "setIndividualResourcePermissions",
205                                            _setIndividualResourcePermissionsParameterTypes4);
206    
207                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
208                                            companyId, name, primKey, roleIdsToActionIds);
209    
210                            try {
211                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
212                            }
213                            catch (Exception e) {
214                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
215                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
216                                    }
217    
218                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
219                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
220                                    }
221    
222                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
223                            }
224                    }
225                    catch (com.liferay.portal.kernel.exception.SystemException se) {
226                            _log.error(se, se);
227    
228                            throw se;
229                    }
230            }
231    
232            private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
233            private static final Class<?>[] _addResourcePermissionParameterTypes0 = new Class[] {
234                            long.class, long.class, java.lang.String.class, int.class,
235                            java.lang.String.class, long.class, java.lang.String.class
236                    };
237            private static final Class<?>[] _removeResourcePermissionParameterTypes1 = new Class[] {
238                            long.class, long.class, java.lang.String.class, int.class,
239                            java.lang.String.class, long.class, java.lang.String.class
240                    };
241            private static final Class<?>[] _removeResourcePermissionsParameterTypes2 = new Class[] {
242                            long.class, long.class, java.lang.String.class, int.class,
243                            long.class, java.lang.String.class
244                    };
245            private static final Class<?>[] _setIndividualResourcePermissionsParameterTypes3 =
246                    new Class[] {
247                            long.class, long.class, java.lang.String.class,
248                            java.lang.String.class, long.class, java.lang.String[].class
249                    };
250            private static final Class<?>[] _setIndividualResourcePermissionsParameterTypes4 =
251                    new Class[] {
252                            long.class, long.class, java.lang.String.class,
253                            java.lang.String.class, java.util.Map.class
254                    };
255    }