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.security.permission.ResourceBlockIdsBag;
028    import com.liferay.portal.kernel.transaction.Isolation;
029    import com.liferay.portal.kernel.transaction.Propagation;
030    import com.liferay.portal.kernel.transaction.Transactional;
031    import com.liferay.portal.kernel.util.OrderByComparator;
032    import com.liferay.portal.model.PermissionedModel;
033    import com.liferay.portal.model.PersistedModel;
034    import com.liferay.portal.model.ResourceBlock;
035    import com.liferay.portal.model.ResourceBlockPermissionsContainer;
036    import com.liferay.portal.model.Role;
037    
038    import java.io.Serializable;
039    
040    import java.util.List;
041    import java.util.Map;
042    
043    /**
044     * Provides the local service interface for ResourceBlock. Methods of this
045     * service will not have security checks based on the propagated JAAS
046     * credentials because this service can only be accessed from within the same
047     * VM.
048     *
049     * @author Brian Wing Shun Chan
050     * @see ResourceBlockLocalServiceUtil
051     * @see com.liferay.portal.service.base.ResourceBlockLocalServiceBaseImpl
052     * @see com.liferay.portal.service.impl.ResourceBlockLocalServiceImpl
053     * @generated
054     */
055    @ProviderType
056    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
057            PortalException.class, SystemException.class})
058    public interface ResourceBlockLocalService extends BaseLocalService,
059            PermissionedModelLocalService {
060            /*
061             * NOTE FOR DEVELOPERS:
062             *
063             * Never modify or reference this interface directly. Always use {@link ResourceBlockLocalServiceUtil} to access the resource block local service. Add custom service methods to {@link com.liferay.portal.service.impl.ResourceBlockLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
064             */
065            public void addCompanyScopePermission(long companyId,
066                    java.lang.String name, long roleId, java.lang.String actionId)
067                    throws PortalException;
068    
069            public void addCompanyScopePermissions(long companyId,
070                    java.lang.String name, long roleId, long actionIdsLong);
071    
072            public void addGroupScopePermission(long companyId, long groupId,
073                    java.lang.String name, long roleId, java.lang.String actionId)
074                    throws PortalException;
075    
076            public void addGroupScopePermissions(long companyId, long groupId,
077                    java.lang.String name, long roleId, long actionIdsLong);
078    
079            public void addIndividualScopePermission(long companyId, long groupId,
080                    java.lang.String name, PermissionedModel permissionedModel,
081                    long roleId, java.lang.String actionId) throws PortalException;
082    
083            public void addIndividualScopePermission(long companyId, long groupId,
084                    java.lang.String name, long primKey, long roleId,
085                    java.lang.String actionId) throws PortalException;
086    
087            public void addIndividualScopePermissions(long companyId, long groupId,
088                    java.lang.String name, PermissionedModel permissionedModel,
089                    long roleId, long actionIdsLong);
090    
091            public void addIndividualScopePermissions(long companyId, long groupId,
092                    java.lang.String name, long primKey, long roleId, long actionIdsLong)
093                    throws PortalException;
094    
095            /**
096            * Adds a resource block if necessary and associates the resource block
097            * permissions with it. The resource block will have an initial reference
098            * count of one.
099            *
100            * @param companyId the primary key of the resource block's company
101            * @param groupId the primary key of the resource block's group
102            * @param name the resource block's name
103            * @param permissionsHash the resource block's permission hash
104            * @param resourceBlockPermissionsContainer the resource block's
105            permissions container
106            * @return the new resource block
107            */
108            public ResourceBlock addResourceBlock(long companyId, long groupId,
109                    java.lang.String name, java.lang.String permissionsHash,
110                    ResourceBlockPermissionsContainer resourceBlockPermissionsContainer);
111    
112            /**
113            * Adds the resource block to the database. Also notifies the appropriate model listeners.
114            *
115            * @param resourceBlock the resource block
116            * @return the resource block that was added
117            */
118            @Indexable(type = IndexableType.REINDEX)
119            public ResourceBlock addResourceBlock(ResourceBlock resourceBlock);
120    
121            /**
122            * Creates a new resource block with the primary key. Does not add the resource block to the database.
123            *
124            * @param resourceBlockId the primary key for the new resource block
125            * @return the new resource block
126            */
127            public ResourceBlock createResourceBlock(long resourceBlockId);
128    
129            /**
130            * @throws PortalException
131            */
132            @Override
133            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
134                    throws PortalException;
135    
136            /**
137            * Deletes the resource block from the database. Also notifies the appropriate model listeners.
138            *
139            * @param resourceBlock the resource block
140            * @return the resource block that was removed
141            */
142            @Indexable(type = IndexableType.DELETE)
143            public ResourceBlock deleteResourceBlock(ResourceBlock resourceBlock);
144    
145            /**
146            * Deletes the resource block with the primary key from the database. Also notifies the appropriate model listeners.
147            *
148            * @param resourceBlockId the primary key of the resource block
149            * @return the resource block that was removed
150            * @throws PortalException if a resource block with the primary key could not be found
151            */
152            @Indexable(type = IndexableType.DELETE)
153            public ResourceBlock deleteResourceBlock(long resourceBlockId)
154                    throws PortalException;
155    
156            public DynamicQuery dynamicQuery();
157    
158            /**
159            * Performs a dynamic query on the database and returns the matching rows.
160            *
161            * @param dynamicQuery the dynamic query
162            * @return the matching rows
163            */
164            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
165    
166            /**
167            * Performs a dynamic query on the database and returns a range of the matching rows.
168            *
169            * <p>
170            * 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.ResourceBlockModelImpl}. 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.
171            * </p>
172            *
173            * @param dynamicQuery the dynamic query
174            * @param start the lower bound of the range of model instances
175            * @param end the upper bound of the range of model instances (not inclusive)
176            * @return the range of matching rows
177            */
178            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
179                    int end);
180    
181            /**
182            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
183            *
184            * <p>
185            * 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.ResourceBlockModelImpl}. 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.
186            * </p>
187            *
188            * @param dynamicQuery the dynamic query
189            * @param start the lower bound of the range of model instances
190            * @param end the upper bound of the range of model instances (not inclusive)
191            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
192            * @return the ordered range of matching rows
193            */
194            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
195                    int end, OrderByComparator<T> orderByComparator);
196    
197            /**
198            * Returns the number of rows matching the dynamic query.
199            *
200            * @param dynamicQuery the dynamic query
201            * @return the number of rows matching the dynamic query
202            */
203            public long dynamicQueryCount(DynamicQuery dynamicQuery);
204    
205            /**
206            * Returns the number of rows matching the dynamic query.
207            *
208            * @param dynamicQuery the dynamic query
209            * @param projection the projection to apply to the query
210            * @return the number of rows matching the dynamic query
211            */
212            public long dynamicQueryCount(DynamicQuery dynamicQuery,
213                    Projection projection);
214    
215            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
216            public ResourceBlock fetchResourceBlock(long resourceBlockId);
217    
218            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
219            public long getActionId(java.lang.String name, java.lang.String actionId)
220                    throws PortalException;
221    
222            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
223            public long getActionIds(java.lang.String name,
224                    List<java.lang.String> actionIds) throws PortalException;
225    
226            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
227            public List<java.lang.String> getActionIds(java.lang.String name,
228                    long actionIdsLong);
229    
230            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
231            public ActionableDynamicQuery getActionableDynamicQuery();
232    
233            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
234            public List<java.lang.String> getCompanyScopePermissions(
235                    ResourceBlock resourceBlock, long roleId);
236    
237            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
238            public List<java.lang.String> getGroupScopePermissions(
239                    ResourceBlock resourceBlock, long roleId);
240    
241            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
242            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
243    
244            /**
245            * Returns the OSGi service identifier.
246            *
247            * @return the OSGi service identifier
248            */
249            public java.lang.String getOSGiServiceIdentifier();
250    
251            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
252            public PermissionedModel getPermissionedModel(java.lang.String name,
253                    long primKey) throws PortalException;
254    
255            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
256            public List<java.lang.String> getPermissions(ResourceBlock resourceBlock,
257                    long roleId);
258    
259            @Override
260            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
261            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
262                    throws PortalException;
263    
264            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
265            public ResourceBlock getResourceBlock(java.lang.String name, long primKey)
266                    throws PortalException;
267    
268            /**
269            * Returns the resource block with the primary key.
270            *
271            * @param resourceBlockId the primary key of the resource block
272            * @return the resource block
273            * @throws PortalException if a resource block with the primary key could not be found
274            */
275            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
276            public ResourceBlock getResourceBlock(long resourceBlockId)
277                    throws PortalException;
278    
279            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
280            public List<java.lang.Long> getResourceBlockIds(
281                    ResourceBlockIdsBag resourceBlockIdsBag, java.lang.String name,
282                    java.lang.String actionId) throws PortalException;
283    
284            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
285            public ResourceBlockIdsBag getResourceBlockIdsBag(long companyId,
286                    long groupId, java.lang.String name, long[] roleIds);
287    
288            /**
289            * Returns a range of all the resource blocks.
290            *
291            * <p>
292            * 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.ResourceBlockModelImpl}. 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.
293            * </p>
294            *
295            * @param start the lower bound of the range of resource blocks
296            * @param end the upper bound of the range of resource blocks (not inclusive)
297            * @return the range of resource blocks
298            */
299            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
300            public List<ResourceBlock> getResourceBlocks(int start, int end);
301    
302            /**
303            * Returns the number of resource blocks.
304            *
305            * @return the number of resource blocks
306            */
307            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
308            public int getResourceBlocksCount();
309    
310            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
311            public List<Role> getRoles(java.lang.String name, long primKey,
312                    java.lang.String actionId) throws PortalException;
313    
314            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
315            public boolean hasPermission(java.lang.String name,
316                    PermissionedModel permissionedModel, java.lang.String actionId,
317                    ResourceBlockIdsBag resourceBlockIdsBag) throws PortalException;
318    
319            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
320            public boolean hasPermission(java.lang.String name, long primKey,
321                    java.lang.String actionId, ResourceBlockIdsBag resourceBlockIdsBag)
322                    throws PortalException;
323    
324            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
325            public boolean isSupported(java.lang.String name);
326    
327            public void releasePermissionedModelResourceBlock(java.lang.String name,
328                    long primKey) throws PortalException;
329    
330            @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
331            public void releasePermissionedModelResourceBlock(
332                    PermissionedModel permissionedModel);
333    
334            /**
335            * Decrements the reference count of the resource block and updates it in
336            * the database or deletes the resource block if the reference count reaches
337            * zero.
338            *
339            * @param resourceBlock the resource block
340            */
341            @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
342            public void releaseResourceBlock(ResourceBlock resourceBlock);
343    
344            /**
345            * Decrements the reference count of the resource block and updates it in
346            * the database or deletes the resource block if the reference count reaches
347            * zero.
348            *
349            * @param resourceBlockId the primary key of the resource block
350            */
351            @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
352            public void releaseResourceBlock(long resourceBlockId);
353    
354            public void removeAllGroupScopePermissions(long companyId,
355                    java.lang.String name, long roleId, java.lang.String actionId)
356                    throws PortalException;
357    
358            public void removeAllGroupScopePermissions(long companyId,
359                    java.lang.String name, long roleId, long actionIdsLong);
360    
361            public void removeCompanyScopePermission(long companyId,
362                    java.lang.String name, long roleId, java.lang.String actionId)
363                    throws PortalException;
364    
365            public void removeCompanyScopePermissions(long companyId,
366                    java.lang.String name, long roleId, long actionIdsLong);
367    
368            public void removeGroupScopePermission(long companyId, long groupId,
369                    java.lang.String name, long roleId, java.lang.String actionId)
370                    throws PortalException;
371    
372            public void removeGroupScopePermissions(long companyId, long groupId,
373                    java.lang.String name, long roleId, long actionIdsLong);
374    
375            public void removeIndividualScopePermission(long companyId, long groupId,
376                    java.lang.String name, PermissionedModel permissionedModel,
377                    long roleId, java.lang.String actionId) throws PortalException;
378    
379            public void removeIndividualScopePermission(long companyId, long groupId,
380                    java.lang.String name, long primKey, long roleId,
381                    java.lang.String actionId) throws PortalException;
382    
383            public void removeIndividualScopePermissions(long companyId, long groupId,
384                    java.lang.String name, PermissionedModel permissionedModel,
385                    long roleId, long actionIdsLong);
386    
387            public void removeIndividualScopePermissions(long companyId, long groupId,
388                    java.lang.String name, long primKey, long roleId, long actionIdsLong)
389                    throws PortalException;
390    
391            public void setCompanyScopePermissions(long companyId,
392                    java.lang.String name, long roleId, List<java.lang.String> actionIds)
393                    throws PortalException;
394    
395            public void setCompanyScopePermissions(long companyId,
396                    java.lang.String name, long roleId, long actionIdsLong);
397    
398            public void setGroupScopePermissions(long companyId, long groupId,
399                    java.lang.String name, long roleId, List<java.lang.String> actionIds)
400                    throws PortalException;
401    
402            public void setGroupScopePermissions(long companyId, long groupId,
403                    java.lang.String name, long roleId, long actionIdsLong);
404    
405            public void setIndividualScopePermissions(long companyId, long groupId,
406                    java.lang.String name, PermissionedModel permissionedModel,
407                    long roleId, List<java.lang.String> actionIds)
408                    throws PortalException;
409    
410            public void setIndividualScopePermissions(long companyId, long groupId,
411                    java.lang.String name, PermissionedModel permissionedModel,
412                    long roleId, long actionIdsLong);
413    
414            public void setIndividualScopePermissions(long companyId, long groupId,
415                    java.lang.String name, long primKey, long roleId,
416                    List<java.lang.String> actionIds) throws PortalException;
417    
418            public void setIndividualScopePermissions(long companyId, long groupId,
419                    java.lang.String name, long primKey, long roleId, long actionIdsLong)
420                    throws PortalException;
421    
422            public void setIndividualScopePermissions(long companyId, long groupId,
423                    java.lang.String name, long primKey,
424                    Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds)
425                    throws PortalException;
426    
427            public void updateCompanyScopePermissions(long companyId,
428                    java.lang.String name, long roleId, long actionIdsLong, int operator);
429    
430            public void updateGroupScopePermissions(long companyId, long groupId,
431                    java.lang.String name, long roleId, long actionIdsLong, int operator);
432    
433            public void updateIndividualScopePermissions(long companyId, long groupId,
434                    java.lang.String name, PermissionedModel permissionedModel,
435                    long roleId, long actionIdsLong, int operator);
436    
437            /**
438            * Updates the resource block in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
439            *
440            * @param resourceBlock the resource block
441            * @return the resource block that was updated
442            */
443            @Indexable(type = IndexableType.REINDEX)
444            public ResourceBlock updateResourceBlock(ResourceBlock resourceBlock);
445    
446            @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
447            public ResourceBlock updateResourceBlockId(long companyId, long groupId,
448                    java.lang.String name, PermissionedModel permissionedModel,
449                    java.lang.String permissionsHash,
450                    ResourceBlockPermissionsContainer resourceBlockPermissionsContainer);
451    
452            public void verifyResourceBlockId(long companyId, java.lang.String name,
453                    long primKey) throws PortalException;
454    }