001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.ResourceBlockServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link ResourceBlockServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link HttpPrincipal} parameter.
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 ResourceBlockServiceSoap
051     * @see HttpPrincipal
052     * @see ResourceBlockServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class ResourceBlockServiceHttp {
057            public static void addCompanyScopePermission(HttpPrincipal httpPrincipal,
058                    long scopeGroupId, long companyId, java.lang.String name, long roleId,
059                    java.lang.String actionId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
063                                            "addCompanyScopePermission",
064                                            _addCompanyScopePermissionParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            scopeGroupId, companyId, name, 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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079                    }
080                    catch (com.liferay.portal.kernel.exception.SystemException se) {
081                            _log.error(se, se);
082    
083                            throw se;
084                    }
085            }
086    
087            public static void addGroupScopePermission(HttpPrincipal httpPrincipal,
088                    long scopeGroupId, long companyId, long groupId, java.lang.String name,
089                    long roleId, java.lang.String actionId)
090                    throws com.liferay.portal.kernel.exception.PortalException {
091                    try {
092                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
093                                            "addGroupScopePermission",
094                                            _addGroupScopePermissionParameterTypes1);
095    
096                            MethodHandler methodHandler = new MethodHandler(methodKey,
097                                            scopeGroupId, companyId, groupId, name, roleId, actionId);
098    
099                            try {
100                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
101                            }
102                            catch (Exception e) {
103                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
104                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
105                                    }
106    
107                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
108                            }
109                    }
110                    catch (com.liferay.portal.kernel.exception.SystemException se) {
111                            _log.error(se, se);
112    
113                            throw se;
114                    }
115            }
116    
117            public static void addIndividualScopePermission(
118                    HttpPrincipal httpPrincipal, long companyId, long groupId,
119                    java.lang.String name, long primKey, long roleId,
120                    java.lang.String actionId)
121                    throws com.liferay.portal.kernel.exception.PortalException {
122                    try {
123                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
124                                            "addIndividualScopePermission",
125                                            _addIndividualScopePermissionParameterTypes2);
126    
127                            MethodHandler methodHandler = new MethodHandler(methodKey,
128                                            companyId, groupId, name, primKey, roleId, actionId);
129    
130                            try {
131                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
132                            }
133                            catch (Exception e) {
134                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
135                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
136                                    }
137    
138                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
139                            }
140                    }
141                    catch (com.liferay.portal.kernel.exception.SystemException se) {
142                            _log.error(se, se);
143    
144                            throw se;
145                    }
146            }
147    
148            public static void removeAllGroupScopePermissions(
149                    HttpPrincipal httpPrincipal, long scopeGroupId, long companyId,
150                    java.lang.String name, long roleId, java.lang.String actionId)
151                    throws com.liferay.portal.kernel.exception.PortalException {
152                    try {
153                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
154                                            "removeAllGroupScopePermissions",
155                                            _removeAllGroupScopePermissionsParameterTypes3);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey,
158                                            scopeGroupId, companyId, name, roleId, actionId);
159    
160                            try {
161                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
162                            }
163                            catch (Exception e) {
164                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
165                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
166                                    }
167    
168                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
169                            }
170                    }
171                    catch (com.liferay.portal.kernel.exception.SystemException se) {
172                            _log.error(se, se);
173    
174                            throw se;
175                    }
176            }
177    
178            public static void removeCompanyScopePermission(
179                    HttpPrincipal httpPrincipal, long scopeGroupId, long companyId,
180                    java.lang.String name, long roleId, java.lang.String actionId)
181                    throws com.liferay.portal.kernel.exception.PortalException {
182                    try {
183                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
184                                            "removeCompanyScopePermission",
185                                            _removeCompanyScopePermissionParameterTypes4);
186    
187                            MethodHandler methodHandler = new MethodHandler(methodKey,
188                                            scopeGroupId, companyId, name, roleId, actionId);
189    
190                            try {
191                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
192                            }
193                            catch (Exception e) {
194                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
195                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
196                                    }
197    
198                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
199                            }
200                    }
201                    catch (com.liferay.portal.kernel.exception.SystemException se) {
202                            _log.error(se, se);
203    
204                            throw se;
205                    }
206            }
207    
208            public static void removeGroupScopePermission(HttpPrincipal httpPrincipal,
209                    long scopeGroupId, long companyId, long groupId, java.lang.String name,
210                    long roleId, java.lang.String actionId)
211                    throws com.liferay.portal.kernel.exception.PortalException {
212                    try {
213                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
214                                            "removeGroupScopePermission",
215                                            _removeGroupScopePermissionParameterTypes5);
216    
217                            MethodHandler methodHandler = new MethodHandler(methodKey,
218                                            scopeGroupId, companyId, groupId, name, roleId, actionId);
219    
220                            try {
221                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
222                            }
223                            catch (Exception e) {
224                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
225                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230                    }
231                    catch (com.liferay.portal.kernel.exception.SystemException se) {
232                            _log.error(se, se);
233    
234                            throw se;
235                    }
236            }
237    
238            public static void removeIndividualScopePermission(
239                    HttpPrincipal httpPrincipal, long companyId, long groupId,
240                    java.lang.String name, long primKey, long roleId,
241                    java.lang.String actionId)
242                    throws com.liferay.portal.kernel.exception.PortalException {
243                    try {
244                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
245                                            "removeIndividualScopePermission",
246                                            _removeIndividualScopePermissionParameterTypes6);
247    
248                            MethodHandler methodHandler = new MethodHandler(methodKey,
249                                            companyId, groupId, name, primKey, roleId, actionId);
250    
251                            try {
252                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
253                            }
254                            catch (Exception e) {
255                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
256                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
257                                    }
258    
259                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
260                            }
261                    }
262                    catch (com.liferay.portal.kernel.exception.SystemException se) {
263                            _log.error(se, se);
264    
265                            throw se;
266                    }
267            }
268    
269            public static void setCompanyScopePermissions(HttpPrincipal httpPrincipal,
270                    long scopeGroupId, long companyId, java.lang.String name, long roleId,
271                    java.util.List<java.lang.String> actionIds)
272                    throws com.liferay.portal.kernel.exception.PortalException {
273                    try {
274                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
275                                            "setCompanyScopePermissions",
276                                            _setCompanyScopePermissionsParameterTypes7);
277    
278                            MethodHandler methodHandler = new MethodHandler(methodKey,
279                                            scopeGroupId, companyId, name, roleId, actionIds);
280    
281                            try {
282                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
283                            }
284                            catch (Exception e) {
285                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
286                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
287                                    }
288    
289                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
290                            }
291                    }
292                    catch (com.liferay.portal.kernel.exception.SystemException se) {
293                            _log.error(se, se);
294    
295                            throw se;
296                    }
297            }
298    
299            public static void setGroupScopePermissions(HttpPrincipal httpPrincipal,
300                    long scopeGroupId, long companyId, long groupId, java.lang.String name,
301                    long roleId, java.util.List<java.lang.String> actionIds)
302                    throws com.liferay.portal.kernel.exception.PortalException {
303                    try {
304                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
305                                            "setGroupScopePermissions",
306                                            _setGroupScopePermissionsParameterTypes8);
307    
308                            MethodHandler methodHandler = new MethodHandler(methodKey,
309                                            scopeGroupId, companyId, groupId, name, roleId, actionIds);
310    
311                            try {
312                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
313                            }
314                            catch (Exception e) {
315                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
316                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
317                                    }
318    
319                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
320                            }
321                    }
322                    catch (com.liferay.portal.kernel.exception.SystemException se) {
323                            _log.error(se, se);
324    
325                            throw se;
326                    }
327            }
328    
329            public static void setIndividualScopePermissions(
330                    HttpPrincipal httpPrincipal, long companyId, long groupId,
331                    java.lang.String name, long primKey, long roleId,
332                    java.util.List<java.lang.String> actionIds)
333                    throws com.liferay.portal.kernel.exception.PortalException {
334                    try {
335                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
336                                            "setIndividualScopePermissions",
337                                            _setIndividualScopePermissionsParameterTypes9);
338    
339                            MethodHandler methodHandler = new MethodHandler(methodKey,
340                                            companyId, groupId, name, primKey, roleId, actionIds);
341    
342                            try {
343                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
344                            }
345                            catch (Exception e) {
346                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
347                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
348                                    }
349    
350                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
351                            }
352                    }
353                    catch (com.liferay.portal.kernel.exception.SystemException se) {
354                            _log.error(se, se);
355    
356                            throw se;
357                    }
358            }
359    
360            public static void setIndividualScopePermissions(
361                    HttpPrincipal httpPrincipal, long companyId, long groupId,
362                    java.lang.String name, long primKey,
363                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds)
364                    throws com.liferay.portal.kernel.exception.PortalException {
365                    try {
366                            MethodKey methodKey = new MethodKey(ResourceBlockServiceUtil.class,
367                                            "setIndividualScopePermissions",
368                                            _setIndividualScopePermissionsParameterTypes10);
369    
370                            MethodHandler methodHandler = new MethodHandler(methodKey,
371                                            companyId, groupId, name, primKey, roleIdsToActionIds);
372    
373                            try {
374                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
375                            }
376                            catch (Exception e) {
377                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
378                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
379                                    }
380    
381                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
382                            }
383                    }
384                    catch (com.liferay.portal.kernel.exception.SystemException se) {
385                            _log.error(se, se);
386    
387                            throw se;
388                    }
389            }
390    
391            private static Log _log = LogFactoryUtil.getLog(ResourceBlockServiceHttp.class);
392            private static final Class<?>[] _addCompanyScopePermissionParameterTypes0 = new Class[] {
393                            long.class, long.class, java.lang.String.class, long.class,
394                            java.lang.String.class
395                    };
396            private static final Class<?>[] _addGroupScopePermissionParameterTypes1 = new Class[] {
397                            long.class, long.class, long.class, java.lang.String.class,
398                            long.class, java.lang.String.class
399                    };
400            private static final Class<?>[] _addIndividualScopePermissionParameterTypes2 =
401                    new Class[] {
402                            long.class, long.class, java.lang.String.class, long.class,
403                            long.class, java.lang.String.class
404                    };
405            private static final Class<?>[] _removeAllGroupScopePermissionsParameterTypes3 =
406                    new Class[] {
407                            long.class, long.class, java.lang.String.class, long.class,
408                            java.lang.String.class
409                    };
410            private static final Class<?>[] _removeCompanyScopePermissionParameterTypes4 =
411                    new Class[] {
412                            long.class, long.class, java.lang.String.class, long.class,
413                            java.lang.String.class
414                    };
415            private static final Class<?>[] _removeGroupScopePermissionParameterTypes5 = new Class[] {
416                            long.class, long.class, long.class, java.lang.String.class,
417                            long.class, java.lang.String.class
418                    };
419            private static final Class<?>[] _removeIndividualScopePermissionParameterTypes6 =
420                    new Class[] {
421                            long.class, long.class, java.lang.String.class, long.class,
422                            long.class, java.lang.String.class
423                    };
424            private static final Class<?>[] _setCompanyScopePermissionsParameterTypes7 = new Class[] {
425                            long.class, long.class, java.lang.String.class, long.class,
426                            java.util.List.class
427                    };
428            private static final Class<?>[] _setGroupScopePermissionsParameterTypes8 = new Class[] {
429                            long.class, long.class, long.class, java.lang.String.class,
430                            long.class, java.util.List.class
431                    };
432            private static final Class<?>[] _setIndividualScopePermissionsParameterTypes9 =
433                    new Class[] {
434                            long.class, long.class, java.lang.String.class, long.class,
435                            long.class, java.util.List.class
436                    };
437            private static final Class<?>[] _setIndividualScopePermissionsParameterTypes10 =
438                    new Class[] {
439                            long.class, long.class, java.lang.String.class, long.class,
440                            java.util.Map.class
441                    };
442    }