Class RoleServiceWrapper
Object
com.liferay.portal.kernel.service.RoleServiceWrapper
- All Implemented Interfaces:
BaseService
,RoleService
,ServiceWrapper<RoleService>
Provides a wrapper for
RoleService
.- Author:
- Brian Wing Shun Chan
- See Also:
- {$generated.description}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRole
(String externalReferenceCode, String className, long classPK, String name, Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, int type, String subtype, ServiceContext serviceContext) void
addUserRoles
(long userId, long[] roleIds) Adds the roles to the user.void
deleteRole
(long roleId) Deletes the role with the primary key and its associated permissions.fetchRole
(long roleId) fetchRoleByExternalReferenceCode
(String externalReferenceCode, long companyId) getGroupRoles
(long groupId) Returns all the roles associated with the group.getGroupRolesAndTeamRoles
(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId, int start, int end) int
getGroupRolesAndTeamRolesCount
(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId) Returns the OSGi service identifier.getRole
(long roleId) Returns the role with the primary key.Returns the role with the name in the company.getRoleByExternalReferenceCode
(String externalReferenceCode, long companyId) getRoles
(long companyId, int[] types) getUserGroupGroupRoles
(long userId, long groupId) Returns all the user's roles within the user group.getUserGroupRoles
(long userId, long groupId) Returns all the user's roles within the user group.getUserRelatedRoles
(long userId, List<Group> groups) Returns the union of all the user's roles within the groups.getUserRoles
(long userId) Returns all the roles associated with the user.boolean
hasUserRole
(long userId, long companyId, String name, boolean inherited) Returnstrue
if the user is associated with the named regular role.boolean
hasUserRoles
(long userId, long companyId, String[] names, boolean inherited) Returnstrue
if the user has any one of the named regular roles.search
(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params, int start, int end, OrderByComparator<Role> orderByComparator) int
searchCount
(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params) void
setWrappedService
(RoleService roleService) void
unsetUserRoles
(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.
-
Constructor Details
-
RoleServiceWrapper
public RoleServiceWrapper() -
RoleServiceWrapper
-
-
Method Details
-
addRole
public Role addRole(String externalReferenceCode, String className, long classPK, String name, Map<Locale, String> titleMap, Map<Locale, throws PortalExceptionString> descriptionMap, int type, String subtype, ServiceContext serviceContext) - Specified by:
addRole
in interfaceRoleService
- Throws:
PortalException
-
addUserRoles
Adds the roles to the user. The user is reindexed after the roles are added.- Specified by:
addUserRoles
in interfaceRoleService
- Parameters:
userId
- the primary key of the userroleIds
- the primary keys of the roles- Throws:
PortalException
-
deleteRole
Deletes the role with the primary key and its associated permissions.- Specified by:
deleteRole
in interfaceRoleService
- Parameters:
roleId
- the primary key of the role- Throws:
PortalException
-
fetchRole
- Specified by:
fetchRole
in interfaceRoleService
- Throws:
PortalException
-
fetchRole
- Specified by:
fetchRole
in interfaceRoleService
- Throws:
PortalException
-
fetchRoleByExternalReferenceCode
public Role fetchRoleByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException - Specified by:
fetchRoleByExternalReferenceCode
in interfaceRoleService
- Throws:
PortalException
-
getGroupRoles
Returns all the roles associated with the group.- Specified by:
getGroupRoles
in interfaceRoleService
- Parameters:
groupId
- the primary key of the group- Returns:
- the roles associated with the group
- Throws:
PortalException
-
getGroupRolesAndTeamRoles
public List<Role> getGroupRolesAndTeamRoles(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId, int start, int end) - Specified by:
getGroupRolesAndTeamRoles
in interfaceRoleService
-
getGroupRolesAndTeamRolesCount
public int getGroupRolesAndTeamRolesCount(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId) - Specified by:
getGroupRolesAndTeamRolesCount
in interfaceRoleService
-
getOSGiServiceIdentifier
Returns the OSGi service identifier.- Specified by:
getOSGiServiceIdentifier
in interfaceRoleService
- Returns:
- the OSGi service identifier
-
getRole
Returns the role with the primary key.- Specified by:
getRole
in interfaceRoleService
- Parameters:
roleId
- the primary key of the role- Returns:
- the role with the primary key
- Throws:
PortalException
-
getRole
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.
- Specified by:
getRole
in interfaceRoleService
- Parameters:
companyId
- the primary key of the companyname
- the role's name- Returns:
- the role with the name
- Throws:
PortalException
-
getRoleByExternalReferenceCode
public Role getRoleByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException - Specified by:
getRoleByExternalReferenceCode
in interfaceRoleService
- Throws:
PortalException
-
getRoles
- Specified by:
getRoles
in interfaceRoleService
- Throws:
PortalException
-
getRoles
- Specified by:
getRoles
in interfaceRoleService
- Throws:
PortalException
-
getUserGroupGroupRoles
Returns all the user's roles within the user group.- Specified by:
getUserGroupGroupRoles
in interfaceRoleService
- Parameters:
userId
- the primary key of the usergroupId
- the primary key of the group- Returns:
- the user's roles within the user group
- Throws:
PortalException
-
getUserGroupRoles
Returns all the user's roles within the user group.- Specified by:
getUserGroupRoles
in interfaceRoleService
- Parameters:
userId
- the primary key of the usergroupId
- the primary key of the group- Returns:
- the user's roles within the user group
- Throws:
PortalException
-
getUserRelatedRoles
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.- Specified by:
getUserRelatedRoles
in interfaceRoleService
- Parameters:
userId
- the primary key of the usergroups
- the groups (optionallynull
)- Returns:
- the union of all the user's roles within the groups
- Throws:
PortalException
-
getUserRoles
Returns all the roles associated with the user.- Specified by:
getUserRoles
in interfaceRoleService
- Parameters:
userId
- the primary key of the user- Returns:
- the roles associated with the user
- Throws:
PortalException
-
hasUserRole
public boolean hasUserRole(long userId, long companyId, String name, boolean inherited) throws PortalException Returnstrue
if the user is associated with the named regular role.- Specified by:
hasUserRole
in interfaceRoleService
- 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:
true
if the user is associated with the regular role;false
otherwise- Throws:
PortalException
-
hasUserRoles
public boolean hasUserRoles(long userId, long companyId, String[] names, boolean inherited) throws PortalException Returnstrue
if the user has any one of the named regular roles.- Specified by:
hasUserRoles
in interfaceRoleService
- 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:
true
if the user has any one of the regular roles;false
otherwise- Throws:
PortalException
-
search
public List<Role> search(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params, int start, int end, OrderByComparator<Role> orderByComparator) - Specified by:
search
in interfaceRoleService
-
searchCount
public int searchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params) - Specified by:
searchCount
in interfaceRoleService
-
unsetUserRoles
Removes the matching roles associated with the user. The user is reindexed after the roles are removed.- Specified by:
unsetUserRoles
in interfaceRoleService
- Parameters:
userId
- the primary key of the userroleIds
- the primary keys of the roles- Throws:
PortalException
-
updateExternalReferenceCode
public Role updateExternalReferenceCode(long roleId, String externalReferenceCode) throws PortalException - Specified by:
updateExternalReferenceCode
in interfaceRoleService
- Throws:
PortalException
-
updateExternalReferenceCode
public Role updateExternalReferenceCode(Role role, String externalReferenceCode) throws PortalException - Specified by:
updateExternalReferenceCode
in interfaceRoleService
- Throws:
PortalException
-
updateRole
public 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.- Specified by:
updateRole
in interfaceRoleService
- 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 the expando bridge attributes for the role.- Returns:
- the role with the primary key
- Throws:
PortalException
-
getWrappedService
- Specified by:
getWrappedService
in interfaceServiceWrapper<RoleService>
-
setWrappedService
- Specified by:
setWrappedService
in interfaceServiceWrapper<RoleService>
-