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     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.ResourcePermissionServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see ResourcePermissionServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.ResourcePermissionServiceUtil
050     * @generated
051     */
052    public class ResourcePermissionServiceHttp {
053            public static void addResourcePermission(HttpPrincipal httpPrincipal,
054                    long groupId, long companyId, java.lang.String name, int scope,
055                    java.lang.String primKey, long roleId, java.lang.String actionId)
056                    throws com.liferay.portal.kernel.exception.PortalException,
057                            com.liferay.portal.kernel.exception.SystemException {
058                    try {
059                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class,
060                                            "addResourcePermission",
061                                            _addResourcePermissionParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
064                                            companyId, name, scope, primKey, roleId, actionId);
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 removeResourcePermission(HttpPrincipal httpPrincipal,
089                    long groupId, long companyId, java.lang.String name, int scope,
090                    java.lang.String primKey, long roleId, java.lang.String actionId)
091                    throws com.liferay.portal.kernel.exception.PortalException,
092                            com.liferay.portal.kernel.exception.SystemException {
093                    try {
094                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class,
095                                            "removeResourcePermission",
096                                            _removeResourcePermissionParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
099                                            companyId, name, scope, primKey, roleId, actionId);
100    
101                            try {
102                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
106                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
107                                    }
108    
109                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
110                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
111                                    }
112    
113                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
114                            }
115                    }
116                    catch (com.liferay.portal.kernel.exception.SystemException se) {
117                            _log.error(se, se);
118    
119                            throw se;
120                    }
121            }
122    
123            public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
124                    long groupId, long companyId, java.lang.String name, int scope,
125                    long roleId, java.lang.String actionId)
126                    throws com.liferay.portal.kernel.exception.PortalException,
127                            com.liferay.portal.kernel.exception.SystemException {
128                    try {
129                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class,
130                                            "removeResourcePermissions",
131                                            _removeResourcePermissionsParameterTypes2);
132    
133                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
134                                            companyId, name, scope, roleId, actionId);
135    
136                            try {
137                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
146                                    }
147    
148                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
149                            }
150                    }
151                    catch (com.liferay.portal.kernel.exception.SystemException se) {
152                            _log.error(se, se);
153    
154                            throw se;
155                    }
156            }
157    
158            public static void setIndividualResourcePermissions(
159                    HttpPrincipal httpPrincipal, long groupId, long companyId,
160                    java.lang.String name, java.lang.String primKey, long roleId,
161                    java.lang.String[] actionIds)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class,
166                                            "setIndividualResourcePermissions",
167                                            _setIndividualResourcePermissionsParameterTypes3);
168    
169                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
170                                            companyId, name, primKey, roleId, actionIds);
171    
172                            try {
173                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
174                            }
175                            catch (Exception e) {
176                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
177                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
178                                    }
179    
180                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186                    }
187                    catch (com.liferay.portal.kernel.exception.SystemException se) {
188                            _log.error(se, se);
189    
190                            throw se;
191                    }
192            }
193    
194            public static void setIndividualResourcePermissions(
195                    HttpPrincipal httpPrincipal, long groupId, long companyId,
196                    java.lang.String name, java.lang.String primKey,
197                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds)
198                    throws com.liferay.portal.kernel.exception.PortalException,
199                            com.liferay.portal.kernel.exception.SystemException {
200                    try {
201                            MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class,
202                                            "setIndividualResourcePermissions",
203                                            _setIndividualResourcePermissionsParameterTypes4);
204    
205                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
206                                            companyId, name, primKey, roleIdsToActionIds);
207    
208                            try {
209                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
210                            }
211                            catch (Exception e) {
212                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
213                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
214                                    }
215    
216                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
217                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
218                                    }
219    
220                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
221                            }
222                    }
223                    catch (com.liferay.portal.kernel.exception.SystemException se) {
224                            _log.error(se, se);
225    
226                            throw se;
227                    }
228            }
229    
230            private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
231            private static final Class<?>[] _addResourcePermissionParameterTypes0 = new Class[] {
232                            long.class, long.class, java.lang.String.class, int.class,
233                            java.lang.String.class, long.class, java.lang.String.class
234                    };
235            private static final Class<?>[] _removeResourcePermissionParameterTypes1 = new Class[] {
236                            long.class, long.class, java.lang.String.class, int.class,
237                            java.lang.String.class, long.class, java.lang.String.class
238                    };
239            private static final Class<?>[] _removeResourcePermissionsParameterTypes2 = new Class[] {
240                            long.class, long.class, java.lang.String.class, int.class,
241                            long.class, java.lang.String.class
242                    };
243            private static final Class<?>[] _setIndividualResourcePermissionsParameterTypes3 =
244                    new Class[] {
245                            long.class, long.class, java.lang.String.class,
246                            java.lang.String.class, long.class, java.lang.String[].class
247                    };
248            private static final Class<?>[] _setIndividualResourcePermissionsParameterTypes4 =
249                    new Class[] {
250                            long.class, long.class, java.lang.String.class,
251                            java.lang.String.class, java.util.Map.class
252                    };
253    }