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