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