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.exception.PortalException;
020    import com.liferay.portal.kernel.exception.SystemException;
021    import com.liferay.portal.kernel.transaction.Isolation;
022    import com.liferay.portal.kernel.transaction.Propagation;
023    import com.liferay.portal.kernel.transaction.Transactional;
024    
025    /**
026     * Provides the local service interface for Resource. Methods of this
027     * service will not have security checks based on the propagated JAAS
028     * credentials because this service can only be accessed from within the same
029     * VM.
030     *
031     * @author Brian Wing Shun Chan
032     * @see ResourceLocalServiceUtil
033     * @see com.liferay.portal.service.base.ResourceLocalServiceBaseImpl
034     * @see com.liferay.portal.service.impl.ResourceLocalServiceImpl
035     * @generated
036     */
037    @ProviderType
038    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
039            PortalException.class, SystemException.class})
040    public interface ResourceLocalService extends BaseLocalService {
041            /*
042             * NOTE FOR DEVELOPERS:
043             *
044             * Never modify or reference this interface directly. Always use {@link ResourceLocalServiceUtil} to access the resource local service. Add custom service methods to {@link com.liferay.portal.service.impl.ResourceLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
045             */
046    
047            /**
048            * Adds resources for the model, always creating a resource at the
049            * individual scope and only creating resources at the group, group
050            * template, and company scope if such resources don't already exist.
051            *
052            * <ol>
053            * <li>
054            * If the service context specifies that default group or default guest
055            * permissions are to be added, then only default permissions are added. See
056            * {@link ServiceContext#setAddGroupPermissions(
057            * boolean)} and {@link
058            * ServiceContext#setAddGuestPermissions(
059            * boolean)}.
060            * </li>
061            * <li>
062            * Else ...
063            * <ol>
064            * <li>
065            * If the service context specifies to derive default permissions, then
066            * default group and guest permissions are derived from the model and
067            * added. See {@link
068            * ServiceContext#setDeriveDefaultPermissions(
069            * boolean)}.
070            * </li>
071            * <li>
072            * Lastly group and guest permissions from the service
073            * context are applied. See {@link
074            * ServiceContext#setGroupPermissions(String[])}
075            * and {@link
076            * ServiceContext#setGuestPermissions(String[])}.
077            * </li>
078            * </ol>
079            *
080            * </li>
081            * </ol>
082            *
083            * @param auditedModel the model to associate with the resources
084            * @param serviceContext the service context to apply. Can set whether to
085            add the model's default group and guest permissions, set whether
086            to derive default group and guest permissions from the model, set
087            group permissions to apply, and set guest permissions to apply.
088            * @throws PortalException if no portal actions could be found associated
089            with the model or if a portal exception occurred
090            */
091            public void addModelResources(
092                    com.liferay.portal.model.AuditedModel auditedModel,
093                    com.liferay.portal.service.ServiceContext serviceContext)
094                    throws PortalException;
095    
096            /**
097            * Adds resources for the model with the name and primary key, always
098            * creating a resource at the individual scope and only creating resources
099            * at the group, group template, and company scope if such resources don't
100            * already exist.
101            *
102            * @param companyId the primary key of the portal instance
103            * @param groupId the primary key of the group
104            * @param userId the primary key of the user adding the resources
105            * @param name a name for the resource, typically the model's class name
106            * @param primKey the primary key of the model instance, optionally
107            <code>0</code> if no instance exists
108            * @param groupPermissions the group permissions to be applied
109            * @param guestPermissions the guest permissions to be applied
110            * @throws PortalException if no portal actions could be found associated
111            with the model or if a portal exception occurred
112            */
113            public void addModelResources(long companyId, long groupId, long userId,
114                    java.lang.String name, long primKey,
115                    java.lang.String[] groupPermissions, java.lang.String[] guestPermissions)
116                    throws PortalException;
117    
118            /**
119            * Adds resources for the model with the name and primary key string, always
120            * creating a resource at the individual scope and only creating resources
121            * at the group, group template, and company scope if such resources don't
122            * already exist.
123            *
124            * @param companyId the primary key of the portal instance
125            * @param groupId the primary key of the group
126            * @param userId the primary key of the user adding the resources
127            * @param name a name for the resource, typically the model's class name
128            * @param primKey the primary key string of the model instance, optionally
129            an empty string if no instance exists
130            * @param groupPermissions the group permissions to be applied
131            * @param guestPermissions the guest permissions to be applied
132            * @throws PortalException if no portal actions could be found associated
133            with the model or if a portal exception occurred
134            */
135            public void addModelResources(long companyId, long groupId, long userId,
136                    java.lang.String name, java.lang.String primKey,
137                    java.lang.String[] groupPermissions, java.lang.String[] guestPermissions)
138                    throws PortalException;
139    
140            public void addModelResources(long companyId, long groupId, long userId,
141                    java.lang.String name, long primKey,
142                    com.liferay.portal.service.permission.ModelPermissions modelPermissions)
143                    throws PortalException;
144    
145            public void addModelResources(long companyId, long groupId, long userId,
146                    java.lang.String name, java.lang.String primKey,
147                    com.liferay.portal.service.permission.ModelPermissions modelPermissions)
148                    throws PortalException;
149    
150            /**
151            * Adds resources for the entity with the name. Use this method if the user
152            * is unknown or irrelevant and there is no current entity instance.
153            *
154            * @param companyId the primary key of the portal instance
155            * @param groupId the primary key of the group
156            * @param name a name for the resource, which should be a portlet ID if the
157            resource is a portlet or the resource's class name otherwise
158            * @param portletActions whether to associate portlet actions with the
159            resource
160            * @throws PortalException if no portal actions could be found associated
161            with the resource or if a portal exception occurred
162            */
163            public void addResources(long companyId, long groupId,
164                    java.lang.String name, boolean portletActions)
165                    throws PortalException;
166    
167            /**
168            * Adds resources for the entity with the name and primary key string,
169            * always creating a resource at the individual scope and only creating
170            * resources at the group, group template, and company scope if such
171            * resources don't already exist.
172            *
173            * @param companyId the primary key of the portal instance
174            * @param groupId the primary key of the group
175            * @param userId the primary key of the user adding the resources
176            * @param name a name for the resource, which should be a portlet ID if the
177            resource is a portlet or the resource's class name otherwise
178            * @param primKey the primary key string of the resource instance,
179            optionally an empty string if no instance exists
180            * @param portletActions whether to associate portlet actions with the
181            resource
182            * @param addGroupPermissions whether to add group permissions
183            * @param addGuestPermissions whether to add guest permissions
184            * @throws PortalException if no portal actions could be found associated
185            with the resource or if a portal exception occurred
186            */
187            public void addResources(long companyId, long groupId, long userId,
188                    java.lang.String name, java.lang.String primKey,
189                    boolean portletActions, boolean addGroupPermissions,
190                    boolean addGuestPermissions) throws PortalException;
191    
192            /**
193            * Adds resources for the entity with the name and primary key, always
194            * creating a resource at the individual scope and only creating resources
195            * at the group, group template, and company scope if such resources don't
196            * already exist.
197            *
198            * @param companyId the primary key of the portal instance
199            * @param groupId the primary key of the group
200            * @param userId the primary key of the user adding the resources
201            * @param name a name for the resource, which should be a portlet ID if the
202            resource is a portlet or the resource's class name otherwise
203            * @param primKey the primary key of the resource instance, optionally
204            <code>0</code> if no instance exists
205            * @param portletActions whether to associate portlet actions with the
206            resource
207            * @param addGroupPermissions whether to add group permissions
208            * @param addGuestPermissions whether to add guest permissions
209            * @throws PortalException if no portal actions could be found associated
210            with the resource or if a portal exception occurred
211            */
212            public void addResources(long companyId, long groupId, long userId,
213                    java.lang.String name, long primKey, boolean portletActions,
214                    boolean addGroupPermissions, boolean addGuestPermissions)
215                    throws PortalException;
216    
217            /**
218            * Deletes the resource associated with the model at the scope.
219            *
220            * @param auditedModel the model associated with the resource
221            * @param scope the scope of the resource. For more information see {@link
222            ResourceConstants}.
223            * @throws PortalException if a portal exception occurred
224            */
225            public void deleteResource(
226                    com.liferay.portal.model.AuditedModel auditedModel, int scope)
227                    throws PortalException;
228    
229            /**
230            * Deletes the resource matching the primary key at the scope.
231            *
232            * @param companyId the primary key of the portal instance
233            * @param name the resource's name, which should be a portlet ID if the
234            resource is a portlet or the resource's class name otherwise
235            * @param scope the scope of the resource. For more information see {@link
236            ResourceConstants}.
237            * @param primKey the primary key of the resource instance
238            * @throws PortalException if a portal exception occurred
239            */
240            public void deleteResource(long companyId, java.lang.String name,
241                    int scope, long primKey) throws PortalException;
242    
243            /**
244            * Deletes the resource matching the primary key at the scope.
245            *
246            * @param companyId the primary key of the portal instance
247            * @param name the resource's name, which should be a portlet ID if the
248            resource is a portlet or the resource's class name otherwise
249            * @param scope the scope of the resource. For more information see {@link
250            ResourceConstants}.
251            * @param primKey the primary key string of the resource instance
252            * @throws PortalException if a portal exception occurred
253            */
254            public void deleteResource(long companyId, java.lang.String name,
255                    int scope, java.lang.String primKey) throws PortalException;
256    
257            /**
258            * Returns the Spring bean ID for this bean.
259            *
260            * @return the Spring bean ID for this bean
261            */
262            public java.lang.String getBeanIdentifier();
263    
264            /**
265            * Returns a new resource with the name and primary key at the scope.
266            *
267            * @param companyId the primary key of the portal instance
268            * @param name a name for the resource, which should be a portlet ID if the
269            resource is a portlet or the resource's class name otherwise
270            * @param scope the scope of the resource. For more information see {@link
271            ResourceConstants}.
272            * @param primKey the primary key string of the resource
273            * @return the new resource
274            */
275            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
276            public com.liferay.portal.model.Resource getResource(long companyId,
277                    java.lang.String name, int scope, java.lang.String primKey);
278    
279            /**
280            * Returns <code>true</code> if the roles have permission to perform the
281            * action on the resources.
282            *
283            * @param userId the primary key of the user performing the permission
284            check
285            * @param resourceId the primary key of the resource, typically the scope
286            group ID representing the scope in which the permission check is
287            being performed
288            * @param resources the resources for which permissions are to be checked
289            * @param actionId the primary key of the action to be performed on the
290            resources
291            * @param roleIds the primary keys of the roles
292            * @return <code>true</code> if the roles have permission to perform the
293            action on the resources;<code>false</code> otherwise
294            * @throws PortalException if any one of the roles with the primary keys
295            could not be found or if a resource action with the action ID
296            could not be found
297            */
298            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
299            public boolean hasUserPermissions(long userId, long resourceId,
300                    java.util.List<com.liferay.portal.model.Resource> resources,
301                    java.lang.String actionId, long[] roleIds) throws PortalException;
302    
303            /**
304            * Sets the Spring bean ID for this bean.
305            *
306            * @param beanIdentifier the Spring bean ID for this bean
307            */
308            public void setBeanIdentifier(java.lang.String beanIdentifier);
309    
310            /**
311            * Updates the resources for the model, replacing their group and guest
312            * permissions with new ones from the service context.
313            *
314            * @param auditedModel the model associated with the resources
315            * @param serviceContext the service context to be applied. Can set group
316            and guest permissions.
317            * @throws PortalException if a portal exception occurred
318            */
319            public void updateModelResources(
320                    com.liferay.portal.model.AuditedModel auditedModel,
321                    com.liferay.portal.service.ServiceContext serviceContext)
322                    throws PortalException;
323    
324            /**
325            * Updates resources matching the group, name, and primary key string at the
326            * individual scope, setting new group and guest permissions.
327            *
328            * @param companyId the primary key of the portal instance
329            * @param groupId the primary key of the group
330            * @param name the resource's name, which should be a portlet ID if the
331            resource is a portlet or the resource's class name otherwise
332            * @param primKey the primary key string of the resource instance
333            * @param groupPermissions the group permissions to be applied
334            * @param guestPermissions the guest permissions to be applied
335            * @throws PortalException if a portal exception occurred
336            */
337            public void updateResources(long companyId, long groupId,
338                    java.lang.String name, java.lang.String primKey,
339                    java.lang.String[] groupPermissions, java.lang.String[] guestPermissions)
340                    throws PortalException;
341    
342            /**
343            * Updates resources matching the group, name, and primary key at the
344            * individual scope, setting new group and guest permissions.
345            *
346            * @param companyId the primary key of the portal instance
347            * @param groupId the primary key of the group
348            * @param name the resource's name, which should be a portlet ID if the
349            resource is a portlet or the resource's class name otherwise
350            * @param primKey the primary key of the resource instance
351            * @param groupPermissions the group permissions to be applied
352            * @param guestPermissions the guest permissions to be applied
353            * @throws PortalException if a portal exception occurred
354            */
355            public void updateResources(long companyId, long groupId,
356                    java.lang.String name, long primKey,
357                    java.lang.String[] groupPermissions, java.lang.String[] guestPermissions)
358                    throws PortalException;
359    
360            /**
361            * Updates resources matching the group, name, and primary key at the
362            * individual scope, setting new permissions.
363            *
364            * @param companyId the primary key of the portal instance
365            * @param groupId the primary key of the group
366            * @param name the resource's name, which should be a portlet ID if the
367            resource is a portlet or the resource's class name otherwise
368            * @param primKey the primary key of the resource instance
369            * @param modelPermissions the model permissions to be applied
370            * @throws PortalException if a portal exception occurred
371            */
372            public void updateResources(long companyId, long groupId,
373                    java.lang.String name, long primKey,
374                    com.liferay.portal.service.permission.ModelPermissions modelPermissions)
375                    throws PortalException;
376    
377            /**
378            * Updates resources matching the group, name, and primary key string at the
379            * individual scope, setting new permissions.
380            *
381            * @param companyId the primary key of the portal instance
382            * @param groupId the primary key of the group
383            * @param name the resource's name, which should be a portlet ID if the
384            resource is a portlet or the resource's class name otherwise
385            * @param primKey the primary key string of the resource instance
386            * @param modelPermissions the model permissions to be applied
387            * @throws PortalException if a portal exception occurred
388            */
389            public void updateResources(long companyId, long groupId,
390                    java.lang.String name, java.lang.String primKey,
391                    com.liferay.portal.service.permission.ModelPermissions modelPermissions)
392                    throws PortalException;
393    
394            /**
395            * Updates resources matching the name, primary key string and scope,
396            * replacing the primary key of their resource permissions with the new
397            * primary key.
398            *
399            * @param companyId the primary key of the portal instance
400            * @param name the resource's name, which should be a portlet ID if the
401            resource is a portlet or the resource's class name otherwise
402            * @param scope the scope of the resource. For more information see {@link
403            ResourceConstants}.
404            * @param primKey the primary key string of the resource instance
405            * @param newPrimKey the new primary key string of the resource
406            */
407            public void updateResources(long companyId, java.lang.String name,
408                    int scope, java.lang.String primKey, java.lang.String newPrimKey);
409    }