Liferay 7.0-ce-b4

com.liferay.portal.service
Interface RoleLocalService

All Superinterfaces:
BaseLocalService, PersistedModelLocalService
All Known Implementing Classes:
RoleLocalServiceWrapper

@ProviderType
@Transactional(isolation=PORTAL,
               rollbackFor={PortalException.class,SystemException.class})
public interface RoleLocalService
extends BaseLocalService, PersistedModelLocalService

Provides the local service interface for Role. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.

See Also:
RoleLocalServiceUtil, RoleLocalServiceBaseImpl, com.liferay.portal.service.impl.RoleLocalServiceImpl

Method Summary
 void addGroupRole(long groupId, long roleId)
           
 void addGroupRole(long groupId, Role role)
           
 void addGroupRoles(long groupId, List<Role> Roles)
           
 void addGroupRoles(long groupId, long[] roleIds)
           
 Role addRole(long userId, long companyId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type)
          Deprecated. As of 6.2.0, replaced by addRole(long, String, long, String, Map, Map, int, String, ServiceContext)
 Role addRole(long userId, long companyId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type, String className, long classPK)
          Deprecated. As of 6.2.0, replaced by addRole(long, String, long, String, Map, Map, int, String, ServiceContext)
 Role addRole(long userId, String className, long classPK, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type, String subtype, ServiceContext serviceContext)
          Adds a role with additional parameters.
 Role addRole(Role role)
          Adds the role to the database.
 void addUserRole(long userId, long roleId)
           
 void addUserRole(long userId, Role role)
           
 void addUserRoles(long userId, List<Role> Roles)
           
 void addUserRoles(long userId, long[] roleIds)
           
 void checkSystemRoles()
          Checks to ensure that the system roles map has appropriate default roles in each company.
 void checkSystemRoles(long companyId)
          Checks to ensure that the system roles map has appropriate default roles in the company.
 void clearGroupRoles(long groupId)
           
 void clearUserRoles(long userId)
           
 Role createRole(long roleId)
          Creates a new role with the primary key.
 void deleteGroupRole(long groupId, long roleId)
           
 void deleteGroupRole(long groupId, Role role)
           
 void deleteGroupRoles(long groupId, List<Role> Roles)
           
 void deleteGroupRoles(long groupId, long[] roleIds)
           
 PersistedModel deletePersistedModel(PersistedModel persistedModel)
           
 Role deleteRole(long roleId)
          Deletes the role with the primary key from the database.
 Role deleteRole(Role role)
          Deletes the role from the database.
 void deleteUserRole(long userId, long roleId)
           
 void deleteUserRole(long userId, Role role)
           
 void deleteUserRoles(long userId, List<Role> Roles)
           
 void deleteUserRoles(long userId, long[] roleIds)
           
 DynamicQuery dynamicQuery()
           
<T> List<T>
dynamicQuery(DynamicQuery dynamicQuery)
          Performs a dynamic query on the database and returns the matching rows.
<T> List<T>
dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
          Performs a dynamic query on the database and returns a range of the matching rows.
<T> List<T>
dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator)
          Performs a dynamic query on the database and returns an ordered range of the matching rows.
 long dynamicQueryCount(DynamicQuery dynamicQuery)
          Returns the number of rows matching the dynamic query.
 long dynamicQueryCount(DynamicQuery dynamicQuery, Projection projection)
          Returns the number of rows matching the dynamic query.
 Role fetchRole(long roleId)
           
 Role fetchRole(long companyId, String name)
          Returns the role with the name in the company.
 Role fetchRoleByUuidAndCompanyId(String uuid, long companyId)
          Returns the role with the matching UUID and company.
 ActionableDynamicQuery getActionableDynamicQuery()
           
 Role getDefaultGroupRole(long groupId)
          Returns the default role for the group with the primary key.
 ExportActionableDynamicQuery getExportActionableDynamicQuery(PortletDataContext portletDataContext)
           
 long[] getGroupPrimaryKeys(long roleId)
          Returns the groupIds of the groups associated with the role.
 List<Role> getGroupRelatedRoles(long groupId)
           
 List<Role> getGroupRoles(long groupId)
           
 List<Role> getGroupRoles(long groupId, int start, int end)
           
 List<Role> getGroupRoles(long groupId, int start, int end, OrderByComparator<Role> orderByComparator)
           
 int getGroupRolesCount(long groupId)
           
 IndexableActionableDynamicQuery getIndexableActionableDynamicQuery()
           
 String getOSGiServiceIdentifier()
          Returns the OSGi service identifier.
 PersistedModel getPersistedModel(Serializable primaryKeyObj)
           
 List<Role> getResourceBlockRoles(long resourceBlockId, String className, String actionId)
           
 Map<String,List<String>> getResourceRoles(long companyId, String name, int scope, String primKey)
          Returns a map of role names to associated action IDs for the named resource in the company within the permission scope.
 List<Role> getResourceRoles(long companyId, String name, int scope, String primKey, String actionId)
          Returns all the roles associated with the action ID in the company within the permission scope.
 Role getRole(long roleId)
          Returns the role with the primary key.
 Role getRole(long companyId, String name)
          Returns the role with the name in the company.
 Role getRoleByUuidAndCompanyId(String uuid, long companyId)
          Returns the role with the matching UUID and company.
 List<Role> getRoles(int start, int end)
          Returns a range of all the roles.
 List<Role> getRoles(int type, String subtype)
          Returns all the roles of the type and subtype.
 List<Role> getRoles(long companyId)
          Returns all the roles in the company.
 List<Role> getRoles(long[] roleIds)
          Returns all the roles with the primary keys.
 List<Role> getRoles(long companyId, int[] types)
          Returns all the roles with the types.
 int getRolesCount()
          Returns the number of roles.
 List<Role> getSubtypeRoles(String subtype)
          Returns all the roles of the subtype.
 int getSubtypeRolesCount(String subtype)
          Returns the number of roles of the subtype.
 Role getTeamRole(long companyId, long teamId)
          Returns the team role in the company.
 Map<Team,Role> getTeamRoleMap(long groupId)
          Returns the team role map for the group.
 List<Role> getTeamRoles(long groupId)
          Returns the team roles in the group.
 List<Role> getTeamRoles(long groupId, long[] excludedRoleIds)
          Returns the team roles in the group, excluding the specified role IDs.
 List<Role> getTypeRoles(int type)
          Returns all the roles of the type.
 List<Role> getTypeRoles(int type, int start, int end)
          Returns a range of all the roles of the type.
 int getTypeRolesCount(int type)
          Returns the number of roles of the type.
 List<Role> getUserGroupGroupRoles(long userId, long groupId)
          Returns all the user's roles within the user group.
 List<Role> getUserGroupGroupRoles(long userId, long groupId, int start, int end)
           
 int getUserGroupGroupRolesCount(long userId, long groupId)
           
 List<Role> getUserGroupRoles(long userId, long groupId)
          Returns all the user's roles within the user group.
 long[] getUserPrimaryKeys(long roleId)
          Returns the userIds of the users associated with the role.
 List<Role> getUserRelatedRoles(long userId, List<Group> groups)
          Returns the union of all the user's roles within the groups.
 List<Role> getUserRelatedRoles(long userId, long groupId)
          Returns all the user's roles within the group.
 List<Role> getUserRelatedRoles(long userId, long[] groupIds)
          Returns the union of all the user's roles within the groups.
 List<Role> getUserRoles(long userId)
           
 List<Role> getUserRoles(long userId, int start, int end)
           
 List<Role> getUserRoles(long userId, int start, int end, OrderByComparator<Role> orderByComparator)
           
 int getUserRolesCount(long userId)
           
 boolean hasGroupRole(long groupId, long roleId)
           
 boolean hasGroupRoles(long groupId)
           
 boolean hasUserRole(long userId, long roleId)
           
 boolean hasUserRole(long userId, long companyId, String name, boolean inherited)
          Returns true if the user is associated with the named regular role.
 boolean hasUserRoles(long userId)
           
 boolean hasUserRoles(long userId, long companyId, String[] names, boolean inherited)
          Returns true if the user has any one of the named regular roles.
 Role loadFetchRole(long companyId, String name)
          Returns a role with the name in the company.
 Role loadGetRole(long companyId, String name)
          Returns a role with the name in the company.
 List<Role> search(long companyId, String keywords, Integer[] types, int start, int end, OrderByComparator<Role> obc)
          Returns an ordered range of all the roles that match the keywords and types.
 List<Role> search(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<Role> obc)
          Returns an ordered range of all the roles that match the keywords, types, and params.
 List<Role> search(long companyId, String name, String description, Integer[] types, int start, int end, OrderByComparator<Role> obc)
          Returns an ordered range of all the roles that match the name, description, and types.
 List<Role> search(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<Role> obc)
          Returns an ordered range of all the roles that match the name, description, types, and params.
 int searchCount(long companyId, String keywords, Integer[] types)
          Returns the number of roles that match the keywords and types.
 int searchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params)
          Returns the number of roles that match the keywords, types and params.
 int searchCount(long companyId, String name, String description, Integer[] types)
          Returns the number of roles that match the name, description, and types.
 int searchCount(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params)
          Returns the number of roles that match the name, description, types, and params.
 void setGroupRoles(long groupId, long[] roleIds)
           
 void setUserRoles(long userId, long[] roleIds)
           
 void unsetUserRoles(long userId, long[] roleIds)
          Removes the matching roles associated with the user.
 Role updateRole(long roleId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, String subtype, ServiceContext serviceContext)
          Updates the role with the primary key.
 Role updateRole(Role role)
          Updates the role in the database or adds it if it does not yet exist.
 

Method Detail

addGroupRole

void addGroupRole(long groupId,
                  Role role)

addGroupRole

void addGroupRole(long groupId,
                  long roleId)

addGroupRoles

void addGroupRoles(long groupId,
                   List<Role> Roles)

addGroupRoles

void addGroupRoles(long groupId,
                   long[] roleIds)

addRole

@Indexable(type=REINDEX)
Role addRole(Role role)
Adds the role to the database. Also notifies the appropriate model listeners.

Parameters:
role - the role
Returns:
the role that was added

addRole

Role addRole(long userId,
             String className,
             long classPK,
             String name,
             Map<Locale,String> titleMap,
             Map<Locale,String> descriptionMap,
             int type,
             String subtype,
             ServiceContext serviceContext)
             throws PortalException
Adds a role with additional parameters. The user is reindexed after role is added.

Parameters:
userId - the primary key of the user
className - the name of the class for which the role is created (optionally null)
classPK - the primary key of the class for which the role is created (optionally 0)
name - the role's name
titleMap - the role's localized titles (optionally null)
descriptionMap - the role's localized descriptions (optionally null)
type - the role's type (optionally 0)
subtype - the role's subtype (optionally null)
serviceContext - the service context to be applied (optionally null). Can set expando bridge attributes for the role.
Returns:
the role
Throws:
PortalException

addRole

@Deprecated
Role addRole(long userId,
                        long companyId,
                        String name,
                        Map<Locale,String> titleMap,
                        Map<Locale,String> descriptionMap,
                        int type)
             throws PortalException
Deprecated. As of 6.2.0, replaced by addRole(long, String, long, String, Map, Map, int, String, ServiceContext)

Adds a role. The user is reindexed after role is added.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
name - the role's name
titleMap - the role's localized titles (optionally null)
descriptionMap - the role's localized descriptions (optionally null)
type - the role's type (optionally 0)
Returns:
the role
Throws:
PortalException

addRole

@Deprecated
Role addRole(long userId,
                        long companyId,
                        String name,
                        Map<Locale,String> titleMap,
                        Map<Locale,String> descriptionMap,
                        int type,
                        String className,
                        long classPK)
             throws PortalException
Deprecated. As of 6.2.0, replaced by addRole(long, String, long, String, Map, Map, int, String, ServiceContext)

Adds a role with additional parameters. The user is reindexed after role is added.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
name - the role's name
titleMap - the role's localized titles (optionally null)
descriptionMap - the role's localized descriptions (optionally null)
type - the role's type (optionally 0)
className - the name of the class for which the role is created (optionally null)
classPK - the primary key of the class for which the role is created (optionally 0)
Returns:
the role
Throws:
PortalException

addUserRole

void addUserRole(long userId,
                 Role role)

addUserRole

void addUserRole(long userId,
                 long roleId)

addUserRoles

void addUserRoles(long userId,
                  List<Role> Roles)
                  throws PortalException
Throws:
PortalException

addUserRoles

void addUserRoles(long userId,
                  long[] roleIds)
                  throws PortalException
Throws:
PortalException

checkSystemRoles

void checkSystemRoles()
                      throws PortalException
Checks to ensure that the system roles map has appropriate default roles in each company.

Throws:
PortalException

checkSystemRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
void checkSystemRoles(long companyId)
                      throws PortalException
Checks to ensure that the system roles map has appropriate default roles in the company.

Parameters:
companyId - the primary key of the company
Throws:
PortalException

clearGroupRoles

void clearGroupRoles(long groupId)

clearUserRoles

void clearUserRoles(long userId)

createRole

Role createRole(long roleId)
Creates a new role with the primary key. Does not add the role to the database.

Parameters:
roleId - the primary key for the new role
Returns:
the new role

deleteGroupRole

void deleteGroupRole(long groupId,
                     Role role)

deleteGroupRole

void deleteGroupRole(long groupId,
                     long roleId)

deleteGroupRoles

void deleteGroupRoles(long groupId,
                      List<Role> Roles)

deleteGroupRoles

void deleteGroupRoles(long groupId,
                      long[] roleIds)

deletePersistedModel

PersistedModel deletePersistedModel(PersistedModel persistedModel)
                                    throws PortalException
Specified by:
deletePersistedModel in interface PersistedModelLocalService
Throws:
PortalException

deleteRole

@Indexable(type=DELETE)
@SystemEvent(action=1,
             type=1)
Role deleteRole(Role role)
                throws PortalException
Deletes the role from the database. Also notifies the appropriate model listeners.

Parameters:
role - the role
Returns:
the role that was removed
Throws:
PortalException

deleteRole

@Indexable(type=DELETE)
Role deleteRole(long roleId)
                throws PortalException
Deletes the role with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
roleId - the primary key of the role
Returns:
the role that was removed
Throws:
PortalException - if a role with the primary key could not be found

deleteUserRole

void deleteUserRole(long userId,
                    Role role)

deleteUserRole

void deleteUserRole(long userId,
                    long roleId)

deleteUserRoles

void deleteUserRoles(long userId,
                     List<Role> Roles)

deleteUserRoles

void deleteUserRoles(long userId,
                     long[] roleIds)

dynamicQuery

DynamicQuery dynamicQuery()

dynamicQuery

<T> List<T> dynamicQuery(DynamicQuery dynamicQuery)
Performs a dynamic query on the database and returns the matching rows.

Parameters:
dynamicQuery - the dynamic query
Returns:
the matching rows

dynamicQuery

<T> List<T> dynamicQuery(DynamicQuery dynamicQuery,
                         int start,
                         int end)
Performs a dynamic query on the database and returns a range of the matching rows.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil.ALL_POS), then the query will include the default ORDER BY logic from RoleModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
Returns:
the range of matching rows

dynamicQuery

<T> List<T> dynamicQuery(DynamicQuery dynamicQuery,
                         int start,
                         int end,
                         OrderByComparator<T> orderByComparator)
Performs a dynamic query on the database and returns an ordered range of the matching rows.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil.ALL_POS), then the query will include the default ORDER BY logic from RoleModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching rows

dynamicQueryCount

long dynamicQueryCount(DynamicQuery dynamicQuery)
Returns the number of rows matching the dynamic query.

Parameters:
dynamicQuery - the dynamic query
Returns:
the number of rows matching the dynamic query

dynamicQueryCount

long dynamicQueryCount(DynamicQuery dynamicQuery,
                       Projection projection)
Returns the number of rows matching the dynamic query.

Parameters:
dynamicQuery - the dynamic query
projection - the projection to apply to the query
Returns:
the number of rows matching the dynamic query

fetchRole

@Skip
@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role fetchRole(long companyId,
                                                             String name)
Returns the role with the name in the company.

The method searches the system roles map first for default roles. If a role with the name is not found, then the method will query the database.

Parameters:
companyId - the primary key of the company
name - the role's name
Returns:
Returns the role with the name or null if a role with the name could not be found in the company

fetchRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role fetchRole(long roleId)

fetchRoleByUuidAndCompanyId

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role fetchRoleByUuidAndCompanyId(String uuid,
                                                                          long companyId)
Returns the role with the matching UUID and company.

Parameters:
uuid - the role's UUID
companyId - the primary key of the company
Returns:
the matching role, or null if a matching role could not be found

getActionableDynamicQuery

@Transactional(propagation=SUPPORTS,
               readOnly=true)
ActionableDynamicQuery getActionableDynamicQuery()

getDefaultGroupRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getDefaultGroupRole(long groupId)
                         throws PortalException
Returns the default role for the group with the primary key.

If the group is a site, then the default role is RoleConstants#SITE_MEMBER. If the group is an organization, then the default role is RoleConstants#ORGANIZATION_USER. If the group is a user or user group, then the default role is RoleConstants#POWER_USER. For all other group types, the default role is RoleConstants#USER.

Parameters:
groupId - the primary key of the group
Returns:
the default role for the group with the primary key
Throws:
PortalException

getExportActionableDynamicQuery

@Transactional(propagation=SUPPORTS,
               readOnly=true)
ExportActionableDynamicQuery getExportActionableDynamicQuery(PortletDataContext portletDataContext)

getGroupPrimaryKeys

@Transactional(propagation=SUPPORTS,
               readOnly=true)
long[] getGroupPrimaryKeys(long roleId)
Returns the groupIds of the groups associated with the role.

Parameters:
roleId - the roleId of the role
Returns:
long[] the groupIds of groups associated with the role

getGroupRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRelatedRoles(long groupId)
                                throws PortalException
Throws:
PortalException

getGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRoles(long groupId)

getGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRoles(long groupId,
                                                                  int start,
                                                                  int end)

getGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRoles(long groupId,
                                                                  int start,
                                                                  int end,
                                                                  OrderByComparator<Role> orderByComparator)

getGroupRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getGroupRolesCount(long groupId)

getIndexableActionableDynamicQuery

@Transactional(propagation=SUPPORTS,
               readOnly=true)
IndexableActionableDynamicQuery getIndexableActionableDynamicQuery()

getOSGiServiceIdentifier

String getOSGiServiceIdentifier()
Returns the OSGi service identifier.

Returns:
the OSGi service identifier

getPersistedModel

@Transactional(propagation=SUPPORTS,
               readOnly=true)
PersistedModel getPersistedModel(Serializable primaryKeyObj)
                                 throws PortalException
Specified by:
getPersistedModel in interface PersistedModelLocalService
Throws:
PortalException

getResourceBlockRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getResourceBlockRoles(long resourceBlockId,
                                                                          String className,
                                                                          String actionId)

getResourceRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Map<String,List<String>> getResourceRoles(long companyId,
                                                                                   String name,
                                                                                   int scope,
                                                                                   String primKey)
Returns a map of role names to associated action IDs for the named resource in the company within the permission scope.

Parameters:
companyId - the primary key of the company
name - the resource name
scope - the permission scope
primKey - the primary key of the resource's class
Returns:
the role names and action IDs
See Also:
RoleFinder.findByC_N_S_P( long, String, int, String)

getResourceRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getResourceRoles(long companyId,
                                                                     String name,
                                                                     int scope,
                                                                     String primKey,
                                                                     String actionId)
Returns all the roles associated with the action ID in the company within the permission scope.

Parameters:
companyId - the primary key of the company
name - the resource name
scope - the permission scope
primKey - the primary key of the resource's class
actionId - the name of the resource action
Returns:
the roles
See Also:
RoleFinder.findByC_N_S_P_A( long, String, int, String, String)

getRole

@Skip
@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getRole(long companyId,
                                                           String name)
             throws PortalException
Returns the role with the name in the company.

The method searches the system roles map first for default roles. If a role with the name is not found, then the method will query the database.

Parameters:
companyId - the primary key of the company
name - the role's name
Returns:
the role with the name
Throws:
PortalException

getRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getRole(long roleId)
             throws PortalException
Returns the role with the primary key.

Parameters:
roleId - the primary key of the role
Returns:
the role
Throws:
PortalException - if a role with the primary key could not be found

getRoleByUuidAndCompanyId

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getRoleByUuidAndCompanyId(String uuid,
                                                                        long companyId)
                               throws PortalException
Returns the role with the matching UUID and company.

Parameters:
uuid - the role's UUID
companyId - the primary key of the company
Returns:
the matching role
Throws:
PortalException - if a matching role could not be found

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(long companyId)
Returns all the roles in the company.

Parameters:
companyId - the primary key of the company
Returns:
the roles in the company

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(long companyId,
                                                             int[] types)
Returns all the roles with the types.

Parameters:
companyId - the primary key of the company
types - the role types (optionally null)
Returns:
the roles with the types

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(long[] roleIds)
                    throws PortalException
Returns all the roles with the primary keys.

Parameters:
roleIds - the primary keys of the roles
Returns:
the roles with the primary keys
Throws:
PortalException

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(int start,
                                                             int end)
Returns a range of all the roles.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil.ALL_POS), then the query will include the default ORDER BY logic from RoleModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
start - the lower bound of the range of roles
end - the upper bound of the range of roles (not inclusive)
Returns:
the range of roles

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(int type,
                                                             String subtype)
Returns all the roles of the type and subtype.

Parameters:
type - the role's type (optionally 0)
subtype - the role's subtype (optionally null)
Returns:
the roles of the type and subtype

getRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getRolesCount()
Returns the number of roles.

Returns:
the number of roles

getSubtypeRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getSubtypeRoles(String subtype)
Returns all the roles of the subtype.

Parameters:
subtype - the role's subtype (optionally null)
Returns:
the roles of the subtype

getSubtypeRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getSubtypeRolesCount(String subtype)
Returns the number of roles of the subtype.

Parameters:
subtype - the role's subtype (optionally null)
Returns:
the number of roles of the subtype

getTeamRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getTeamRole(long companyId,
                                                          long teamId)
                 throws PortalException
Returns the team role in the company.

Parameters:
companyId - the primary key of the company
teamId - the primary key of the team
Returns:
the team role in the company
Throws:
PortalException

getTeamRoleMap

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Map<Team,Role> getTeamRoleMap(long groupId)
                              throws PortalException
Returns the team role map for the group.

Parameters:
groupId - the primary key of the group
Returns:
the team role map for the group
Throws:
PortalException

getTeamRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getTeamRoles(long groupId)
                        throws PortalException
Returns the team roles in the group.

Parameters:
groupId - the primary key of the group
Returns:
the team roles in the group
Throws:
PortalException

getTeamRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getTeamRoles(long groupId,
                                                                 long[] excludedRoleIds)
                        throws PortalException
Returns the team roles in the group, excluding the specified role IDs.

Parameters:
groupId - the primary key of the group
excludedRoleIds - the primary keys of the roles to exclude (optionally null)
Returns:
the team roles in the group, excluding the specified role IDs
Throws:
PortalException

getTypeRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getTypeRoles(int type)
Returns all the roles of the type.

Parameters:
type - the role's type (optionally 0)
Returns:
the range of the roles of the type

getTypeRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getTypeRoles(int type,
                                                                 int start,
                                                                 int end)
Returns a range of all the roles of the type.

Parameters:
type - the role's type (optionally 0)
start - the lower bound of the range of roles to return
end - the upper bound of the range of roles to return (not inclusive)
Returns:
the range of the roles of the type

getTypeRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getTypeRolesCount(int type)
Returns the number of roles of the type.

Parameters:
type - the role's type (optionally 0)
Returns:
the number of roles of the type

getUserGroupGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserGroupGroupRoles(long userId,
                                                                           long groupId)
Returns all the user's roles within the user group.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Returns:
the user's roles within the user group
See Also:
RoleFinder.findByUserGroupGroupRole( long, long)

getUserGroupGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserGroupGroupRoles(long userId,
                                                                           long groupId,
                                                                           int start,
                                                                           int end)

getUserGroupGroupRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getUserGroupGroupRolesCount(long userId,
                                                                         long groupId)

getUserGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserGroupRoles(long userId,
                                                                      long groupId)
Returns all the user's roles within the user group.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Returns:
the user's roles within the user group
See Also:
RoleFinder.findByUserGroupRole( long, long)

getUserPrimaryKeys

@Transactional(propagation=SUPPORTS,
               readOnly=true)
long[] getUserPrimaryKeys(long roleId)
Returns the userIds of the users associated with the role.

Parameters:
roleId - the roleId of the role
Returns:
long[] the userIds of users associated with the role

getUserRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRelatedRoles(long userId,
                                                                        long groupId)
Returns all the user's roles within the group.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Returns:
the user's roles within the group
See Also:
RoleFinder.findByU_G(long, long)

getUserRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRelatedRoles(long userId,
                                                                        long[] groupIds)
Returns the union of all the user's roles within the groups.

Parameters:
userId - the primary key of the user
groupIds - the primary keys of the groups
Returns:
the union of all the user's roles within the groups
See Also:
RoleFinder.findByU_G(long, long[])

getUserRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRelatedRoles(long userId,
                                                                        List<Group> groups)
Returns the union of all the user's roles within the groups.

Parameters:
userId - the primary key of the user
groups - the groups (optionally null)
Returns:
the union of all the user's roles within the groups
See Also:
RoleFinder.findByU_G(long, List)

getUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRoles(long userId)

getUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRoles(long userId,
                                                                 int start,
                                                                 int end)

getUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRoles(long userId,
                                                                 int start,
                                                                 int end,
                                                                 OrderByComparator<Role> orderByComparator)

getUserRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getUserRolesCount(long userId)

hasGroupRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasGroupRole(long groupId,
                                                              long roleId)

hasGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasGroupRoles(long groupId)

hasUserRole

@ThreadLocalCachable
@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRole(long userId,
                                                                                 long companyId,
                                                                                 String name,
                                                                                 boolean inherited)
                    throws PortalException
Returns true if the user is associated with the named regular role.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
name - the name of the role
inherited - whether to include the user's inherited roles in the search
Returns:
true if the user is associated with the regular role; false otherwise
Throws:
PortalException

hasUserRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRole(long userId,
                                                             long roleId)

hasUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRoles(long userId)

hasUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRoles(long userId,
                                                              long companyId,
                                                              String[] names,
                                                              boolean inherited)
                     throws PortalException
Returns true if the user has any one of the named regular roles.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
names - the names of the roles
inherited - whether to include the user's inherited roles in the search
Returns:
true if the user has any one of the regular roles; false otherwise
Throws:
PortalException

loadFetchRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role loadFetchRole(long companyId,
                                                            String name)
Returns a role with the name in the company.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
Returns:
the role with the name, or null if a role with the name could not be found in the company

loadGetRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role loadGetRole(long companyId,
                                                          String name)
                 throws PortalException
Returns a role with the name in the company.

Parameters:
companyId - the primary key of the company
name - the role's name
Returns:
the role with the name in the company
Throws:
PortalException

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String keywords,
                                                           Integer[] types,
                                                           LinkedHashMap<String,Object> params,
                                                           int start,
                                                           int end,
                                                           OrderByComparator<Role> obc)
Returns an ordered range of all the roles that match the keywords, types, and params.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
params - the finder parameters. Can specify values for the "usersRoles" key. For more information, see RoleFinder
start - the lower bound of the range of roles to return
end - the upper bound of the range of roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
See Also:
RoleFinder

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String keywords,
                                                           Integer[] types,
                                                           int start,
                                                           int end,
                                                           OrderByComparator<Role> obc)
Returns an ordered range of all the roles that match the keywords and types.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
start - the lower bound of the range of roles to return
end - the upper bound of the range of roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
See Also:
RoleFinder

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String name,
                                                           String description,
                                                           Integer[] types,
                                                           LinkedHashMap<String,Object> params,
                                                           int start,
                                                           int end,
                                                           OrderByComparator<Role> obc)
Returns an ordered range of all the roles that match the name, description, types, and params.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
params - the finder's parameters. Can specify values for the "usersRoles" key. For more information, see RoleFinder
start - the lower bound of the range of the roles to return
end - the upper bound of the range of the roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
See Also:
RoleFinder

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String name,
                                                           String description,
                                                           Integer[] types,
                                                           int start,
                                                           int end,
                                                           OrderByComparator<Role> obc)
Returns an ordered range of all the roles that match the name, description, and types.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
start - the lower bound of the range of the roles to return
end - the upper bound of the range of the roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
See Also:
RoleFinder

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String keywords,
                                                         Integer[] types)
Returns the number of roles that match the keywords and types.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
Returns:
the number of matching roles

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String keywords,
                                                         Integer[] types,
                                                         LinkedHashMap<String,Object> params)
Returns the number of roles that match the keywords, types and params.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
params - the finder parameters. For more information, see RoleFinder
Returns:
the number of matching roles

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String name,
                                                         String description,
                                                         Integer[] types)
Returns the number of roles that match the name, description, and types.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
Returns:
the number of matching roles

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String name,
                                                         String description,
                                                         Integer[] types,
                                                         LinkedHashMap<String,Object> params)
Returns the number of roles that match the name, description, types, and params.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
params - the finder parameters. Can specify values for the "usersRoles" key. For more information, see RoleFinder
Returns:
the number of matching roles

setGroupRoles

void setGroupRoles(long groupId,
                   long[] roleIds)

setUserRoles

void setUserRoles(long userId,
                  long[] roleIds)
                  throws PortalException
Throws:
PortalException

unsetUserRoles

void unsetUserRoles(long userId,
                    long[] roleIds)
                    throws PortalException
Removes the matching roles associated with the user. The user is reindexed after the roles are removed.

Parameters:
userId - the primary key of the user
roleIds - the primary keys of the roles
Throws:
PortalException

updateRole

@Indexable(type=REINDEX)
Role updateRole(Role role)
Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
role - the role
Returns:
the role that was updated

updateRole

Role updateRole(long roleId,
                String name,
                Map<Locale,String> titleMap,
                Map<Locale,String> descriptionMap,
                String subtype,
                ServiceContext serviceContext)
                throws PortalException
Updates the role with the primary key.

Parameters:
roleId - the primary key of the role
name - the role's new name
titleMap - the new localized titles (optionally null) to replace those existing for the role
descriptionMap - the new localized descriptions (optionally null) to replace those existing for the role
subtype - the role's new subtype (optionally null)
serviceContext - the service context to be applied (optionally null). Can set expando bridge attributes for the role.
Returns:
the role with the primary key
Throws:
PortalException

Liferay 7.0-ce-b4