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 com.liferay.portal.service.ServiceContext#setAddGroupPermissions(
057            * boolean)} and {@link
058            * com.liferay.portal.service.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            * com.liferay.portal.service.ServiceContext#setDeriveDefaultPermissions(
069            * boolean)}.
070            * </li>
071            * <li>
072            * Lastly group and guest permissions from the service
073            * context are applied. See {@link
074            * com.liferay.portal.service.ServiceContext#setGroupPermissions(String[])}
075            * and {@link
076            * com.liferay.portal.service.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            /**
141            * Adds resources for the entity with the name. Use this method if the user
142            * is unknown or irrelevant and there is no current entity instance.
143            *
144            * @param companyId the primary key of the portal instance
145            * @param groupId the primary key of the group
146            * @param name a name for the resource, which should be a portlet ID if the
147            resource is a portlet or the resource's class name otherwise
148            * @param portletActions whether to associate portlet actions with the
149            resource
150            * @throws PortalException if no portal actions could be found associated
151            with the resource or if a portal exception occurred
152            */
153            public void addResources(long companyId, long groupId,
154                    java.lang.String name, boolean portletActions)
155                    throws PortalException;
156    
157            /**
158            * Adds resources for the entity with the name and primary key string,
159            * always creating a resource at the individual scope and only creating
160            * resources at the group, group template, and company scope if such
161            * resources don't already exist.
162            *
163            * @param companyId the primary key of the portal instance
164            * @param groupId the primary key of the group
165            * @param userId the primary key of the user adding the resources
166            * @param name a name for the resource, which should be a portlet ID if the
167            resource is a portlet or the resource's class name otherwise
168            * @param primKey the primary key string of the resource instance,
169            optionally an empty string if no instance exists
170            * @param portletActions whether to associate portlet actions with the
171            resource
172            * @param addGroupPermissions whether to add group permissions
173            * @param addGuestPermissions whether to add guest permissions
174            * @throws PortalException if no portal actions could be found associated
175            with the resource or if a portal exception occurred
176            */
177            public void addResources(long companyId, long groupId, long userId,
178                    java.lang.String name, java.lang.String primKey,
179                    boolean portletActions, boolean addGroupPermissions,
180                    boolean addGuestPermissions) throws PortalException;
181    
182            /**
183            * Adds resources for the entity with the name and primary key, always
184            * creating a resource at the individual scope and only creating resources
185            * at the group, group template, and company scope if such resources don't
186            * already exist.
187            *
188            * @param companyId the primary key of the portal instance
189            * @param groupId the primary key of the group
190            * @param userId the primary key of the user adding the resources
191            * @param name a name for the resource, which should be a portlet ID if the
192            resource is a portlet or the resource's class name otherwise
193            * @param primKey the primary key of the resource instance, optionally
194            <code>0</code> if no instance exists
195            * @param portletActions whether to associate portlet actions with the
196            resource
197            * @param addGroupPermissions whether to add group permissions
198            * @param addGuestPermissions whether to add guest permissions
199            * @throws PortalException if no portal actions could be found associated
200            with the resource or if a portal exception occurred
201            */
202            public void addResources(long companyId, long groupId, long userId,
203                    java.lang.String name, long primKey, boolean portletActions,
204                    boolean addGroupPermissions, boolean addGuestPermissions)
205                    throws PortalException;
206    
207            /**
208            * Deletes the resource associated with the model at the scope.
209            *
210            * @param auditedModel the model associated with the resource
211            * @param scope the scope of the resource. For more information see {@link
212            com.liferay.portal.model.ResourceConstants}.
213            * @throws PortalException if a portal exception occurred
214            */
215            public void deleteResource(
216                    com.liferay.portal.model.AuditedModel auditedModel, int scope)
217                    throws PortalException;
218    
219            /**
220            * Deletes the resource matching the primary key at the scope.
221            *
222            * @param companyId the primary key of the portal instance
223            * @param name the resource's name, which should be a portlet ID if the
224            resource is a portlet or the resource's class name otherwise
225            * @param scope the scope of the resource. For more information see {@link
226            com.liferay.portal.model.ResourceConstants}.
227            * @param primKey the primary key of the resource instance
228            * @throws PortalException if a portal exception occurred
229            */
230            public void deleteResource(long companyId, java.lang.String name,
231                    int scope, long primKey) throws PortalException;
232    
233            /**
234            * Deletes the resource matching the primary key at the scope.
235            *
236            * @param companyId the primary key of the portal instance
237            * @param name the resource's name, which should be a portlet ID if the
238            resource is a portlet or the resource's class name otherwise
239            * @param scope the scope of the resource. For more information see {@link
240            com.liferay.portal.model.ResourceConstants}.
241            * @param primKey the primary key string of the resource instance
242            * @throws PortalException if a portal exception occurred
243            */
244            public void deleteResource(long companyId, java.lang.String name,
245                    int scope, java.lang.String primKey) throws PortalException;
246    
247            /**
248            * Returns the Spring bean ID for this bean.
249            *
250            * @return the Spring bean ID for this bean
251            */
252            public java.lang.String getBeanIdentifier();
253    
254            /**
255            * Returns a new resource with the name and primary key at the scope.
256            *
257            * @param companyId the primary key of the portal instance
258            * @param name a name for the resource, which should be a portlet ID if the
259            resource is a portlet or the resource's class name otherwise
260            * @param scope the scope of the resource. For more information see {@link
261            com.liferay.portal.model.ResourceConstants}.
262            * @param primKey the primary key string of the resource
263            * @return the new resource
264            */
265            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
266            public com.liferay.portal.model.Resource getResource(long companyId,
267                    java.lang.String name, int scope, java.lang.String primKey);
268    
269            /**
270            * Returns <code>true</code> if the roles have permission to perform the
271            * action on the resources.
272            *
273            * @param userId the primary key of the user performing the permission
274            check
275            * @param resourceId the primary key of the resource, typically the scope
276            group ID representing the scope in which the permission check is
277            being performed
278            * @param resources the resources for which permissions are to be checked
279            * @param actionId the primary key of the action to be performed on the
280            resources
281            * @param roleIds the primary keys of the roles
282            * @return <code>true</code> if the roles have permission to perform the
283            action on the resources;<code>false</code> otherwise
284            * @throws PortalException if any one of the roles with the primary keys
285            could not be found or if a resource action with the action ID
286            could not be found
287            */
288            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
289            public boolean hasUserPermissions(long userId, long resourceId,
290                    java.util.List<com.liferay.portal.model.Resource> resources,
291                    java.lang.String actionId, long[] roleIds) throws PortalException;
292    
293            /**
294            * Sets the Spring bean ID for this bean.
295            *
296            * @param beanIdentifier the Spring bean ID for this bean
297            */
298            public void setBeanIdentifier(java.lang.String beanIdentifier);
299    
300            /**
301            * Updates the resources for the model, replacing their group and guest
302            * permissions with new ones from the service context.
303            *
304            * @param auditedModel the model associated with the resources
305            * @param serviceContext the service context to be applied. Can set group
306            and guest permissions.
307            * @throws PortalException if a portal exception occurred
308            */
309            public void updateModelResources(
310                    com.liferay.portal.model.AuditedModel auditedModel,
311                    com.liferay.portal.service.ServiceContext serviceContext)
312                    throws PortalException;
313    
314            /**
315            * Updates resources matching the group, name, and primary key string at the
316            * individual scope, setting new group and guest permissions.
317            *
318            * @param companyId the primary key of the portal instance
319            * @param groupId the primary key of the group
320            * @param name the resource's name, which should be a portlet ID if the
321            resource is a portlet or the resource's class name otherwise
322            * @param primKey the primary key string of the resource instance
323            * @param groupPermissions the group permissions to be applied
324            * @param guestPermissions the guest permissions to be applied
325            * @throws PortalException if a portal exception occurred
326            */
327            public void updateResources(long companyId, long groupId,
328                    java.lang.String name, java.lang.String primKey,
329                    java.lang.String[] groupPermissions, java.lang.String[] guestPermissions)
330                    throws PortalException;
331    
332            /**
333            * Updates resources matching the group, name, and primary key at the
334            * individual scope, setting new group and guest permissions.
335            *
336            * @param companyId the primary key of the portal instance
337            * @param groupId the primary key of the group
338            * @param name the resource's name, which should be a portlet ID if the
339            resource is a portlet or the resource's class name otherwise
340            * @param primKey the primary key of the resource instance
341            * @param groupPermissions the group permissions to be applied
342            * @param guestPermissions the guest permissions to be applied
343            * @throws PortalException if a portal exception occurred
344            */
345            public void updateResources(long companyId, long groupId,
346                    java.lang.String name, long primKey,
347                    java.lang.String[] groupPermissions, java.lang.String[] guestPermissions)
348                    throws PortalException;
349    
350            /**
351            * Updates resources matching the name, primary key string and scope,
352            * replacing the primary key of their resource permissions with the new
353            * primary key.
354            *
355            * @param companyId the primary key of the portal instance
356            * @param name the resource's name, which should be a portlet ID if the
357            resource is a portlet or the resource's class name otherwise
358            * @param scope the scope of the resource. For more information see {@link
359            com.liferay.portal.model.ResourceConstants}.
360            * @param primKey the primary key string of the resource instance
361            * @param newPrimKey the new primary key string of the resource
362            */
363            public void updateResources(long companyId, java.lang.String name,
364                    int scope, java.lang.String primKey, java.lang.String newPrimKey);
365    }