001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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
077            found or if the user did not have permission to assign members
078            to one 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
090            the role, if a role with the primary key could not be found, if
091            the role is a default system role, or if the role's resource
092            could 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
119            found 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
133            * database.
134            * </p>
135            *
136            * @param companyId the primary key of the company
137            * @param name the role's name
138            * @return the role with the name
139            * @throws PortalException if a role with the name could not be found in
140            the company or if the user did not have permission to view the
141            role
142            * @throws SystemException if a system exception occurred
143            */
144            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
145            public com.liferay.portal.model.Role getRole(long companyId,
146                    java.lang.String name)
147                    throws com.liferay.portal.kernel.exception.PortalException,
148                            com.liferay.portal.kernel.exception.SystemException;
149    
150            /**
151            * Returns all the user's roles within the user group.
152            *
153            * @param userId the primary key of the user
154            * @param groupId the primary key of the group
155            * @return the user's roles within the user group
156            * @throws PortalException if a portal exception occurred
157            * @throws SystemException if a system exception occurred
158            */
159            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
160            public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
161                    long userId, long groupId)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException;
164    
165            /**
166            * Returns all the user's roles within the user group.
167            *
168            * @param userId the primary key of the user
169            * @param groupId the primary key of the group
170            * @return the user's roles within the user group
171            * @throws PortalException if a portal exception occurred
172            * @throws SystemException if a system exception occurred
173            */
174            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
175            public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
176                    long userId, long groupId)
177                    throws com.liferay.portal.kernel.exception.PortalException,
178                            com.liferay.portal.kernel.exception.SystemException;
179    
180            /**
181            * Returns the union of all the user's roles within the groups.
182            *
183            * @param userId the primary key of the user
184            * @param groups the groups (optionally <code>null</code>)
185            * @return the union of all the user's roles within the groups
186            * @throws PortalException if a portal exception occurred
187            * @throws SystemException if a system exception occurred
188            */
189            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
190            public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
191                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
192                    throws com.liferay.portal.kernel.exception.PortalException,
193                            com.liferay.portal.kernel.exception.SystemException;
194    
195            /**
196            * Returns all the roles associated with the user.
197            *
198            * @param userId the primary key of the user
199            * @return the roles associated with the user
200            * @throws PortalException if a portal exception occurred
201            * @throws SystemException if a system exception occurred
202            */
203            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
204            public java.util.List<com.liferay.portal.model.Role> getUserRoles(
205                    long userId)
206                    throws com.liferay.portal.kernel.exception.PortalException,
207                            com.liferay.portal.kernel.exception.SystemException;
208    
209            /**
210            * Returns <code>true</code> if the user is associated with the named
211            * regular role.
212            *
213            * @param userId the primary key of the user
214            * @param companyId the primary key of the company
215            * @param name the name of the role
216            * @param inherited whether to include the user's inherited roles in the
217            search
218            * @return <code>true</code> if the user is associated with the regular
219            role; <code>false</code> otherwise
220            * @throws PortalException if a role with the name could not be found in
221            the company or if a default user for the company could not be
222            found
223            * @throws SystemException if a system exception occurred
224            */
225            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
226            public boolean hasUserRole(long userId, long companyId,
227                    java.lang.String name, boolean inherited)
228                    throws com.liferay.portal.kernel.exception.PortalException,
229                            com.liferay.portal.kernel.exception.SystemException;
230    
231            /**
232            * Returns <code>true</code> if the user has any one of the named regular
233            * roles.
234            *
235            * @param userId the primary key of the user
236            * @param companyId the primary key of the company
237            * @param names the names of the roles
238            * @param inherited whether to include the user's inherited roles in the
239            search
240            * @return <code>true</code> if the user has any one of the regular roles;
241            <code>false</code> otherwise
242            * @throws PortalException if any one of the roles with the names could not
243            be found in the company or if the default user for the company
244            could not be found
245            * @throws SystemException if a system exception occurred
246            */
247            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
248            public boolean hasUserRoles(long userId, long companyId,
249                    java.lang.String[] names, boolean inherited)
250                    throws com.liferay.portal.kernel.exception.PortalException,
251                            com.liferay.portal.kernel.exception.SystemException;
252    
253            /**
254            * Removes the matching roles associated with the user. The user is
255            * reindexed after the roles are removed.
256            *
257            * @param userId the primary key of the user
258            * @param roleIds the primary keys of the roles
259            * @throws PortalException if a user with the primary key could not be
260            found, if the user did not have permission to remove members
261            from a role, or if a role with any one of the primary keys could
262            not be found
263            * @throws SystemException if a system exception occurred
264            */
265            public void unsetUserRoles(long userId, long[] roleIds)
266                    throws com.liferay.portal.kernel.exception.PortalException,
267                            com.liferay.portal.kernel.exception.SystemException;
268    
269            /**
270            * Updates the role with the primary key.
271            *
272            * @param roleId the primary key of the role
273            * @param name the role's new name
274            * @param titleMap the new localized titles (optionally <code>null</code>)
275            to replace those existing for the role
276            * @param descriptionMap the new localized descriptions (optionally
277            <code>null</code>) to replace those existing for the role
278            * @param subtype the role's new subtype (optionally <code>null</code>)
279            * @return the role with the primary key
280            * @throws PortalException if the user did not have permission to update
281            the role, if a role with the primary could not be found, or if
282            the role's name was invalid
283            * @throws SystemException if a system exception occurred
284            */
285            public com.liferay.portal.model.Role updateRole(long roleId,
286                    java.lang.String name,
287                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
288                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
289                    java.lang.String subtype)
290                    throws com.liferay.portal.kernel.exception.PortalException,
291                            com.liferay.portal.kernel.exception.SystemException;
292    }