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