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