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.jsonwebservice.JSONWebService;
020    import com.liferay.portal.kernel.transaction.Isolation;
021    import com.liferay.portal.kernel.transaction.Propagation;
022    import com.liferay.portal.kernel.transaction.Transactional;
023    import com.liferay.portal.security.ac.AccessControlled;
024    
025    /**
026     * Provides the remote service interface for Role. Methods of this
027     * service are expected to have security checks based on the propagated JAAS
028     * credentials because this service can be accessed remotely.
029     *
030     * @author Brian Wing Shun Chan
031     * @see RoleServiceUtil
032     * @see com.liferay.portal.service.base.RoleServiceBaseImpl
033     * @see com.liferay.portal.service.impl.RoleServiceImpl
034     * @generated
035     */
036    @AccessControlled
037    @JSONWebService
038    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
039            PortalException.class, SystemException.class})
040    public interface RoleService extends BaseService {
041            /*
042             * NOTE FOR DEVELOPERS:
043             *
044             * Never modify or reference this interface directly. Always use {@link RoleServiceUtil} to access the role remote service. Add custom service methods to {@link com.liferay.portal.service.impl.RoleServiceImpl} 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 a role. The user is reindexed after role is added.
063            *
064            * @param className the name of the class for which the role is created
065            * @param classPK the primary key of the class for which the role is
066            created (optionally <code>0</code>)
067            * @param name the role's name
068            * @param titleMap the role's localized titles (optionally
069            <code>null</code>)
070            * @param descriptionMap the role's localized descriptions (optionally
071            <code>null</code>)
072            * @param type the role's type (optionally <code>0</code>)
073            * @param subtype the role's subtype (optionally <code>null</code>)
074            * @param serviceContext the service context to be applied (optionally
075            <code>null</code>). Can set the expando bridge attributes for the
076            role.
077            * @return the role
078            * @throws PortalException if a user with the primary key could not be
079            found, if the user did not have permission to add roles, if the
080            class name or the role name were invalid, or if the role is a
081            duplicate
082            * @throws SystemException if a system exception occurred
083            */
084            public com.liferay.portal.model.Role addRole(java.lang.String className,
085                    long classPK, java.lang.String name,
086                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
087                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
088                    int type, java.lang.String subtype,
089                    com.liferay.portal.service.ServiceContext serviceContext)
090                    throws com.liferay.portal.kernel.exception.PortalException,
091                            com.liferay.portal.kernel.exception.SystemException;
092    
093            /**
094            * Adds a role. The user is reindexed after role is added.
095            *
096            * @param name the role's name
097            * @param titleMap the role's localized titles (optionally
098            <code>null</code>)
099            * @param descriptionMap the role's localized descriptions (optionally
100            <code>null</code>)
101            * @param type the role's type (optionally <code>0</code>)
102            * @return the role
103            * @throws PortalException if a user with the primary key could not be
104            found, if the user did not have permission to add roles, if
105            the class name or the role name were invalid, or if the role
106            is a duplicate
107            * @throws SystemException if a system exception occurred
108            * @deprecated As of 6.2.0, replaced by {@link #addRole(String, long,
109            String, Map, Map, int, String, ServiceContext)}
110            */
111            public com.liferay.portal.model.Role addRole(java.lang.String name,
112                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
113                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
114                    int type)
115                    throws com.liferay.portal.kernel.exception.PortalException,
116                            com.liferay.portal.kernel.exception.SystemException;
117    
118            /**
119            * Adds the roles to the user. The user is reindexed after the roles are
120            * added.
121            *
122            * @param userId the primary key of the user
123            * @param roleIds the primary keys of the roles
124            * @throws PortalException if a user with the primary key could not be found
125            or if the user did not have permission to assign members to one
126            of the roles
127            * @throws SystemException if a system exception occurred
128            */
129            public void addUserRoles(long userId, long[] roleIds)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException;
132    
133            /**
134            * Deletes the role with the primary key and its associated permissions.
135            *
136            * @param roleId the primary key of the role
137            * @throws PortalException if the user did not have permission to delete the
138            role, if a role with the primary key could not be found, if the
139            role is a default system role, or if the role's resource could
140            not be found
141            * @throws SystemException if a system exception occurred
142            */
143            public void deleteRole(long roleId)
144                    throws com.liferay.portal.kernel.exception.PortalException,
145                            com.liferay.portal.kernel.exception.SystemException;
146    
147            /**
148            * Returns all the roles associated with the group.
149            *
150            * @param groupId the primary key of the group
151            * @return the roles associated with the group
152            * @throws PortalException if a portal exception occurred
153            * @throws SystemException if a system exception occurred
154            */
155            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
156            public java.util.List<com.liferay.portal.model.Role> getGroupRoles(
157                    long groupId)
158                    throws com.liferay.portal.kernel.exception.PortalException,
159                            com.liferay.portal.kernel.exception.SystemException;
160    
161            /**
162            * Returns the role with the primary key.
163            *
164            * @param roleId the primary key of the role
165            * @return the role with the primary key
166            * @throws PortalException if a role with the primary key could not be found
167            or if the user did not have permission to view the role
168            * @throws SystemException if a system exception occurred
169            */
170            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
171            public com.liferay.portal.model.Role getRole(long roleId)
172                    throws com.liferay.portal.kernel.exception.PortalException,
173                            com.liferay.portal.kernel.exception.SystemException;
174    
175            /**
176            * Returns the role with the name in the company.
177            *
178            * <p>
179            * The method searches the system roles map first for default roles. If a
180            * role with the name is not found, then the method will query the database.
181            * </p>
182            *
183            * @param companyId the primary key of the company
184            * @param name the role's name
185            * @return the role with the name
186            * @throws PortalException if a role with the name could not be found in the
187            company or if the user did not have permission to view the role
188            * @throws SystemException if a system exception occurred
189            */
190            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
191            public com.liferay.portal.model.Role getRole(long companyId,
192                    java.lang.String name)
193                    throws com.liferay.portal.kernel.exception.PortalException,
194                            com.liferay.portal.kernel.exception.SystemException;
195    
196            /**
197            * Returns all the user's roles within the user group.
198            *
199            * @param userId the primary key of the user
200            * @param groupId the primary key of the group
201            * @return the user's roles within the user group
202            * @throws PortalException if a portal exception occurred
203            * @throws SystemException if a system exception occurred
204            */
205            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
206            public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
207                    long userId, long groupId)
208                    throws com.liferay.portal.kernel.exception.PortalException,
209                            com.liferay.portal.kernel.exception.SystemException;
210    
211            /**
212            * Returns all the user's roles within the user group.
213            *
214            * @param userId the primary key of the user
215            * @param groupId the primary key of the group
216            * @return the user's roles within the user group
217            * @throws PortalException if a portal exception occurred
218            * @throws SystemException if a system exception occurred
219            */
220            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
221            public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
222                    long userId, long groupId)
223                    throws com.liferay.portal.kernel.exception.PortalException,
224                            com.liferay.portal.kernel.exception.SystemException;
225    
226            /**
227            * Returns the union of all the user's roles within the groups.
228            *
229            * @param userId the primary key of the user
230            * @param groups the groups (optionally <code>null</code>)
231            * @return the union of all the user's roles within the groups
232            * @throws PortalException if a portal exception occurred
233            * @throws SystemException if a system exception occurred
234            */
235            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
236            public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
237                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
238                    throws com.liferay.portal.kernel.exception.PortalException,
239                            com.liferay.portal.kernel.exception.SystemException;
240    
241            /**
242            * Returns all the roles associated with the user.
243            *
244            * @param userId the primary key of the user
245            * @return the roles associated with the user
246            * @throws PortalException if a portal exception occurred
247            * @throws SystemException if a system exception occurred
248            */
249            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
250            public java.util.List<com.liferay.portal.model.Role> getUserRoles(
251                    long userId)
252                    throws com.liferay.portal.kernel.exception.PortalException,
253                            com.liferay.portal.kernel.exception.SystemException;
254    
255            /**
256            * Returns <code>true</code> if the user is associated with the named
257            * regular role.
258            *
259            * @param userId the primary key of the user
260            * @param companyId the primary key of the company
261            * @param name the name of the role
262            * @param inherited whether to include the user's inherited roles in the
263            search
264            * @return <code>true</code> if the user is associated with the regular
265            role; <code>false</code> otherwise
266            * @throws PortalException if a role with the name could not be found in the
267            company or if a default user for the company could not be found
268            * @throws SystemException if a system exception occurred
269            */
270            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
271            public boolean hasUserRole(long userId, long companyId,
272                    java.lang.String name, boolean inherited)
273                    throws com.liferay.portal.kernel.exception.PortalException,
274                            com.liferay.portal.kernel.exception.SystemException;
275    
276            /**
277            * Returns <code>true</code> if the user has any one of the named regular
278            * roles.
279            *
280            * @param userId the primary key of the user
281            * @param companyId the primary key of the company
282            * @param names the names of the roles
283            * @param inherited whether to include the user's inherited roles in the
284            search
285            * @return <code>true</code> if the user has any one of the regular roles;
286            <code>false</code> otherwise
287            * @throws PortalException if any one of the roles with the names could not
288            be found in the company or if the default user for the company
289            could not be found
290            * @throws SystemException if a system exception occurred
291            */
292            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
293            public boolean hasUserRoles(long userId, long companyId,
294                    java.lang.String[] names, boolean inherited)
295                    throws com.liferay.portal.kernel.exception.PortalException,
296                            com.liferay.portal.kernel.exception.SystemException;
297    
298            /**
299            * Removes the matching roles associated with the user. The user is
300            * reindexed after the roles are removed.
301            *
302            * @param userId the primary key of the user
303            * @param roleIds the primary keys of the roles
304            * @throws PortalException if a user with the primary key could not be
305            found, if the user did not have permission to remove members from
306            a role, or if a role with any one of the primary keys could not
307            be found
308            * @throws SystemException if a system exception occurred
309            */
310            public void unsetUserRoles(long userId, long[] roleIds)
311                    throws com.liferay.portal.kernel.exception.PortalException,
312                            com.liferay.portal.kernel.exception.SystemException;
313    
314            /**
315            * Updates the role with the primary key.
316            *
317            * @param roleId the primary key of the role
318            * @param name the role's new name
319            * @param titleMap the new localized titles (optionally <code>null</code>)
320            to replace those existing for the role
321            * @param descriptionMap the new localized descriptions (optionally
322            <code>null</code>) to replace those existing for the role
323            * @param subtype the role's new subtype (optionally <code>null</code>)
324            * @param serviceContext the service context to be applied (optionally
325            <code>null</code>). Can set the expando bridge attributes for the
326            role.
327            * @return the role with the primary key
328            * @throws PortalException if the user did not have permission to update the
329            role, if a role with the primary could not be found, or if the
330            role's name was invalid
331            * @throws SystemException if a system exception occurred
332            */
333            public com.liferay.portal.model.Role updateRole(long roleId,
334                    java.lang.String name,
335                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
336                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
337                    java.lang.String subtype,
338                    com.liferay.portal.service.ServiceContext serviceContext)
339                    throws com.liferay.portal.kernel.exception.PortalException,
340                            com.liferay.portal.kernel.exception.SystemException;
341    }