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