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