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