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