|
Liferay 7.0-ce-a2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.liferay.portal.service.BaseLocalServiceImpl
com.liferay.portal.service.base.RoleLocalServiceBaseImpl
com.liferay.portal.service.impl.RoleLocalServiceImpl
public class RoleLocalServiceImpl
Provides the local service for accessing, adding, checking, deleting, and updating roles.
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
RoleLocalServiceImpl()
|
|
| Method Summary | |
|---|---|
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. |
void |
addUserRoles(long userId,
long[] roleIds)
Adds the roles to the user. |
protected void |
checkSystemRole(long companyId,
String name,
Map<Locale,String> descriptionMap,
int type)
|
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. |
Role |
deleteRole(long roleId)
Deletes the role with the primary key and its associated permissions. |
Role |
deleteRole(Role role)
Deletes the role and its associated permissions. |
Role |
fetchRole(long companyId,
String name)
Returns the role with the name in the company. |
protected String[] |
getDefaultControlPanelPortlets()
|
Role |
getDefaultGroupRole(long groupId)
Returns the default role for the group with the primary key. |
List<Role> |
getGroupRelatedRoles(long groupId)
|
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 companyId,
String name)
Returns the role with the name in the company. |
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. |
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. |
protected Map<Team,Role> |
getTeamRoleMap(long groupId,
long[] excludedRoleIds)
|
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. |
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. |
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,
long companyId,
String[] names,
boolean inherited)
Returns true if the user has any one of the named regular
roles. |
protected void |
initPersonalControlPanelPortletsPermissions(Role role)
|
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. |
protected void |
reindex(long userId)
|
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. |
protected void |
setRolePermissions(Role role,
String name,
String[] actionIds)
|
void |
setUserRoles(long userId,
long[] roleIds)
Sets the roles associated with the user, replacing the user's existing roles. |
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. |
protected void |
validate(long roleId,
long companyId,
long classNameId,
String name)
|
| Methods inherited from class com.liferay.portal.service.BaseLocalServiceImpl |
|---|
getClassLoader, getLocalizationMap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RoleLocalServiceImpl()
| Method Detail |
|---|
@Deprecated
public Role addRole(long userId,
long companyId,
String name,
Map<Locale,String> titleMap,
Map<Locale,String> descriptionMap,
int type)
throws PortalException
addRole(long, String, long,
String, Map, Map, int, String, ServiceContext)
userId - the primary key of the usercompanyId - the primary key of the companyname - 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)
PortalException - if the class name or the role name were
invalid, if the role is a duplicate, or if a user with the
primary key could not be found
@Deprecated
public Role addRole(long userId,
long companyId,
String name,
Map<Locale,String> titleMap,
Map<Locale,String> descriptionMap,
int type,
String className,
long classPK)
throws PortalException
addRole(long, String, long,
String, Map, Map, int, String, ServiceContext)
userId - the primary key of the usercompanyId - the primary key of the companyname - 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)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)
PortalException - if the class name or the role name were
invalid, if the role is a duplicate, or if a user with the
primary key could not be found
public 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 - if the class name or the role name were invalid,
if the role is a duplicate, or if a user with the primary key
could not be found
public void addUserRoles(long userId,
long[] roleIds)
throws PortalException
addUserRoles in interface RoleLocalServiceaddUserRoles in class RoleLocalServiceBaseImpluserId - the primary key of the userroleIds - the primary keys of the roles
PortalException - if a user with the primary key could not be foundUserPersistence.addRoles(
long, long[])
public void checkSystemRoles()
throws PortalException
PortalException - if the current user did not have permission to
set applicable permissions on a role
@Transactional(propagation=SUPPORTS,
readOnly=true)
public void checkSystemRoles(long companyId)
throws PortalException
companyId - the primary key of the company
PortalException - if the current user did not have permission to
set applicable permissions on a role
public Role deleteRole(long roleId)
throws PortalException
deleteRole in interface RoleLocalServicedeleteRole in class RoleLocalServiceBaseImplroleId - the primary key of the role
PortalException - if a role with the primary key could not be
found, if the role is a default system role, or if the role's
resource could not be found
@SystemEvent(action=1,
type=1)
public Role deleteRole(Role role)
throws PortalException
deleteRole in interface RoleLocalServicedeleteRole in class RoleLocalServiceBaseImplrole - the role
PortalException - if the role is a default system role or if the
role's resource could not be found
@Skip
public 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 name
null if a role
with the name could not be found in the company
public 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 group
PortalException - if a group with the primary key could not be
found, or if a default role could not be found for the group
public List<Role> getGroupRelatedRoles(long groupId)
throws PortalException
PortalException
public List<Role> getResourceBlockRoles(long resourceBlockId,
String className,
String actionId)
public 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 class
RoleFinder.findByC_N_S_P(
long, String, int, String)
public 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 action
RoleFinder.findByC_N_S_P_A(
long, String, int, String, String)
@Skip
public 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 name
PortalException - if a role with the name could not be found in the
company
public List<Role> getRoles(int type,
String subtype)
type - the role's type (optionally 0)subtype - the role's subtype (optionally null)
public List<Role> getRoles(long companyId)
companyId - the primary key of the company
public List<Role> getRoles(long companyId,
int[] types)
companyId - the primary key of the companytypes - the role types (optionally null)
public List<Role> getRoles(long[] roleIds)
throws PortalException
roleIds - the primary keys of the roles
PortalException - if any one of the roles with the primary keys
could not be foundpublic List<Role> getSubtypeRoles(String subtype)
subtype - the role's subtype (optionally null)
public int getSubtypeRolesCount(String subtype)
subtype - the role's subtype (optionally null)
public Role getTeamRole(long companyId,
long teamId)
throws PortalException
companyId - the primary key of the companyteamId - the primary key of the team
PortalException - if a role could not be found in the team and
company
public Map<Team,Role> getTeamRoleMap(long groupId)
throws PortalException
groupId - the primary key of the group
PortalException - if a group with the primary key could not be
found, if a role could not be found in one of the group's teams,
or if a portal exception occurred
public List<Role> getTeamRoles(long groupId)
throws PortalException
groupId - the primary key of the group
PortalException - if a group with the primary key could not be
found, if a role could not be found in one of the group's teams,
or if a portal exception occurred
public 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 - if a group with the primary key could not be
found, if a role could not be found in one of the group's teams,
or if a portal exception occurredpublic List<Role> getTypeRoles(int type)
type - the role's type (optionally 0)
public 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 int getTypeRolesCount(int type)
type - the role's type (optionally 0)
public List<Role> getUserGroupGroupRoles(long userId,
long groupId)
userId - the primary key of the usergroupId - the primary key of the group
RoleFinder.findByUserGroupGroupRole(
long, long)
public List<Role> getUserGroupGroupRoles(long userId,
long groupId,
int start,
int end)
public int getUserGroupGroupRolesCount(long userId,
long groupId)
public List<Role> getUserGroupRoles(long userId,
long groupId)
userId - the primary key of the usergroupId - the primary key of the group
RoleFinder.findByUserGroupRole(
long, long)
public 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 List<Role> getUserRelatedRoles(long userId,
long groupId)
userId - the primary key of the usergroupId - the primary key of the group
RoleFinder.findByU_G(long,
long)
public List<Role> getUserRelatedRoles(long userId,
long[] groupIds)
userId - the primary key of the usergroupIds - the primary keys of the groups
RoleFinder.findByU_G(long,
long[])
@ThreadLocalCachable
public 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
search
true if the user is associated with the regular
role; false otherwise
PortalException - if a default user for the company could not be
found
public 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
search
true if the user has any one of the regular roles;
false otherwise
PortalException - if any one of the roles with the names could not
be found in the company or if the default user for the company
could not be found
public 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 company
public Role loadGetRole(long companyId,
String name)
throws PortalException
companyId - the primary key of the companyname - the role's name
PortalException - if a role with the name could not be found in the
company
public 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)
obcRoleFinder
public 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 RoleFinderstart - 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)
obcRoleFinder
public 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)
obcRoleFinder
public 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 RoleFinderstart - 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)
obcRoleFinder
public 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 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 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 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 void setUserRoles(long userId,
long[] roleIds)
throws PortalException
setUserRoles in interface RoleLocalServicesetUserRoles in class RoleLocalServiceBaseImpluserId - the primary key of the userroleIds - the primary keys of the roles
PortalException - if a user with the primary could not be found or
if any one of the roles with the primary keys could not be found
public void unsetUserRoles(long userId,
long[] roleIds)
throws PortalException
userId - the primary key of the userroleIds - the primary keys of the roles
PortalException - if a user with the primary key could not be found
or if a role with any one of the primary keys could not be found
public 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 - if a role with the primary could not be found or
if the role's name was invalid
protected void checkSystemRole(long companyId,
String name,
Map<Locale,String> descriptionMap,
int type)
throws PortalException
PortalExceptionprotected String[] getDefaultControlPanelPortlets()
protected Map<Team,Role> getTeamRoleMap(long groupId,
long[] excludedRoleIds)
throws PortalException
PortalException
protected void initPersonalControlPanelPortletsPermissions(Role role)
throws PortalException
PortalException
protected void reindex(long userId)
throws SearchException
SearchException
protected void setRolePermissions(Role role,
String name,
String[] actionIds)
throws PortalException
PortalException
protected void validate(long roleId,
long companyId,
long classNameId,
String name)
throws PortalException
PortalException
|
Liferay 7.0-ce-a2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||