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 a role. The user is reindexed after role is added.
078            *
079            * @param name the role's name
080            * @param titleMap the role's localized titles (optionally
081            <code>null</code>)
082            * @param descriptionMap the role's localized descriptions (optionally
083            <code>null</code>)
084            * @param type the role's type (optionally <code>0</code>)
085            * @return the role
086            * @deprecated As of 6.2.0, replaced by {@link #addRole(String, long,
087            String, Map, Map, int, String, ServiceContext)}
088            */
089            @java.lang.Deprecated
090            public com.liferay.portal.model.Role addRole(java.lang.String name,
091                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
092                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
093                    int type) throws PortalException;
094    
095            /**
096            * Adds the roles to the user. The user is reindexed after the roles are
097            * added.
098            *
099            * @param userId the primary key of the user
100            * @param roleIds the primary keys of the roles
101            */
102            public void addUserRoles(long userId, long[] roleIds)
103                    throws PortalException;
104    
105            /**
106            * Deletes the role with the primary key and its associated permissions.
107            *
108            * @param roleId the primary key of the role
109            */
110            public void deleteRole(long roleId) throws PortalException;
111    
112            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
113            public com.liferay.portal.model.Role fetchRole(long roleId)
114                    throws PortalException;
115    
116            /**
117            * Returns all the roles associated with the group.
118            *
119            * @param groupId the primary key of the group
120            * @return the roles associated with the group
121            */
122            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
123            public java.util.List<com.liferay.portal.model.Role> getGroupRoles(
124                    long groupId) throws PortalException;
125    
126            /**
127            * Returns the OSGi service identifier.
128            *
129            * @return the OSGi service identifier
130            */
131            public java.lang.String getOSGiServiceIdentifier();
132    
133            /**
134            * Returns the role with the name in the company.
135            *
136            * <p>
137            * The method searches the system roles map first for default roles. If a
138            * role with the name is not found, then the method will query the database.
139            * </p>
140            *
141            * @param companyId the primary key of the company
142            * @param name the role's name
143            * @return the role with the name
144            */
145            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
146            public com.liferay.portal.model.Role getRole(long companyId,
147                    java.lang.String name) throws PortalException;
148    
149            /**
150            * Returns the role with the primary key.
151            *
152            * @param roleId the primary key of the role
153            * @return the role with the primary key
154            */
155            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
156            public com.liferay.portal.model.Role getRole(long roleId)
157                    throws PortalException;
158    
159            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
160            public java.util.List<com.liferay.portal.model.Role> getRoles(
161                    long companyId, int[] types) throws PortalException;
162    
163            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
164            public java.util.List<com.liferay.portal.model.Role> getRoles(int type,
165                    java.lang.String subtype) throws PortalException;
166    
167            /**
168            * Returns all the user's roles within the user group.
169            *
170            * @param userId the primary key of the user
171            * @param groupId the primary key of the group
172            * @return the user's roles within the user group
173            */
174            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
175            public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
176                    long userId, long groupId) throws PortalException;
177    
178            /**
179            * Returns all the user's roles within the user group.
180            *
181            * @param userId the primary key of the user
182            * @param groupId the primary key of the group
183            * @return the user's roles within the user group
184            */
185            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
186            public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
187                    long userId, long groupId) throws PortalException;
188    
189            /**
190            * Returns the union of all the user's roles within the groups.
191            *
192            * @param userId the primary key of the user
193            * @param groups the groups (optionally <code>null</code>)
194            * @return the union of all the user's roles within the groups
195            */
196            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
197            public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
198                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
199                    throws PortalException;
200    
201            /**
202            * Returns all the roles associated with the user.
203            *
204            * @param userId the primary key of the user
205            * @return the roles associated with the user
206            */
207            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
208            public java.util.List<com.liferay.portal.model.Role> getUserRoles(
209                    long userId) throws PortalException;
210    
211            /**
212            * Returns <code>true</code> if the user is associated with the named
213            * regular role.
214            *
215            * @param userId the primary key of the user
216            * @param companyId the primary key of the company
217            * @param name the name of the role
218            * @param inherited whether to include the user's inherited roles in the
219            search
220            * @return <code>true</code> if the user is associated with the regular
221            role; <code>false</code> otherwise
222            */
223            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
224            public boolean hasUserRole(long userId, long companyId,
225                    java.lang.String name, boolean inherited) throws PortalException;
226    
227            /**
228            * Returns <code>true</code> if the user has any one of the named regular
229            * roles.
230            *
231            * @param userId the primary key of the user
232            * @param companyId the primary key of the company
233            * @param names the names of the roles
234            * @param inherited whether to include the user's inherited roles in the
235            search
236            * @return <code>true</code> if the user has any one of the regular roles;
237            <code>false</code> otherwise
238            */
239            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
240            public boolean hasUserRoles(long userId, long companyId,
241                    java.lang.String[] names, boolean inherited) throws PortalException;
242    
243            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
244            public java.util.List<com.liferay.portal.model.Role> search(
245                    long companyId, java.lang.String keywords, java.lang.Integer[] types,
246                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
247                    int start, int end,
248                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc);
249    
250            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
251            public int searchCount(long companyId, java.lang.String keywords,
252                    java.lang.Integer[] types,
253                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params);
254    
255            /**
256            * Removes the matching roles associated with the user. The user is
257            * reindexed after the roles are removed.
258            *
259            * @param userId the primary key of the user
260            * @param roleIds the primary keys of the roles
261            */
262            public void unsetUserRoles(long userId, long[] roleIds)
263                    throws PortalException;
264    
265            /**
266            * Updates the role with the primary key.
267            *
268            * @param roleId the primary key of the role
269            * @param name the role's new name
270            * @param titleMap the new localized titles (optionally <code>null</code>)
271            to replace those existing for the role
272            * @param descriptionMap the new localized descriptions (optionally
273            <code>null</code>) to replace those existing for the role
274            * @param subtype the role's new subtype (optionally <code>null</code>)
275            * @param serviceContext the service context to be applied (optionally
276            <code>null</code>). Can set the expando bridge attributes for the
277            role.
278            * @return the role with the primary key
279            */
280            public com.liferay.portal.model.Role updateRole(long roleId,
281                    java.lang.String name,
282                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
283                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
284                    java.lang.String subtype,
285                    com.liferay.portal.service.ServiceContext serviceContext)
286                    throws PortalException;
287    }