@ProviderType
public class RoleLocalServiceUtil
extends Object
RoleLocalServiceImpl
and is the
primary access point for service operations in application layer code running
on the local server. 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.RoleLocalService
,
RoleLocalServiceBaseImpl
,
RoleLocalServiceImpl
Constructor and Description |
---|
RoleLocalServiceUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addGroupRole(long groupId,
long roleId) |
static void |
addGroupRole(long groupId,
Role role) |
static void |
addGroupRoles(long groupId,
List<Role> roles) |
static void |
addGroupRoles(long groupId,
long[] roleIds) |
static 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.
|
static Role |
addRole(Role role)
Adds the role to the database.
|
static void |
addUserRole(long userId,
long roleId) |
static void |
addUserRole(long userId,
Role role) |
static void |
addUserRoles(long userId,
List<Role> roles) |
static void |
addUserRoles(long userId,
long[] roleIds) |
static void |
checkSystemRoles()
Checks to ensure that the system roles map has appropriate default roles
in each company.
|
static void |
checkSystemRoles(long companyId)
Checks to ensure that the system roles map has appropriate default roles
in the company.
|
static void |
clearGroupRoles(long groupId) |
static void |
clearUserRoles(long userId) |
static Role |
createRole(long roleId)
Creates a new role with the primary key.
|
static void |
deleteGroupRole(long groupId,
long roleId) |
static void |
deleteGroupRole(long groupId,
Role role) |
static void |
deleteGroupRoles(long groupId,
List<Role> roles) |
static void |
deleteGroupRoles(long groupId,
long[] roleIds) |
static PersistedModel |
deletePersistedModel(PersistedModel persistedModel) |
static Role |
deleteRole(long roleId)
Deletes the role with the primary key from the database.
|
static Role |
deleteRole(Role role)
Deletes the role from the database.
|
static void |
deleteUserRole(long userId,
long roleId) |
static void |
deleteUserRole(long userId,
Role role) |
static void |
deleteUserRoles(long userId,
List<Role> roles) |
static void |
deleteUserRoles(long userId,
long[] roleIds) |
static DynamicQuery |
dynamicQuery() |
static <T> List<T> |
dynamicQuery(DynamicQuery dynamicQuery)
Performs a dynamic query on the database and returns the matching rows.
|
static <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.
|
static <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.
|
static long |
dynamicQueryCount(DynamicQuery dynamicQuery)
Returns the number of rows matching the dynamic query.
|
static long |
dynamicQueryCount(DynamicQuery dynamicQuery,
Projection projection)
Returns the number of rows matching the dynamic query.
|
static Role |
fetchRole(long roleId) |
static Role |
fetchRole(long companyId,
String name)
Returns the role with the name in the company.
|
static Role |
fetchRoleByUuidAndCompanyId(String uuid,
long companyId)
Returns the role with the matching UUID and company.
|
static ActionableDynamicQuery |
getActionableDynamicQuery() |
static int |
getAssigneesTotal(long roleId) |
static Role |
getDefaultGroupRole(long groupId)
Returns the default role for the group with the primary key.
|
static ExportActionableDynamicQuery |
getExportActionableDynamicQuery(PortletDataContext portletDataContext) |
static long[] |
getGroupPrimaryKeys(long roleId)
Returns the groupIds of the groups associated with the role.
|
static List<Role> |
getGroupRelatedRoles(long groupId) |
static List<Role> |
getGroupRoles(long groupId) |
static List<Role> |
getGroupRoles(long groupId,
int start,
int end) |
static List<Role> |
getGroupRoles(long groupId,
int start,
int end,
OrderByComparator<Role> orderByComparator) |
static List<Role> |
getGroupRolesAndTeamRoles(long companyId,
String keywords,
List<String> excludedNames,
int[] types,
long excludedTeamRoleId,
long teamGroupId,
int start,
int end) |
static int |
getGroupRolesAndTeamRolesCount(long companyId,
String keywords,
List<String> excludedNames,
int[] types,
long excludedTeamRoleId,
long teamGroupId) |
static int |
getGroupRolesCount(long groupId) |
static IndexableActionableDynamicQuery |
getIndexableActionableDynamicQuery() |
static String |
getOSGiServiceIdentifier()
Returns the OSGi service identifier.
|
static PersistedModel |
getPersistedModel(Serializable primaryKeyObj) |
static List<Role> |
getResourceBlockRoles(long resourceBlockId,
String className,
String actionId)
Deprecated.
As of Judson (7.1.x), with no direct replacement
|
static 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.
|
static 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.
|
static Role |
getRole(long roleId)
Returns the role with the primary key.
|
static Role |
getRole(long companyId,
String name)
Returns the role with the name in the company.
|
static Role |
getRoleByUuidAndCompanyId(String uuid,
long companyId)
Returns the role with the matching UUID and company.
|
static List<Role> |
getRoles(int start,
int end)
Returns a range of all the roles.
|
static List<Role> |
getRoles(int type,
String subtype)
Returns all the roles of the type and subtype.
|
static List<Role> |
getRoles(long companyId)
Returns all the roles in the company.
|
static List<Role> |
getRoles(long[] roleIds)
Returns all the roles with the primary keys.
|
static List<Role> |
getRoles(long companyId,
int[] types)
Returns all the roles with the types.
|
static int |
getRolesCount()
Returns the number of roles.
|
static RoleLocalService |
getService() |
static List<Role> |
getSubtypeRoles(String subtype)
Returns all the roles of the subtype.
|
static int |
getSubtypeRolesCount(String subtype)
Returns the number of roles of the subtype.
|
static Role |
getTeamRole(long companyId,
long teamId)
Returns the team role in the company.
|
static Map<Team,Role> |
getTeamRoleMap(long groupId)
Returns the team role map for the group.
|
static List<Role> |
getTeamRoles(long groupId)
Returns the team roles in the group.
|
static List<Role> |
getTeamRoles(long groupId,
long[] excludedRoleIds)
Returns the team roles in the group, excluding the specified role IDs.
|
static List<Role> |
getTeamsRoles(long companyId,
long[] teamIds)
Returns the team roles in the company.
|
static List<Role> |
getTypeRoles(int type)
Returns all the roles of the type.
|
static List<Role> |
getTypeRoles(int type,
int start,
int end)
Returns a range of all the roles of the type.
|
static int |
getTypeRolesCount(int type)
Returns the number of roles of the type.
|
static List<Role> |
getUserGroupGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
static List<Role> |
getUserGroupGroupRoles(long userId,
long groupId,
int start,
int end) |
static int |
getUserGroupGroupRolesCount(long userId,
long groupId) |
static List<Role> |
getUserGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
static long[] |
getUserPrimaryKeys(long roleId)
Returns the userIds of the users associated with the role.
|
static List<Role> |
getUserRelatedRoles(long userId,
List<Group> groups)
Returns the union of all the user's roles within the groups.
|
static List<Role> |
getUserRelatedRoles(long userId,
long groupId)
Returns all the user's roles within the group.
|
static List<Role> |
getUserRelatedRoles(long userId,
long[] groupIds)
Returns the union of all the user's roles within the groups.
|
static List<Role> |
getUserRoles(long userId) |
static List<Role> |
getUserRoles(long userId,
int start,
int end) |
static List<Role> |
getUserRoles(long userId,
int start,
int end,
OrderByComparator<Role> orderByComparator) |
static int |
getUserRolesCount(long userId) |
static List<Role> |
getUserTeamRoles(long userId,
long groupId) |
static boolean |
hasGroupRole(long groupId,
long roleId) |
static boolean |
hasGroupRoles(long groupId) |
static boolean |
hasUserRole(long userId,
long roleId) |
static boolean |
hasUserRole(long userId,
long companyId,
String name,
boolean inherited)
Returns
true if the user is associated with the named
regular role. |
static boolean |
hasUserRoles(long userId) |
static boolean |
hasUserRoles(long userId,
long companyId,
String[] names,
boolean inherited)
Returns
true if the user has any one of the named regular
roles. |
static Role |
loadFetchRole(long companyId,
String name)
Returns a role with the name in the company.
|
static Role |
loadGetRole(long companyId,
String name)
Returns a role with the name in the company.
|
static 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.
|
static 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.
|
static 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.
|
static 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.
|
static int |
searchCount(long companyId,
String keywords,
Integer[] types)
Returns the number of roles that match the keywords and types.
|
static int |
searchCount(long companyId,
String keywords,
Integer[] types,
LinkedHashMap<String,Object> params)
Returns the number of roles that match the keywords, types and params.
|
static int |
searchCount(long companyId,
String name,
String description,
Integer[] types)
Returns the number of roles that match the name, description, and types.
|
static 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.
|
static void |
setGroupRoles(long groupId,
long[] roleIds) |
static void |
setUserRoles(long userId,
long[] roleIds) |
static void |
unsetUserRoles(long userId,
long[] roleIds)
Removes the matching roles associated with the user.
|
static 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.
|
static Role |
updateRole(Role role)
Updates the role in the database or adds it if it does not yet exist.
|
public static void addGroupRole(long groupId, long roleId)
public static void addGroupRole(long groupId, Role role)
public static void addGroupRoles(long groupId, List<Role> roles)
public static void addGroupRoles(long groupId, long[] roleIds)
public static 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
userId
- the primary key of the userclassName
- 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 nametitleMap
- 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.PortalException
public static Role addRole(Role role)
role
- the rolepublic static void addUserRole(long userId, long roleId) throws PortalException
PortalException
public static void addUserRole(long userId, Role role) throws PortalException
PortalException
public static void addUserRoles(long userId, List<Role> roles) throws PortalException
PortalException
public static void addUserRoles(long userId, long[] roleIds) throws PortalException
PortalException
public static void checkSystemRoles() throws PortalException
PortalException
public static void checkSystemRoles(long companyId) throws PortalException
companyId
- the primary key of the companyPortalException
public static void clearGroupRoles(long groupId)
public static void clearUserRoles(long userId) throws PortalException
PortalException
public static Role createRole(long roleId)
roleId
- the primary key for the new rolepublic static void deleteGroupRole(long groupId, long roleId)
public static void deleteGroupRole(long groupId, Role role)
public static void deleteGroupRoles(long groupId, List<Role> roles)
public static void deleteGroupRoles(long groupId, long[] roleIds)
public static PersistedModel deletePersistedModel(PersistedModel persistedModel) throws PortalException
PortalException
public static Role deleteRole(long roleId) throws PortalException
roleId
- the primary key of the rolePortalException
- if a role with the primary key could not be foundpublic static Role deleteRole(Role role) throws PortalException
role
- the rolePortalException
public static void deleteUserRole(long userId, long roleId) throws PortalException
PortalException
public static void deleteUserRole(long userId, Role role) throws PortalException
PortalException
public static void deleteUserRoles(long userId, List<Role> roles) throws PortalException
PortalException
public static void deleteUserRoles(long userId, long[] roleIds) throws PortalException
PortalException
public static DynamicQuery dynamicQuery()
public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery)
dynamicQuery
- the dynamic querypublic static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
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.
dynamicQuery
- the dynamic querystart
- the lower bound of the range of model instancesend
- the upper bound of the range of model instances (not inclusive)public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator)
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.
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 (optionally null
)public static long dynamicQueryCount(DynamicQuery dynamicQuery)
dynamicQuery
- the dynamic querypublic static long dynamicQueryCount(DynamicQuery dynamicQuery, Projection projection)
dynamicQuery
- the dynamic queryprojection
- the projection to apply to the querypublic static Role fetchRole(long roleId)
public static Role fetchRole(long companyId, String name)
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.
companyId
- the primary key of the companyname
- the role's namenull
if a role
with the name could not be found in the companypublic static Role fetchRoleByUuidAndCompanyId(String uuid, long companyId)
uuid
- the role's UUIDcompanyId
- the primary key of the companynull
if a matching role could not be foundpublic static ActionableDynamicQuery getActionableDynamicQuery()
public static int getAssigneesTotal(long roleId) throws PortalException
PortalException
public static Role getDefaultGroupRole(long groupId) throws PortalException
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
.
groupId
- the primary key of the groupPortalException
public static ExportActionableDynamicQuery getExportActionableDynamicQuery(PortletDataContext portletDataContext)
public static long[] getGroupPrimaryKeys(long roleId)
roleId
- the roleId of the rolepublic static List<Role> getGroupRelatedRoles(long groupId) throws PortalException
PortalException
public static List<Role> getGroupRoles(long groupId)
public static List<Role> getGroupRoles(long groupId, int start, int end)
public static List<Role> getGroupRoles(long groupId, int start, int end, OrderByComparator<Role> orderByComparator)
public static List<Role> getGroupRolesAndTeamRoles(long companyId, String keywords, List<String> excludedNames, int[] types, long excludedTeamRoleId, long teamGroupId, int start, int end)
public static int getGroupRolesAndTeamRolesCount(long companyId, String keywords, List<String> excludedNames, int[] types, long excludedTeamRoleId, long teamGroupId)
public static int getGroupRolesCount(long groupId)
public static IndexableActionableDynamicQuery getIndexableActionableDynamicQuery()
public static String getOSGiServiceIdentifier()
public static PersistedModel getPersistedModel(Serializable primaryKeyObj) throws PortalException
PortalException
@Deprecated public static List<Role> getResourceBlockRoles(long resourceBlockId, String className, String actionId)
public static Map<String,List<String>> getResourceRoles(long companyId, String name, int scope, String primKey)
companyId
- the primary key of the companyname
- the resource namescope
- the permission scopeprimKey
- the primary key of the resource's classRoleFinder.findByC_N_S_P(
long, String, int, String)
public static List<Role> getResourceRoles(long companyId, String name, int scope, String primKey, String actionId)
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 actionRoleFinder.findByC_N_S_P_A(
long, String, int, String, String)
public static Role getRole(long roleId) throws PortalException
roleId
- the primary key of the rolePortalException
- if a role with the primary key could not be foundpublic static Role getRole(long companyId, String name) throws PortalException
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.
companyId
- the primary key of the companyname
- the role's namePortalException
public static Role getRoleByUuidAndCompanyId(String uuid, long companyId) throws PortalException
uuid
- the role's UUIDcompanyId
- the primary key of the companyPortalException
- if a matching role could not be foundpublic static List<Role> getRoles(int start, int end)
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.
start
- the lower bound of the range of rolesend
- the upper bound of the range of roles (not inclusive)public static List<Role> getRoles(int type, String subtype)
type
- the role's type (optionally 0
)subtype
- the role's subtype (optionally null
)public static List<Role> getRoles(long companyId)
companyId
- the primary key of the companypublic static List<Role> getRoles(long companyId, int[] types)
companyId
- the primary key of the companytypes
- the role types (optionally null
)public static List<Role> getRoles(long[] roleIds) throws PortalException
roleIds
- the primary keys of the rolesPortalException
public static int getRolesCount()
public static List<Role> getSubtypeRoles(String subtype)
subtype
- the role's subtype (optionally null
)public static int getSubtypeRolesCount(String subtype)
subtype
- the role's subtype (optionally null
)public static Role getTeamRole(long companyId, long teamId) throws PortalException
companyId
- the primary key of the companyteamId
- the primary key of the teamPortalException
public static Map<Team,Role> getTeamRoleMap(long groupId) throws PortalException
groupId
- the primary key of the groupPortalException
public static List<Role> getTeamRoles(long groupId) throws PortalException
groupId
- the primary key of the groupPortalException
public static List<Role> getTeamRoles(long groupId, long[] excludedRoleIds) throws PortalException
groupId
- the primary key of the groupexcludedRoleIds
- the primary keys of the roles to exclude
(optionally null
)PortalException
public static List<Role> getTeamsRoles(long companyId, long[] teamIds) throws PortalException
companyId
- the primary key of the companyteamIds
- the primary keys of the teamsPortalException
public static List<Role> getTypeRoles(int type)
type
- the role's type (optionally 0
)public static List<Role> getTypeRoles(int type, int start, int end)
type
- the role's type (optionally 0
)start
- the lower bound of the range of roles to returnend
- the upper bound of the range of roles to return (not
inclusive)public static int getTypeRolesCount(int type)
type
- the role's type (optionally 0
)public static List<Role> getUserGroupGroupRoles(long userId, long groupId)
userId
- the primary key of the usergroupId
- the primary key of the groupRoleFinder.findByUserGroupGroupRole(
long, long)
public static List<Role> getUserGroupGroupRoles(long userId, long groupId, int start, int end)
public static int getUserGroupGroupRolesCount(long userId, long groupId)
public static List<Role> getUserGroupRoles(long userId, long groupId)
userId
- the primary key of the usergroupId
- the primary key of the groupRoleFinder.findByUserGroupRole(
long, long)
public static long[] getUserPrimaryKeys(long roleId)
roleId
- the roleId of the rolepublic static List<Role> getUserRelatedRoles(long userId, List<Group> groups)
userId
- the primary key of the usergroups
- the groups (optionally null
)RoleFinder.findByU_G(
long, List)
public static List<Role> getUserRelatedRoles(long userId, long groupId)
userId
- the primary key of the usergroupId
- the primary key of the groupRoleFinder.findByU_G(
long, long)
public static List<Role> getUserRelatedRoles(long userId, long[] groupIds)
userId
- the primary key of the usergroupIds
- the primary keys of the groupsRoleFinder.findByU_G(
long, long[])
public static List<Role> getUserRoles(long userId)
public static List<Role> getUserRoles(long userId, int start, int end)
public static List<Role> getUserRoles(long userId, int start, int end, OrderByComparator<Role> orderByComparator)
public static int getUserRolesCount(long userId)
public static List<Role> getUserTeamRoles(long userId, long groupId)
public static boolean hasGroupRole(long groupId, long roleId)
public static boolean hasGroupRoles(long groupId)
public static boolean hasUserRole(long userId, long roleId)
public static boolean hasUserRole(long userId, long companyId, String name, boolean inherited) throws PortalException
true
if the user is associated with the named
regular role.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
searchtrue
if the user is associated with the regular
role; false
otherwisePortalException
public static boolean hasUserRoles(long userId)
public static boolean hasUserRoles(long userId, long companyId, String[] names, boolean inherited) throws PortalException
true
if the user has any one of the named regular
roles.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
searchtrue
if the user has any one of the regular roles;
false
otherwisePortalException
public static Role loadFetchRole(long companyId, String name)
companyId
- the primary key of the companyname
- the role's name (optionally null
)null
if a role with the
name could not be found in the companypublic static Role loadGetRole(long companyId, String name) throws PortalException
companyId
- the primary key of the companyname
- the role's namePortalException
public static List<Role> search(long companyId, String keywords, Integer[] types, int start, int end, OrderByComparator<Role> obc)
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.
companyId
- the primary key of the companykeywords
- 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 returnend
- the upper bound of the range of roles to return (not
inclusive)obc
- the comparator to order the roles (optionally
null
)obc
RoleFinder
public static List<Role> search(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<Role> obc)
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.
companyId
- the primary key of the companykeywords
- 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 returnend
- the upper bound of the range of roles to return (not
inclusive)obc
- the comparator to order the roles (optionally
null
)obc
RoleFinder
public static List<Role> search(long companyId, String name, String description, Integer[] types, int start, int end, OrderByComparator<Role> obc)
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.
companyId
- the primary key of the companyname
- 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 returnend
- the upper bound of the range of the roles to return (not
inclusive)obc
- the comparator to order the roles (optionally
null
)obc
RoleFinder
public static List<Role> search(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<Role> obc)
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.
companyId
- the primary key of the companyname
- 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 returnend
- the upper bound of the range of the roles to return (not
inclusive)obc
- the comparator to order the roles (optionally
null
)obc
RoleFinder
public static int searchCount(long companyId, String keywords, Integer[] types)
companyId
- the primary key of the companykeywords
- the keywords (space separated), which may occur in the
role's name or description (optionally null
)types
- the role types (optionally null
)public static int searchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params)
companyId
- the primary key of the companykeywords
- 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
public static int searchCount(long companyId, String name, String description, Integer[] types)
companyId
- the primary key of the companyname
- the role's name (optionally null
)description
- the role's description (optionally null
)types
- the role types (optionally null
)public static int searchCount(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params)
companyId
- the primary key of the companyname
- 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
public static void setGroupRoles(long groupId, long[] roleIds)
public static void setUserRoles(long userId, long[] roleIds) throws PortalException
PortalException
public static void unsetUserRoles(long userId, long[] roleIds) throws PortalException
userId
- the primary key of the userroleIds
- the primary keys of the rolesPortalException
public static Role updateRole(long roleId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, String subtype, ServiceContext serviceContext) throws PortalException
roleId
- the primary key of the rolename
- the role's new nametitleMap
- the new localized titles (optionally null
)
to replace those existing for the roledescriptionMap
- the new localized descriptions (optionally
null
) to replace those existing for the rolesubtype
- the role's new subtype (optionally null
)serviceContext
- the service context to be applied (optionally
null
). Can set expando bridge attributes for the
role.PortalException
public static Role updateRole(Role role)
role
- the rolepublic static RoleLocalService getService()