001    /**
002     * Copyright (c) 2000-2012 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;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the resource permission local service. This utility wraps {@link com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
023     *
024     * <p>
025     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see ResourcePermissionLocalService
030     * @see com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
031     * @see com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl
032     * @generated
033     */
034    public class ResourcePermissionLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the resource permission to the database. Also notifies the appropriate model listeners.
043            *
044            * @param resourcePermission the resource permission
045            * @return the resource permission that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portal.model.ResourcePermission addResourcePermission(
049                    com.liferay.portal.model.ResourcePermission resourcePermission)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addResourcePermission(resourcePermission);
052            }
053    
054            /**
055            * Creates a new resource permission with the primary key. Does not add the resource permission to the database.
056            *
057            * @param resourcePermissionId the primary key for the new resource permission
058            * @return the new resource permission
059            */
060            public static com.liferay.portal.model.ResourcePermission createResourcePermission(
061                    long resourcePermissionId) {
062                    return getService().createResourcePermission(resourcePermissionId);
063            }
064    
065            /**
066            * Deletes the resource permission with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param resourcePermissionId the primary key of the resource permission
069            * @throws PortalException if a resource permission with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deleteResourcePermission(long resourcePermissionId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteResourcePermission(resourcePermissionId);
076            }
077    
078            /**
079            * Deletes the resource permission from the database. Also notifies the appropriate model listeners.
080            *
081            * @param resourcePermission the resource permission
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deleteResourcePermission(
085                    com.liferay.portal.model.ResourcePermission resourcePermission)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    getService().deleteResourcePermission(resourcePermission);
088            }
089    
090            /**
091            * Performs a dynamic query on the database and returns the matching rows.
092            *
093            * @param dynamicQuery the dynamic query
094            * @return the matching rows
095            * @throws SystemException if a system exception occurred
096            */
097            @SuppressWarnings("rawtypes")
098            public static java.util.List dynamicQuery(
099                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getService().dynamicQuery(dynamicQuery);
102            }
103    
104            /**
105            * Performs a dynamic query on the database and returns a range of the matching rows.
106            *
107            * <p>
108            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
109            * </p>
110            *
111            * @param dynamicQuery the dynamic query
112            * @param start the lower bound of the range of model instances
113            * @param end the upper bound of the range of model instances (not inclusive)
114            * @return the range of matching rows
115            * @throws SystemException if a system exception occurred
116            */
117            @SuppressWarnings("rawtypes")
118            public static java.util.List dynamicQuery(
119                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
120                    int end) throws com.liferay.portal.kernel.exception.SystemException {
121                    return getService().dynamicQuery(dynamicQuery, start, end);
122            }
123    
124            /**
125            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
126            *
127            * <p>
128            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
129            * </p>
130            *
131            * @param dynamicQuery the dynamic query
132            * @param start the lower bound of the range of model instances
133            * @param end the upper bound of the range of model instances (not inclusive)
134            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
135            * @return the ordered range of matching rows
136            * @throws SystemException if a system exception occurred
137            */
138            @SuppressWarnings("rawtypes")
139            public static java.util.List dynamicQuery(
140                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
141                    int end,
142                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
143                    throws com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
146            }
147    
148            /**
149            * Returns the number of rows that match the dynamic query.
150            *
151            * @param dynamicQuery the dynamic query
152            * @return the number of rows that match the dynamic query
153            * @throws SystemException if a system exception occurred
154            */
155            public static long dynamicQueryCount(
156                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getService().dynamicQueryCount(dynamicQuery);
159            }
160    
161            public static com.liferay.portal.model.ResourcePermission fetchResourcePermission(
162                    long resourcePermissionId)
163                    throws com.liferay.portal.kernel.exception.SystemException {
164                    return getService().fetchResourcePermission(resourcePermissionId);
165            }
166    
167            /**
168            * Returns the resource permission with the primary key.
169            *
170            * @param resourcePermissionId the primary key of the resource permission
171            * @return the resource permission
172            * @throws PortalException if a resource permission with the primary key could not be found
173            * @throws SystemException if a system exception occurred
174            */
175            public static com.liferay.portal.model.ResourcePermission getResourcePermission(
176                    long resourcePermissionId)
177                    throws com.liferay.portal.kernel.exception.PortalException,
178                            com.liferay.portal.kernel.exception.SystemException {
179                    return getService().getResourcePermission(resourcePermissionId);
180            }
181    
182            public static com.liferay.portal.model.PersistedModel getPersistedModel(
183                    java.io.Serializable primaryKeyObj)
184                    throws com.liferay.portal.kernel.exception.PortalException,
185                            com.liferay.portal.kernel.exception.SystemException {
186                    return getService().getPersistedModel(primaryKeyObj);
187            }
188    
189            /**
190            * Returns a range of all the resource permissions.
191            *
192            * <p>
193            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
194            * </p>
195            *
196            * @param start the lower bound of the range of resource permissions
197            * @param end the upper bound of the range of resource permissions (not inclusive)
198            * @return the range of resource permissions
199            * @throws SystemException if a system exception occurred
200            */
201            public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions(
202                    int start, int end)
203                    throws com.liferay.portal.kernel.exception.SystemException {
204                    return getService().getResourcePermissions(start, end);
205            }
206    
207            /**
208            * Returns the number of resource permissions.
209            *
210            * @return the number of resource permissions
211            * @throws SystemException if a system exception occurred
212            */
213            public static int getResourcePermissionsCount()
214                    throws com.liferay.portal.kernel.exception.SystemException {
215                    return getService().getResourcePermissionsCount();
216            }
217    
218            /**
219            * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
220            *
221            * @param resourcePermission the resource permission
222            * @return the resource permission that was updated
223            * @throws SystemException if a system exception occurred
224            */
225            public static com.liferay.portal.model.ResourcePermission updateResourcePermission(
226                    com.liferay.portal.model.ResourcePermission resourcePermission)
227                    throws com.liferay.portal.kernel.exception.SystemException {
228                    return getService().updateResourcePermission(resourcePermission);
229            }
230    
231            /**
232            * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
233            *
234            * @param resourcePermission the resource permission
235            * @param merge whether to merge the resource permission with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
236            * @return the resource permission that was updated
237            * @throws SystemException if a system exception occurred
238            */
239            public static com.liferay.portal.model.ResourcePermission updateResourcePermission(
240                    com.liferay.portal.model.ResourcePermission resourcePermission,
241                    boolean merge)
242                    throws com.liferay.portal.kernel.exception.SystemException {
243                    return getService().updateResourcePermission(resourcePermission, merge);
244            }
245    
246            /**
247            * Returns the Spring bean ID for this bean.
248            *
249            * @return the Spring bean ID for this bean
250            */
251            public static java.lang.String getBeanIdentifier() {
252                    return getService().getBeanIdentifier();
253            }
254    
255            /**
256            * Sets the Spring bean ID for this bean.
257            *
258            * @param beanIdentifier the Spring bean ID for this bean
259            */
260            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
261                    getService().setBeanIdentifier(beanIdentifier);
262            }
263    
264            /**
265            * Grants the role permission at the scope to perform the action on
266            * resources of the type. Existing actions are retained.
267            *
268            * <p>
269            * This method cannot be used to grant individual scope permissions, but is
270            * only intended for adding permissions at the company, group, and
271            * group-template scopes. For example, this method could be used to grant a
272            * company scope permission to edit message board posts.
273            * </p>
274            *
275            * <p>
276            * If a company scope permission is granted to resources that the role
277            * already had group scope permissions to, the group scope permissions are
278            * deleted. Likewise, if a group scope permission is granted to resources
279            * that the role already had company scope permissions to, the company scope
280            * permissions are deleted. Be aware that this latter behavior can result in
281            * an overall reduction in permissions for the role.
282            * </p>
283            *
284            * <p>
285            * Depending on the scope, the value of <code>primKey</code> will have
286            * different meanings. For more information, see {@link
287            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
288            * </p>
289            *
290            * @param companyId the primary key of the company
291            * @param name the resource's name, which can be either a class name or a
292            portlet ID
293            * @param scope the scope. This method only supports company, group, and
294            group-template scope.
295            * @param primKey the primary key
296            * @param roleId the primary key of the role
297            * @param actionId the action ID
298            * @throws PortalException if scope was set to individual scope or if a role
299            with the primary key or a resource action with the name and
300            action ID could not be found
301            * @throws SystemException if a system exception occurred
302            */
303            public static void addResourcePermission(long companyId,
304                    java.lang.String name, int scope, java.lang.String primKey,
305                    long roleId, java.lang.String actionId)
306                    throws com.liferay.portal.kernel.exception.PortalException,
307                            com.liferay.portal.kernel.exception.SystemException {
308                    getService()
309                            .addResourcePermission(companyId, name, scope, primKey, roleId,
310                            actionId);
311            }
312    
313            /**
314            * Grants the role permissions at the scope to perform the actions on all
315            * resources of the type. Existing actions are retained.
316            *
317            * <p>
318            * This method should only be used to add default permissions to existing
319            * resources en masse during upgrades or while verifying permissions. For
320            * example, this method could be used to grant site members individual scope
321            * permissions to view all blog posts.
322            * </p>
323            *
324            * @param resourceName the resource's name, which can be either a class
325            name or a portlet ID
326            * @param roleName the role's name
327            * @param scope the scope
328            * @param resourceActionBitwiseValue the bitwise IDs of the actions
329            * @throws SystemException if a system exception occurred
330            */
331            public static void addResourcePermissions(java.lang.String resourceName,
332                    java.lang.String roleName, int scope, long resourceActionBitwiseValue)
333                    throws com.liferay.portal.kernel.exception.SystemException {
334                    getService()
335                            .addResourcePermissions(resourceName, roleName, scope,
336                            resourceActionBitwiseValue);
337            }
338    
339            /**
340            * Deletes all resource permissions at the scope to resources of the type.
341            * This method should not be confused with any of the
342            * <code>removeResourcePermission</code> methods, as its purpose is very
343            * different. This method should only be used for deleting resource
344            * permissions that refer to a resource when that resource is deleted. For
345            * example this method could be used to delete all individual scope
346            * permissions to a blog post when it is deleted.
347            *
348            * <p>
349            * Depending on the scope, the value of <code>primKey</code> will have
350            * different meanings. For more information, see {@link
351            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
352            * </p>
353            *
354            * @param companyId the primary key of the company
355            * @param name the resource's name, which can be either a class name or a
356            portlet ID
357            * @param scope the scope
358            * @param primKey the primary key
359            * @throws PortalException if a portal exception occurred
360            * @throws SystemException if a system exception occurred
361            */
362            public static void deleteResourcePermissions(long companyId,
363                    java.lang.String name, int scope, long primKey)
364                    throws com.liferay.portal.kernel.exception.PortalException,
365                            com.liferay.portal.kernel.exception.SystemException {
366                    getService().deleteResourcePermissions(companyId, name, scope, primKey);
367            }
368    
369            /**
370            * Deletes all resource permissions at the scope to resources of the type.
371            * This method should not be confused with any of the
372            * <code>removeResourcePermission</code> methods, as its purpose is very
373            * different. This method should only be used for deleting resource
374            * permissions that refer to a resource when that resource is deleted. For
375            * example this method could be used to delete all individual scope
376            * permissions to a blog post when it is deleted.
377            *
378            * <p>
379            * Depending on the scope, the value of <code>primKey</code> will have
380            * different meanings. For more information, see {@link
381            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
382            * </p>
383            *
384            * @param companyId the primary key of the company
385            * @param name the resource's name, which can be either a class name or a
386            portlet ID
387            * @param scope the scope
388            * @param primKey the primary key
389            * @throws PortalException if a portal exception occurred
390            * @throws SystemException if a system exception occurred
391            */
392            public static void deleteResourcePermissions(long companyId,
393                    java.lang.String name, int scope, java.lang.String primKey)
394                    throws com.liferay.portal.kernel.exception.PortalException,
395                            com.liferay.portal.kernel.exception.SystemException {
396                    getService().deleteResourcePermissions(companyId, name, scope, primKey);
397            }
398    
399            /**
400            * Returns the intersection of action IDs the role has permission at the
401            * scope to perform on resources of the type.
402            *
403            * @param companyId he primary key of the company
404            * @param name the resource's name, which can be either a class name or a
405            portlet ID
406            * @param scope the scope
407            * @param primKey the primary key
408            * @param roleId the primary key of the role
409            * @param actionIds the action IDs
410            * @return the intersection of action IDs the role has permission at the
411            scope to perform on resources of the type
412            * @throws PortalException if a resouce action could not be found for any
413            one of the actions on the resource
414            * @throws SystemException if a system exception occurred
415            */
416            public static java.util.List<java.lang.String> getAvailableResourcePermissionActionIds(
417                    long companyId, java.lang.String name, int scope,
418                    java.lang.String primKey, long roleId,
419                    java.util.Collection<java.lang.String> actionIds)
420                    throws com.liferay.portal.kernel.exception.PortalException,
421                            com.liferay.portal.kernel.exception.SystemException {
422                    return getService()
423                                       .getAvailableResourcePermissionActionIds(companyId, name,
424                            scope, primKey, roleId, actionIds);
425            }
426    
427            public static java.util.Map<java.lang.Long, java.util.Set<java.lang.String>> getAvailableResourcePermissionActionIds(
428                    long companyId, java.lang.String name, int scope,
429                    java.lang.String primKey, long[] roleIds,
430                    java.util.Collection<java.lang.String> actionIds)
431                    throws com.liferay.portal.kernel.exception.PortalException,
432                            com.liferay.portal.kernel.exception.SystemException {
433                    return getService()
434                                       .getAvailableResourcePermissionActionIds(companyId, name,
435                            scope, primKey, roleIds, actionIds);
436            }
437    
438            /**
439            * Returns the resource permission for the role at the scope to perform the
440            * actions on resources of the type.
441            *
442            * @param companyId the primary key of the company
443            * @param name the resource's name, which can be either a class name or a
444            portlet ID
445            * @param scope the scope
446            * @param primKey the primary key
447            * @param roleId the primary key of the role
448            * @return the resource permission for the role at the scope to perform the
449            actions on resources of the type
450            * @throws PortalException if no matching resources could be found
451            * @throws SystemException if a system exception occurred
452            */
453            public static com.liferay.portal.model.ResourcePermission getResourcePermission(
454                    long companyId, java.lang.String name, int scope,
455                    java.lang.String primKey, long roleId)
456                    throws com.liferay.portal.kernel.exception.PortalException,
457                            com.liferay.portal.kernel.exception.SystemException {
458                    return getService()
459                                       .getResourcePermission(companyId, name, scope, primKey,
460                            roleId);
461            }
462    
463            /**
464            * Returns all the resource permissions at the scope of the type.
465            *
466            * @param companyId the primary key of the company
467            * @param name the resource's name, which can be either a class name or a
468            portlet ID
469            * @param scope the scope
470            * @param primKey the primary key
471            * @return the resource permissions at the scope of the type
472            * @throws SystemException if a system exception occurred
473            */
474            public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions(
475                    long companyId, java.lang.String name, int scope,
476                    java.lang.String primKey)
477                    throws com.liferay.portal.kernel.exception.SystemException {
478                    return getService()
479                                       .getResourcePermissions(companyId, name, scope, primKey);
480            }
481    
482            /**
483            * Returns the number of resource permissions at the scope of the type.
484            *
485            * @param companyId the primary key of the company
486            * @param name the resource's name, which can be either a class name or a
487            portlet ID
488            * @param scope the scope
489            * @param primKey the primary key
490            * @return the number of resource permissions at the scope of the type
491            * @throws SystemException if a system exception occurred
492            */
493            public static int getResourcePermissionsCount(long companyId,
494                    java.lang.String name, int scope, java.lang.String primKey)
495                    throws com.liferay.portal.kernel.exception.SystemException {
496                    return getService()
497                                       .getResourcePermissionsCount(companyId, name, scope, primKey);
498            }
499    
500            /**
501            * Returns the resource permissions that apply to the resource.
502            *
503            * @param companyId the primary key of the resource's company
504            * @param groupId the primary key of the resource's group
505            * @param name the resource's name, which can be either a class name or a
506            portlet ID
507            * @param primKey the primary key of the resource
508            * @return the resource permissions associated with the resource
509            * @throws SystemException if a system exception occurred
510            */
511            public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourceResourcePermissions(
512                    long companyId, long groupId, java.lang.String name,
513                    java.lang.String primKey)
514                    throws com.liferay.portal.kernel.exception.SystemException {
515                    return getService()
516                                       .getResourceResourcePermissions(companyId, groupId, name,
517                            primKey);
518            }
519    
520            /**
521            * Returns all the resource permissions for the role.
522            *
523            * @param roleId the primary key of the role
524            * @return the resource permissions for the role
525            * @throws SystemException if a system exception occurred
526            */
527            public static java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions(
528                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
529                    return getService().getRoleResourcePermissions(roleId);
530            }
531    
532            /**
533            * Returns a range of all the resource permissions for the role at the
534            * scopes.
535            *
536            * <p>
537            * Useful when paginating results. Returns a maximum of <code>end -
538            * start</code> instances. <code>start</code> and <code>end</code> are not
539            * primary keys, they are indexes in the result set. Thus, <code>0</code>
540            * refers to the first result in the set. Setting both <code>start</code>
541            * and <code>end</code> to {@link
542            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
543            * result set.
544            * </p>
545            *
546            * @param roleId the primary key of the role
547            * @param scopes the scopes
548            * @param start the lower bound of the range of results
549            * @param end the upper bound of the range of results (not inclusive)
550            * @return the range of resource permissions for the role at the scopes
551            * @throws SystemException if a system exception occurred
552            */
553            public static java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions(
554                    long roleId, int[] scopes, int start, int end)
555                    throws com.liferay.portal.kernel.exception.SystemException {
556                    return getService()
557                                       .getRoleResourcePermissions(roleId, scopes, start, end);
558            }
559    
560            /**
561            * Returns all the resource permissions where scope = any &#63;.
562            *
563            * <p>
564            * Useful when paginating results. Returns a maximum of <code>end -
565            * start</code> instances. <code>start</code> and <code>end</code> are not
566            * primary keys, they are indexes in the result set. Thus, <code>0</code>
567            * refers to the first result in the set. Setting both <code>start</code>
568            * and <code>end</code> to {@link
569            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
570            * result set.
571            * </p>
572            *
573            * @param scopes the scopes
574            * @return the resource permissions where scope = any &#63;
575            * @throws SystemException if a system exception occurred
576            */
577            public static java.util.List<com.liferay.portal.model.ResourcePermission> getScopeResourcePermissions(
578                    int[] scopes)
579                    throws com.liferay.portal.kernel.exception.SystemException {
580                    return getService().getScopeResourcePermissions(scopes);
581            }
582    
583            /**
584            * Returns <code>true</code> if the resource permission grants permission to
585            * perform the resource action. Note that this method does not ensure that
586            * the resource permission refers to the same type of resource as the
587            * resource action.
588            *
589            * @param resourcePermission the resource permission
590            * @param resourceAction the resource action
591            * @return <code>true</code> if the resource permission grants permission to
592            perform the resource action
593            */
594            public static boolean hasActionId(
595                    com.liferay.portal.model.ResourcePermission resourcePermission,
596                    com.liferay.portal.model.ResourceAction resourceAction) {
597                    return getService().hasActionId(resourcePermission, resourceAction);
598            }
599    
600            /**
601            * Returns <code>true</code> if the roles have permission at the scope to
602            * perform the action on the resources.
603            *
604            * <p>
605            * Depending on the scope, the value of <code>primKey</code> will have
606            * different meanings. For more information, see {@link
607            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
608            * </p>
609            *
610            * @param resources the resources
611            * @param roleIds the primary keys of the roles
612            * @param actionId the action ID
613            * @return <code>true</code> if any one of the roles has permission to
614            perform the action on any one of the resources;
615            <code>false</code> otherwise
616            * @throws PortalException if any one of the roles with the primary keys
617            could not be found or if a resource action with the name and
618            action ID could not be found
619            * @throws SystemException if a system exception occurred
620            */
621            public static boolean hasResourcePermission(
622                    java.util.List<com.liferay.portal.model.Resource> resources,
623                    long[] roleIds, java.lang.String actionId)
624                    throws com.liferay.portal.kernel.exception.PortalException,
625                            com.liferay.portal.kernel.exception.SystemException {
626                    return getService().hasResourcePermission(resources, roleIds, actionId);
627            }
628    
629            /**
630            * Returns <code>true</code> if the role has permission at the scope to
631            * perform the action on resources of the type.
632            *
633            * <p>
634            * Depending on the scope, the value of <code>primKey</code> will have
635            * different meanings. For more information, see {@link
636            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
637            * </p>
638            *
639            * @param companyId the primary key of the company
640            * @param name the resource's name, which can be either a class name or a
641            portlet ID
642            * @param scope the scope
643            * @param primKey the primary key
644            * @param roleId the primary key of the role
645            * @param actionId the action ID
646            * @return <code>true</code> if the role has permission to perform the
647            action on the resource; <code>false</code> otherwise
648            * @throws PortalException if a role with the primary key or a resource
649            action with the name and action ID could not be found
650            * @throws SystemException if a system exception occurred
651            */
652            public static boolean hasResourcePermission(long companyId,
653                    java.lang.String name, int scope, java.lang.String primKey,
654                    long roleId, java.lang.String actionId)
655                    throws com.liferay.portal.kernel.exception.PortalException,
656                            com.liferay.portal.kernel.exception.SystemException {
657                    return getService()
658                                       .hasResourcePermission(companyId, name, scope, primKey,
659                            roleId, actionId);
660            }
661    
662            /**
663            * Returns <code>true</code> if the roles have permission at the scope to
664            * perform the action on resources of the type.
665            *
666            * <p>
667            * Depending on the scope, the value of <code>primKey</code> will have
668            * different meanings. For more information, see {@link
669            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
670            * </p>
671            *
672            * @param companyId the primary key of the company
673            * @param name the resource's name, which can be either a class name or a
674            portlet ID
675            * @param scope the scope
676            * @param primKey the primary key
677            * @param roleIds the primary keys of the roles
678            * @param actionId the action ID
679            * @return <code>true</code> if any one of the roles has permission to
680            perform the action on the resource; <code>false</code> otherwise
681            * @throws PortalException if any one of the roles with the primary keys
682            could not be found or if a resource action with the name and
683            action ID could not be found
684            * @throws SystemException if a system exception occurred
685            */
686            public static boolean hasResourcePermission(long companyId,
687                    java.lang.String name, int scope, java.lang.String primKey,
688                    long[] roleIds, java.lang.String actionId)
689                    throws com.liferay.portal.kernel.exception.PortalException,
690                            com.liferay.portal.kernel.exception.SystemException {
691                    return getService()
692                                       .hasResourcePermission(companyId, name, scope, primKey,
693                            roleIds, actionId);
694            }
695    
696            public static boolean[] hasResourcePermissions(long companyId,
697                    java.lang.String name, int scope, java.lang.String primKey,
698                    long[] roleIds, java.lang.String actionId)
699                    throws com.liferay.portal.kernel.exception.PortalException,
700                            com.liferay.portal.kernel.exception.SystemException {
701                    return getService()
702                                       .hasResourcePermissions(companyId, name, scope, primKey,
703                            roleIds, actionId);
704            }
705    
706            /**
707            * Returns <code>true</code> if the role has permission at the scope to
708            * perform the action on the resource.
709            *
710            * <p>
711            * Depending on the scope, the value of <code>primKey</code> will have
712            * different meanings. For more information, see {@link
713            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
714            * </p>
715            *
716            * @param companyId the primary key of the company
717            * @param name the resource's name, which can be either a class name or a
718            portlet ID
719            * @param scope the scope
720            * @param roleId the primary key of the role
721            * @param actionId the action ID
722            * @return <code>true</code> if the role has permission to perform the
723            action on the resource; <code>false</code> otherwise
724            * @throws PortalException if a role with the primary key or a resource
725            action with the name and action ID could not be found
726            * @throws SystemException if a system exception occurred
727            */
728            public static boolean hasScopeResourcePermission(long companyId,
729                    java.lang.String name, int scope, long roleId, java.lang.String actionId)
730                    throws com.liferay.portal.kernel.exception.PortalException,
731                            com.liferay.portal.kernel.exception.SystemException {
732                    return getService()
733                                       .hasScopeResourcePermission(companyId, name, scope, roleId,
734                            actionId);
735            }
736    
737            /**
738            * Reassigns all the resource permissions from the source role to the
739            * destination role, and deletes the source role.
740            *
741            * @param fromRoleId the primary key of the source role
742            * @param toRoleId the primary key of the destination role
743            * @throws PortalException if a role with the primary key could not be found
744            * @throws SystemException if a system exception occurred
745            */
746            public static void mergePermissions(long fromRoleId, long toRoleId)
747                    throws com.liferay.portal.kernel.exception.PortalException,
748                            com.liferay.portal.kernel.exception.SystemException {
749                    getService().mergePermissions(fromRoleId, toRoleId);
750            }
751    
752            /**
753            * Grants the role default permissions to all the resources of the type and
754            * at the scope stored in the resource permission, deletes the resource
755            * permission, and deletes the resource permission's role if it has no
756            * permissions remaining.
757            *
758            * @param resourcePermissionId the primary key of the resource permission
759            * @param toRoleId the primary key of the role
760            * @throws PortalException if a resource permission or role with the primary
761            key could not be found
762            * @throws SystemException if a system exception occurred
763            */
764            public static void reassignPermissions(long resourcePermissionId,
765                    long toRoleId)
766                    throws com.liferay.portal.kernel.exception.PortalException,
767                            com.liferay.portal.kernel.exception.SystemException {
768                    getService().reassignPermissions(resourcePermissionId, toRoleId);
769            }
770    
771            /**
772            * Revokes permission at the scope from the role to perform the action on
773            * resources of the type. For example, this method could be used to revoke a
774            * group scope permission to edit blog posts.
775            *
776            * <p>
777            * Depending on the scope, the value of <code>primKey</code> will have
778            * different meanings. For more information, see {@link
779            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
780            * </p>
781            *
782            * @param companyId the primary key of the company
783            * @param name the resource's name, which can be either a class name or a
784            portlet ID
785            * @param scope the scope
786            * @param primKey the primary key
787            * @param roleId the primary key of the role
788            * @param actionId the action ID
789            * @throws PortalException if a role with the primary key or a resource
790            action with the name and action ID could not be found
791            * @throws SystemException if a system exception occurred
792            */
793            public static void removeResourcePermission(long companyId,
794                    java.lang.String name, int scope, java.lang.String primKey,
795                    long roleId, java.lang.String actionId)
796                    throws com.liferay.portal.kernel.exception.PortalException,
797                            com.liferay.portal.kernel.exception.SystemException {
798                    getService()
799                            .removeResourcePermission(companyId, name, scope, primKey, roleId,
800                            actionId);
801            }
802    
803            /**
804            * Revokes all permissions at the scope from the role to perform the action
805            * on resources of the type. For example, this method could be used to
806            * revoke all individual scope permissions to edit blog posts from site
807            * members.
808            *
809            * @param companyId the primary key of the company
810            * @param name the resource's name, which can be either a class name or a
811            portlet ID
812            * @param scope the scope
813            * @param roleId the primary key of the role
814            * @param actionId the action ID
815            * @throws PortalException if a role with the primary key or a resource
816            action with the name and action ID could not be found
817            * @throws SystemException if a system exception occurred
818            */
819            public static void removeResourcePermissions(long companyId,
820                    java.lang.String name, int scope, long roleId, java.lang.String actionId)
821                    throws com.liferay.portal.kernel.exception.PortalException,
822                            com.liferay.portal.kernel.exception.SystemException {
823                    getService()
824                            .removeResourcePermissions(companyId, name, scope, roleId, actionId);
825            }
826    
827            /**
828            * Updates the role's permissions at the scope, setting the actions that can
829            * be performed on resources of the type, also setting the owner of any
830            * newly created resource permissions. Existing actions are replaced.
831            *
832            * <p>
833            * This method can be used to set permissions at any scope, but it is
834            * generally only used at the individual scope. For example, it could be
835            * used to set the guest permissions on a blog post.
836            * </p>
837            *
838            * <p>
839            * Depending on the scope, the value of <code>primKey</code> will have
840            * different meanings. For more information, see {@link
841            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
842            * </p>
843            *
844            * @param companyId the primary key of the company
845            * @param name the resource's name, which can be either a class name or a
846            portlet ID
847            * @param scope the scope
848            * @param primKey the primary key
849            * @param roleId the primary key of the role
850            * @param ownerId the primary key of the owner (generally the user that
851            created the resource)
852            * @param actionIds the action IDs of the actions
853            * @throws PortalException if a role with the primary key or a resource
854            action with the name and action ID could not be found
855            * @throws SystemException if a system exception occurred
856            */
857            public static void setOwnerResourcePermissions(long companyId,
858                    java.lang.String name, int scope, java.lang.String primKey,
859                    long roleId, long ownerId, java.lang.String[] actionIds)
860                    throws com.liferay.portal.kernel.exception.PortalException,
861                            com.liferay.portal.kernel.exception.SystemException {
862                    getService()
863                            .setOwnerResourcePermissions(companyId, name, scope, primKey,
864                            roleId, ownerId, actionIds);
865            }
866    
867            /**
868            * Updates the role's permissions at the scope, setting the actions that can
869            * be performed on resources of the type. Existing actions are replaced.
870            *
871            * <p>
872            * This method can be used to set permissions at any scope, but it is
873            * generally only used at the individual scope. For example, it could be
874            * used to set the guest permissions on a blog post.
875            * </p>
876            *
877            * <p>
878            * Depending on the scope, the value of <code>primKey</code> will have
879            * different meanings. For more information, see {@link
880            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
881            * </p>
882            *
883            * @param companyId the primary key of the company
884            * @param name the resource's name, which can be either a class name or a
885            portlet ID
886            * @param scope the scope
887            * @param primKey the primary key
888            * @param roleId the primary key of the role
889            * @param actionIds the action IDs of the actions
890            * @throws PortalException if a role with the primary key or a resource
891            action with the name and action ID could not be found
892            * @throws SystemException if a system exception occurred
893            */
894            public static void setResourcePermissions(long companyId,
895                    java.lang.String name, int scope, java.lang.String primKey,
896                    long roleId, java.lang.String[] actionIds)
897                    throws com.liferay.portal.kernel.exception.PortalException,
898                            com.liferay.portal.kernel.exception.SystemException {
899                    getService()
900                            .setResourcePermissions(companyId, name, scope, primKey, roleId,
901                            actionIds);
902            }
903    
904            /**
905            * Updates the role's permissions at the scope, setting the actions that can
906            * be performed on resources of the type. Existing actions are replaced.
907            *
908            * <p>
909            * This method can be used to set permissions at any scope, but it is
910            * generally only used at the individual scope. For example, it could be
911            * used to set the guest permissions on a blog post.
912            * </p>
913            *
914            * <p>
915            * Depending on the scope, the value of <code>primKey</code> will have
916            * different meanings. For more information, see {@link
917            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
918            * </p>
919            *
920            * @param companyId the primary key of the company
921            * @param name the resource's name, which can be either a class name or a
922            portlet ID
923            * @param scope the scope
924            * @param primKey the primary key
925            * @param roleIdsToActionIds a map of role IDs to action IDs of the actions
926            * @throws PortalException if a role with the primary key or a resource
927            action with the name and action ID could not be found
928            * @throws SystemException if a system exception occurred
929            */
930            public static void setResourcePermissions(long companyId,
931                    java.lang.String name, int scope, java.lang.String primKey,
932                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds)
933                    throws com.liferay.portal.kernel.exception.PortalException,
934                            com.liferay.portal.kernel.exception.SystemException {
935                    getService()
936                            .setResourcePermissions(companyId, name, scope, primKey,
937                            roleIdsToActionIds);
938            }
939    
940            public static ResourcePermissionLocalService getService() {
941                    if (_service == null) {
942                            _service = (ResourcePermissionLocalService)PortalBeanLocatorUtil.locate(ResourcePermissionLocalService.class.getName());
943    
944                            ReferenceRegistry.registerReference(ResourcePermissionLocalServiceUtil.class,
945                                    "_service");
946                            MethodCache.remove(ResourcePermissionLocalService.class);
947                    }
948    
949                    return _service;
950            }
951    
952            public void setService(ResourcePermissionLocalService service) {
953                    MethodCache.remove(ResourcePermissionLocalService.class);
954    
955                    _service = service;
956    
957                    ReferenceRegistry.registerReference(ResourcePermissionLocalServiceUtil.class,
958                            "_service");
959                    MethodCache.remove(ResourcePermissionLocalService.class);
960            }
961    
962            private static ResourcePermissionLocalService _service;
963    }