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