Interface RoleLocalService
- All Superinterfaces:
BaseLocalService,CTService<Role>,PersistedModelLocalService
- All Known Implementing Classes:
RoleLocalServiceWrapper
- Author:
- Brian Wing Shun Chan
- See Also:
- {$generated.description}
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddGroupRole(long groupId, long roleId) booleanaddGroupRole(long groupId, Role role) booleanaddGroupRoles(long groupId, long[] roleIds) booleanaddGroupRoles(long groupId, List<Role> roles) Adds the role to the database.addRole(String externalReferenceCode, long userId, String className, long classPK, String name, Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, int type, String subtype, ServiceContext serviceContext) booleanaddUserRole(long userId, long roleId) booleanaddUserRole(long userId, Role role) booleanaddUserRoles(long userId, long[] roleIds) booleanaddUserRoles(long userId, List<Role> roles) voidChecks to ensure that the system roles map has appropriate default roles in each company.voidcheckSystemRoles(long companyId) Checks to ensure that the system roles map has appropriate default roles in the company.voidclearGroupRoles(long groupId) voidclearUserRoles(long userId) createPersistedModel(Serializable primaryKeyObj) createRole(long roleId) Creates a new role with the primary key.voiddeleteGroupRole(long groupId, long roleId) voiddeleteGroupRole(long groupId, Role role) voiddeleteGroupRoles(long groupId, long[] roleIds) voiddeleteGroupRoles(long groupId, List<Role> roles) deletePersistedModel(PersistedModel persistedModel) deleteRole(long roleId) Deletes the role with the primary key from the database.deleteRole(Role role) Deletes the role from the database.voiddeleteUserRole(long userId, long roleId) voiddeleteUserRole(long userId, Role role) voiddeleteUserRoles(long userId, long[] roleIds) voiddeleteUserRoles(long userId, List<Role> roles) <T> TdslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) intdslQueryCount(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) <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.longdynamicQueryCount(DynamicQuery dynamicQuery) Returns the number of rows matching the dynamic query.longdynamicQueryCount(DynamicQuery dynamicQuery, Projection projection) Returns the number of rows matching the dynamic query.fetchRole(long roleId) Returns the role with the name in the company.fetchRoleByExternalReferenceCode(String externalReferenceCode, long companyId) fetchRoleByUuidAndCompanyId(String uuid, long companyId) Returns the role with the matching UUID and company.intgetAssigneesTotal(long roleId) getDefaultGroupRole(long groupId) Returns the default role for the group with the primary key.getExportActionableDynamicQuery(PortletDataContext portletDataContext) long[]getGroupPrimaryKeys(long roleId) Returns the groupIds of the groups associated with the role.getGroupRelatedRoles(long groupId) getGroupRoles(long groupId) getGroupRoles(long groupId, int start, int end) getGroupRoles(long groupId, int start, int end, OrderByComparator<Role> orderByComparator) getGroupRolesAndTeamRoles(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId, int start, int end) intgetGroupRolesAndTeamRolesCount(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId) intgetGroupRolesCount(long groupId) Returns the OSGi service identifier.getPersistedModel(Serializable primaryKeyObj) 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.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.getRole(long roleId) Returns the role with the primary key.Returns the role with the name in the company.getRoleByExternalReferenceCode(String externalReferenceCode, long companyId) getRoleByUuidAndCompanyId(String uuid, long companyId) Returns the role with the matching UUID and company.getRoles(int start, int end) Returns a range of all the roles.Returns all the roles of the type and subtype.getRoles(long companyId) Returns all the roles in the company.getRoles(long[] roleIds) Returns all the roles with the primary keys.getRoles(long companyId, int[] types) Returns all the roles with the types.getRoles(long companyId, long classNameId, long[] classPKs, int type) intReturns the number of roles.getSubtypeRoles(String subtype) Returns all the roles of the subtype.intgetSubtypeRolesCount(String subtype) Returns the number of roles of the subtype.getTeamRole(long companyId, long teamId) Returns the team role in the company.getTeamRoleMap(long groupId) Returns the team role map for the group.getTeamRoles(long groupId) Returns the team roles in the group.getTeamRoles(long groupId, long[] excludedRoleIds) Returns the team roles in the group, excluding the specified role IDs.getTeamsRoles(long companyId, long[] teamIds) Returns the team roles in the company.getTypeRoles(int type) Returns all the roles of the type.getTypeRoles(int type, int start, int end) Returns a range of all the roles of the type.intgetTypeRolesCount(int type) Returns the number of roles of the type.getUserGroupGroupRoles(long userId, long groupId) Returns all the user's roles within the user group.getUserGroupGroupRoles(long userId, long groupId, int start, int end) intgetUserGroupGroupRolesCount(long userId, long groupId) 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.getUserRelatedRoles(long userId, long groupId) Returns all the user's roles within the group.getUserRelatedRoles(long userId, long[] groupIds) Returns the union of all the user's roles within the groups.getUserRelatedRoles(long userId, List<Group> groups) Returns the union of all the user's roles within the groups.getUserRoles(long userId) getUserRoles(long userId, int start, int end) getUserRoles(long userId, int start, int end, OrderByComparator<Role> orderByComparator) intgetUserRolesCount(long userId) getUserTeamRoles(long userId, long groupId) booleanhasGroupRole(long groupId, long roleId) booleanhasGroupRoles(long groupId) booleanhasUserRole(long userId, long roleId) booleanhasUserRole(long userId, long companyId, String name, boolean inherited) Returnstrueif the user is associated with the named regular role.booleanhasUserRoles(long userId) booleanhasUserRoles(long userId, long companyId, String[] names, boolean inherited) Returnstrueif the user has any one of the named regular roles.search(long companyId, String keywords, Integer[] types, int start, int end, OrderByComparator<Role> orderByComparator) Returns an ordered range of all the roles that match the keywords and types.search(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params, int start, int end, OrderByComparator<Role> orderByComparator) Returns an ordered range of all the roles that match the keywords, types, and params.search(long companyId, String name, String description, Integer[] types, int start, int end, OrderByComparator<Role> orderByComparator) Returns an ordered range of all the roles that match the name, description, and types.search(long companyId, String name, String description, Integer[] types, LinkedHashMap<String, Object> params, int start, int end, OrderByComparator<Role> orderByComparator) Returns an ordered range of all the roles that match the name, description, types, and params.intsearchCount(long companyId, String keywords, Integer[] types) Returns the number of roles that match the keywords and types.intsearchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params) Returns the number of roles that match the keywords, types and params.intsearchCount(long companyId, String name, String description, Integer[] types) Returns the number of roles that match the name, description, and types.intsearchCount(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.voidsetGroupRoles(long groupId, long[] roleIds) voidsetUserRoles(long userId, long[] roleIds) voidunsetUserRoles(long userId, long[] roleIds) Removes the matching roles associated with the user.updateExternalReferenceCode(long roleId, String externalReferenceCode) updateExternalReferenceCode(Role role, String externalReferenceCode) updateRole(long roleId, String name, Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, String subtype, ServiceContext serviceContext) Updates the role with the primary key.updateRole(Role role) Updates the role in the database or adds it if it does not yet exist.<R,E extends Throwable>
RupdateWithUnsafeFunction(com.liferay.petra.function.UnsafeFunction<CTPersistence<Role>, R, E> updateUnsafeFunction) voidvalidateName(String name) Methods inherited from interface com.liferay.portal.kernel.service.PersistedModelLocalService
fetchPersistedModel, getBasePersistence
-
Method Details
-
addGroupRole
boolean addGroupRole(long groupId, long roleId) -
addGroupRole
-
addGroupRoles
-
addGroupRoles
boolean addGroupRoles(long groupId, long[] roleIds) -
addRole
Adds the role to the database. Also notifies the appropriate model listeners.Important: Inspect RoleLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
role- the role- Returns:
- the role that was added
-
addRole
Role addRole(String externalReferenceCode, long userId, String className, long classPK, String name, Map<Locale, String> titleMap, Map<Locale, throws PortalExceptionString> descriptionMap, int type, String subtype, ServiceContext serviceContext) - Throws:
PortalException
-
addUserRole
- Throws:
PortalException
-
addUserRole
- Throws:
PortalException
-
addUserRoles
- Throws:
PortalException
-
addUserRoles
- Throws:
PortalException
-
checkSystemRoles
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
- Throws:
PortalException
-
createPersistedModel
- Specified by:
createPersistedModelin interfacePersistedModelLocalService- Throws:
PortalException
-
createRole
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, long roleId) -
deleteGroupRole
-
deleteGroupRoles
-
deleteGroupRoles
void deleteGroupRoles(long groupId, long[] roleIds) -
deletePersistedModel
- Specified by:
deletePersistedModelin interfacePersistedModelLocalService- Throws:
PortalException
-
deleteRole
Deletes the role with the primary key from the database. Also notifies the appropriate model listeners.Important: Inspect RoleLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- 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
-
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.Important: Inspect RoleLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
role- the role- Returns:
- the role that was removed
- Throws:
PortalException
-
deleteUserRole
- Throws:
PortalException
-
deleteUserRole
- Throws:
PortalException
-
deleteUserRoles
- Throws:
PortalException
-
deleteUserRoles
- Throws:
PortalException
-
dslQuery
@Transactional(propagation=SUPPORTS, readOnly=true) <T> T dslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) - Specified by:
dslQueryin interfacePersistedModelLocalService
-
dslQueryCount
@Transactional(propagation=SUPPORTS, readOnly=true) int dslQueryCount(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) - Specified by:
dslQueryCountin interfacePersistedModelLocalService
-
dynamicQuery
-
dynamicQuery
@Transactional(propagation=SUPPORTS, readOnly=true) <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
@Transactional(propagation=SUPPORTS, readOnly=true) <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 - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtocom.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromcom.liferay.portal.model.impl.RoleModelImpl.- Parameters:
dynamicQuery- the dynamic querystart- the lower bound of the range of model instancesend- the upper bound of the range of model instances (not inclusive)- Returns:
- the range of matching rows
-
dynamicQuery
@Transactional(propagation=SUPPORTS, readOnly=true) <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 - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtocom.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromcom.liferay.portal.model.impl.RoleModelImpl.- Parameters:
dynamicQuery- the dynamic querystart- the lower bound of the range of model instancesend- the upper bound of the range of model instances (not inclusive)orderByComparator- the comparator to order the results by (optionallynull)- Returns:
- the ordered range of matching rows
-
dynamicQueryCount
@Transactional(propagation=SUPPORTS, readOnly=true) 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
@Transactional(propagation=SUPPORTS, readOnly=true) long dynamicQueryCount(DynamicQuery dynamicQuery, Projection projection) Returns the number of rows matching the dynamic query.- Parameters:
dynamicQuery- the dynamic queryprojection- the projection to apply to the query- Returns:
- the number of rows matching the dynamic query
-
fetchRole
-
fetchRole
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 companyname- the role's name- Returns:
- Returns the role with the name or
nullif a role with the name could not be found in the company
-
fetchRoleByExternalReferenceCode
@Transactional(propagation=SUPPORTS, readOnly=true) Role fetchRoleByExternalReferenceCode(String externalReferenceCode, long companyId) -
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 UUIDcompanyId- the primary key of the company- Returns:
- the matching role, or
nullif a matching role could not be found
-
getActionableDynamicQuery
@Transactional(propagation=SUPPORTS, readOnly=true) ActionableDynamicQuery getActionableDynamicQuery() -
getAssigneesTotal
@Transactional(propagation=SUPPORTS, readOnly=true) int getAssigneesTotal(long roleId) throws PortalException - Throws:
PortalException
-
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 isRoleConstants#ORGANIZATION_USER. If the group is a user or user group, then the default role isRoleConstants#POWER_USER. For all other group types, the default role isRoleConstants#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
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
-
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) -
getGroupRolesAndTeamRoles
-
getGroupRolesAndTeamRolesCount
@Transactional(propagation=SUPPORTS, readOnly=true) int getGroupRolesAndTeamRolesCount(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId) -
getGroupRolesCount
-
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:
getPersistedModelin interfacePersistedModelLocalService- Throws:
PortalException
-
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 companyname- the resource namescope- the permission scopeprimKey- the primary key of the resource's class- Returns:
- the role names and action IDs
-
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 companyname- the resource namescope- the permission scopeprimKey- the primary key of the resource's classactionId- the name of the resource action- Returns:
- the roles
-
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
-
getRole
@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 companyname- the role's name- Returns:
- the role with the name
- Throws:
PortalException
-
getRoleByExternalReferenceCode
@Transactional(propagation=SUPPORTS, readOnly=true) Role getRoleByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException - Throws:
PortalException
-
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 UUIDcompanyId- the primary key of the company- Returns:
- the matching role
- Throws:
PortalException- if a matching role could not be found
-
getRoles
Returns a range of all the roles.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtocom.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromcom.liferay.portal.model.impl.RoleModelImpl.- Parameters:
start- the lower bound of the range of rolesend- the upper bound of the range of roles (not inclusive)- Returns:
- the range of roles
-
getRoles
Returns all the roles of the type and subtype.- Parameters:
type- the role's type (optionally0)subtype- the role's subtype (optionallynull)- Returns:
- the roles of the type and subtype
-
getRoles
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 companytypes- the role types (optionallynull)- Returns:
- the roles with the types
-
getRoles
@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getRoles(long companyId, long classNameId, long[] classPKs, int type) -
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
-
getRolesCount
Returns the number of roles.- Returns:
- the number of roles
-
getSubtypeRoles
Returns all the roles of the subtype.- Parameters:
subtype- the role's subtype (optionallynull)- Returns:
- the roles of the subtype
-
getSubtypeRolesCount
Returns the number of roles of the subtype.- Parameters:
subtype- the role's subtype (optionallynull)- 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 companyteamId- 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 groupexcludedRoleIds- the primary keys of the roles to exclude (optionallynull)- Returns:
- the team roles in the group, excluding the specified role IDs
- Throws:
PortalException
-
getTeamsRoles
@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getTeamsRoles(long companyId, long[] teamIds) throws PortalException Returns the team roles in the company.- Parameters:
companyId- the primary key of the companyteamIds- the primary keys of the teams- Returns:
- the team roles in the company
- Throws:
PortalException
-
getTypeRoles
Returns all the roles of the type.- Parameters:
type- the role's type (optionally0)- 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 (optionally0)start- the lower bound of the range of roles to returnend- the upper bound of the range of roles to return (not inclusive)- Returns:
- the range of the roles of the type
-
getTypeRolesCount
Returns the number of roles of the type.- Parameters:
type- the role's type (optionally0)- 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 usergroupId- the primary key of the group- Returns:
- the user's roles within the user group
-
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 usergroupId- the primary key of the group- Returns:
- the user's roles within the user group
-
getUserPrimaryKeys
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, List<Group> groups) Returns the union of all the user's roles within the groups. If no groups are provided, only the user's directly assigned roles are returned.- Parameters:
userId- the primary key of the usergroups- the groups (optionallynull)- Returns:
- the union of all the user's roles within the groups
-
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 usergroupId- the primary key of the group- Returns:
- the user's roles within the group
-
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. If no groupIds are provided, only the user's directly assigned roles are returned.- Parameters:
userId- the primary key of the usergroupIds- the primary keys of the groups- Returns:
- the union of all the user's roles within the groups
-
getUserRoles
-
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
-
getUserTeamRoles
@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getUserTeamRoles(long userId, long groupId) -
hasGroupRole
-
hasGroupRoles
-
hasUserRole
-
hasUserRole
@ThreadLocalCachable @Transactional(propagation=SUPPORTS, readOnly=true) boolean hasUserRole(long userId, long companyId, String name, boolean inherited) throws PortalException Returnstrueif the user is associated with the named regular role.- Parameters:
userId- the primary key of the usercompanyId- the primary key of the companyname- the name of the roleinherited- whether to include the user's inherited roles in the search- Returns:
trueif the user is associated with the regular role;falseotherwise- Throws:
PortalException
-
hasUserRoles
-
hasUserRoles
@Transactional(propagation=SUPPORTS, readOnly=true) boolean hasUserRoles(long userId, long companyId, String[] names, boolean inherited) throws PortalException Returnstrueif the user has any one of the named regular roles.- Parameters:
userId- the primary key of the usercompanyId- the primary key of the companynames- the names of the rolesinherited- whether to include the user's inherited roles in the search- Returns:
trueif the user has any one of the regular roles;falseotherwise- Throws:
PortalException
-
search
@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> search(long companyId, String keywords, Integer[] types, int start, int end, OrderByComparator<Role> orderByComparator) Returns an ordered range of all the roles that match the keywords and types.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the companykeywords- the keywords (space separated), which may occur in the role's name or description (optionallynull)types- the role types (optionallynull)start- the lower bound of the range of roles to returnend- the upper bound of the range of roles to return (not inclusive)orderByComparator- the comparator to order the roles (optionallynull)- Returns:
- the ordered range of the matching roles, ordered by
orderByComparator - See Also:
-
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> orderByComparator) Returns an ordered range of all the roles that match the keywords, types, and params.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the companykeywords- the keywords (space separated), which may occur in the role's name or description (optionallynull)types- the role types (optionallynull)params- the finder parameters. Can specify values for the "usersRoles" key. For more information, seeRoleFinderstart- the lower bound of the range of roles to returnend- the upper bound of the range of roles to return (not inclusive)orderByComparator- the comparator to order the roles (optionallynull)- Returns:
- the ordered range of the matching roles, ordered by
orderByComparator - See Also:
-
search
@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> search(long companyId, String name, String description, Integer[] types, int start, int end, OrderByComparator<Role> orderByComparator) Returns an ordered range of all the roles that match the name, description, and types.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the companyname- the role's name (optionallynull)description- the role's description (optionallynull)types- the role types (optionallynull)start- the lower bound of the range of the roles to returnend- the upper bound of the range of the roles to return (not inclusive)orderByComparator- the comparator to order the roles (optionallynull)- Returns:
- the ordered range of the matching roles, ordered by
orderByComparator - See Also:
-
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> orderByComparator) 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 - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the companyname- the role's name (optionallynull)description- the role's description (optionallynull)types- the role types (optionallynull)params- the finder's parameters. Can specify values for the "usersRoles" key. For more information, seeRoleFinderstart- the lower bound of the range of the roles to returnend- the upper bound of the range of the roles to return (not inclusive)orderByComparator- the comparator to order the roles (optionallynull)- Returns:
- the ordered range of the matching roles, ordered by
orderByComparator - See Also:
-
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 companykeywords- the keywords (space separated), which may occur in the role's name or description (optionallynull)types- the role types (optionallynull)- 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 companykeywords- the keywords (space separated), which may occur in the role's name or description (optionallynull)types- the role types (optionallynull)params- the finder parameters. For more information, seeRoleFinder- 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 companyname- the role's name (optionallynull)description- the role's description (optionallynull)types- the role types (optionallynull)- 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 companyname- the role's name (optionallynull)description- the role's description (optionallynull)types- the role types (optionallynull)params- the finder parameters. Can specify values for the "usersRoles" key. For more information, seeRoleFinder- Returns:
- the number of matching roles
-
setGroupRoles
void setGroupRoles(long groupId, long[] roleIds) -
setUserRoles
- Throws:
PortalException
-
unsetUserRoles
Removes the matching roles associated with the user. The user is reindexed after the roles are removed.- Parameters:
userId- the primary key of the userroleIds- the primary keys of the roles- Throws:
PortalException
-
updateExternalReferenceCode
- Throws:
PortalException
-
updateExternalReferenceCode
- Throws:
PortalException
-
updateRole
Role updateRole(long roleId, String name, Map<Locale, String> titleMap, Map<Locale, throws PortalExceptionString> descriptionMap, String subtype, ServiceContext serviceContext) Updates the role with the primary key.- Parameters:
roleId- the primary key of the rolename- the role's new nametitleMap- the new localized titles (optionallynull) to replace those existing for the roledescriptionMap- the new localized descriptions (optionallynull) to replace those existing for the rolesubtype- the role's new subtype (optionallynull)serviceContext- the service context to be applied (optionallynull). Can set expando bridge attributes for the role.- Returns:
- the role with the primary key
- Throws:
PortalException
-
updateRole
Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.Important: Inspect RoleLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
role- the role- Returns:
- the role that was updated
-
validateName
- Throws:
PortalException
-
getCTPersistence
- Specified by:
getCTPersistencein interfaceCTService<Role>
-
getModelClass
- Specified by:
getModelClassin interfaceCTService<Role>
-
updateWithUnsafeFunction
@Transactional(rollbackFor=java.lang.Throwable.class) <R,E extends Throwable> R updateWithUnsafeFunction(com.liferay.petra.function.UnsafeFunction<CTPersistence<Role>, R, throws EE> updateUnsafeFunction) - Specified by:
updateWithUnsafeFunctionin interfaceCTService<Role>- Throws:
E extends Throwable
-