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.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.jsonwebservice.JSONWebService;
022    import com.liferay.portal.kernel.security.access.control.AccessControlled;
023    import com.liferay.portal.kernel.transaction.Isolation;
024    import com.liferay.portal.kernel.transaction.Propagation;
025    import com.liferay.portal.kernel.transaction.Transactional;
026    
027    /**
028     * Provides the remote service interface for Role. Methods of this
029     * service are expected to have security checks based on the propagated JAAS
030     * credentials because this service can be accessed remotely.
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    @ProviderType
041    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
042            PortalException.class, SystemException.class})
043    public interface RoleService extends BaseService {
044            /*
045             * NOTE FOR DEVELOPERS:
046             *
047             * 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.
048             */
049    
050            /**
051            * Adds a role. The user is reindexed after role is added.
052            *
053            * @param className the name of the class for which the role is created
054            * @param classPK the primary key of the class for which the role is
055            created (optionally <code>0</code>)
056            * @param name the role's name
057            * @param titleMap the role's localized titles (optionally
058            <code>null</code>)
059            * @param descriptionMap the role's localized descriptions (optionally
060            <code>null</code>)
061            * @param type the role's type (optionally <code>0</code>)
062            * @param subtype the role's subtype (optionally <code>null</code>)
063            * @param serviceContext the service context to be applied (optionally
064            <code>null</code>). Can set the expando bridge attributes for the
065            role.
066            * @return the role
067            */
068            public com.liferay.portal.model.Role addRole(java.lang.String className,
069                    long classPK, java.lang.String name,
070                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
071                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
072                    int type, java.lang.String subtype,
073                    com.liferay.portal.service.ServiceContext serviceContext)
074                    throws PortalException;
075    
076            /**
077            * Adds the roles to the user. The user is reindexed after the roles are
078            * added.
079            *
080            * @param userId the primary key of the user
081            * @param roleIds the primary keys of the roles
082            */
083            public void addUserRoles(long userId, long[] roleIds)
084                    throws PortalException;
085    
086            /**
087            * Deletes the role with the primary key and its associated permissions.
088            *
089            * @param roleId the primary key of the role
090            */
091            public void deleteRole(long roleId) throws PortalException;
092    
093            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
094            public com.liferay.portal.model.Role fetchRole(long roleId)
095                    throws PortalException;
096    
097            /**
098            * Returns all the roles associated with the group.
099            *
100            * @param groupId the primary key of the group
101            * @return the roles associated with the group
102            */
103            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
104            public java.util.List<com.liferay.portal.model.Role> getGroupRoles(
105                    long groupId) throws PortalException;
106    
107            /**
108            * Returns the OSGi service identifier.
109            *
110            * @return the OSGi service identifier
111            */
112            public java.lang.String getOSGiServiceIdentifier();
113    
114            /**
115            * Returns the role with the name in the company.
116            *
117            * <p>
118            * The method searches the system roles map first for default roles. If a
119            * role with the name is not found, then the method will query the database.
120            * </p>
121            *
122            * @param companyId the primary key of the company
123            * @param name the role's name
124            * @return the role with the name
125            */
126            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
127            public com.liferay.portal.model.Role getRole(long companyId,
128                    java.lang.String name) throws PortalException;
129    
130            /**
131            * Returns the role with the primary key.
132            *
133            * @param roleId the primary key of the role
134            * @return the role with the primary key
135            */
136            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
137            public com.liferay.portal.model.Role getRole(long roleId)
138                    throws PortalException;
139    
140            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
141            public java.util.List<com.liferay.portal.model.Role> getRoles(
142                    long companyId, int[] types) throws PortalException;
143    
144            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
145            public java.util.List<com.liferay.portal.model.Role> getRoles(int type,
146                    java.lang.String subtype) throws PortalException;
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            */
155            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
156            public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
157                    long userId, long groupId) throws PortalException;
158    
159            /**
160            * Returns all the user's roles within the user group.
161            *
162            * @param userId the primary key of the user
163            * @param groupId the primary key of the group
164            * @return the user's roles within the user group
165            */
166            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
167            public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
168                    long userId, long groupId) throws PortalException;
169    
170            /**
171            * Returns the union of all the user's roles within the groups.
172            *
173            * @param userId the primary key of the user
174            * @param groups the groups (optionally <code>null</code>)
175            * @return the union of all the user's roles within the groups
176            */
177            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
178            public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
179                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
180                    throws PortalException;
181    
182            /**
183            * Returns all the roles associated with the user.
184            *
185            * @param userId the primary key of the user
186            * @return the roles associated with the user
187            */
188            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
189            public java.util.List<com.liferay.portal.model.Role> getUserRoles(
190                    long userId) throws PortalException;
191    
192            /**
193            * Returns <code>true</code> if the user is associated with the named
194            * regular role.
195            *
196            * @param userId the primary key of the user
197            * @param companyId the primary key of the company
198            * @param name the name of the role
199            * @param inherited whether to include the user's inherited roles in the
200            search
201            * @return <code>true</code> if the user is associated with the regular
202            role; <code>false</code> otherwise
203            */
204            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
205            public boolean hasUserRole(long userId, long companyId,
206                    java.lang.String name, boolean inherited) throws PortalException;
207    
208            /**
209            * Returns <code>true</code> if the user has any one of the named regular
210            * roles.
211            *
212            * @param userId the primary key of the user
213            * @param companyId the primary key of the company
214            * @param names the names of the roles
215            * @param inherited whether to include the user's inherited roles in the
216            search
217            * @return <code>true</code> if the user has any one of the regular roles;
218            <code>false</code> otherwise
219            */
220            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
221            public boolean hasUserRoles(long userId, long companyId,
222                    java.lang.String[] names, boolean inherited) throws PortalException;
223    
224            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
225            public java.util.List<com.liferay.portal.model.Role> search(
226                    long companyId, java.lang.String keywords, java.lang.Integer[] types,
227                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
228                    int start, int end,
229                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc);
230    
231            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
232            public int searchCount(long companyId, java.lang.String keywords,
233                    java.lang.Integer[] types,
234                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params);
235    
236            /**
237            * Removes the matching roles associated with the user. The user is
238            * reindexed after the roles are removed.
239            *
240            * @param userId the primary key of the user
241            * @param roleIds the primary keys of the roles
242            */
243            public void unsetUserRoles(long userId, long[] roleIds)
244                    throws PortalException;
245    
246            /**
247            * Updates the role with the primary key.
248            *
249            * @param roleId the primary key of the role
250            * @param name the role's new name
251            * @param titleMap the new localized titles (optionally <code>null</code>)
252            to replace those existing for the role
253            * @param descriptionMap the new localized descriptions (optionally
254            <code>null</code>) to replace those existing for the role
255            * @param subtype the role's new subtype (optionally <code>null</code>)
256            * @param serviceContext the service context to be applied (optionally
257            <code>null</code>). Can set the expando bridge attributes for the
258            role.
259            * @return the role with the primary key
260            */
261            public com.liferay.portal.model.Role updateRole(long roleId,
262                    java.lang.String name,
263                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
264                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
265                    java.lang.String subtype,
266                    com.liferay.portal.service.ServiceContext serviceContext)
267                    throws PortalException;
268    }