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