Class ActorMappingServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.actor.mapping.impl.ActorMappingServiceImpl
-
- All Implemented Interfaces:
ActorMappingService
public class ActorMappingServiceImpl extends java.lang.Object implements ActorMappingService
- Author:
- Matthieu Chaffotte, Elias Ricken de Medeiros, Celine Souchet
-
-
Field Summary
-
Fields inherited from interface org.bonitasoft.engine.actor.mapping.ActorMappingService
ACTOR, ACTOR_MEMBER
-
-
Constructor Summary
Constructors Constructor Description ActorMappingServiceImpl(ReadPersistenceService persistenceService, Recorder recorder, EventService eventService, QueriableLoggerService queriableLoggerService, IdentityService identityService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SActoraddActor(SActor actor)Create an actor by given actorjava.util.Set<SActor>addActors(java.util.Set<SActor> actors)Create actors by given actorsSActorMemberaddGroupToActor(long actorId, long groupId)Add the groupId specified group to the actorId specified actorSActorMemberaddRoleAndGroupToActor(long actorId, long roleId, long groupId)Add the roleId and groupId specified relationship to the actorId specified actorSActorMemberaddRoleToActor(long actorId, long roleId)Add the roleId specified role to the actorId specified actorSActorMemberaddUserToActor(long actorId, long userId)Add the userId specified user to the actorId specified actorbooleancanUserStartProcessDefinition(long userId, long processDefinitionId)Is a specified user allowed to start a process?SActorMemberdeleteActorMember(long actorMemberId)Remove actorMember for the give actorMemberIdvoiddeleteActorMember(SActorMember sActorMember)Remove an actor membervoiddeleteActors(long scopeId)Delete actors in the id specified scopevoiddeleteAllActorMembers()Delete all actor members for the connected tenantSActorgetActor(long actorId)Get actor by actor id If the actor by a given actorId is not found, it will throw SActorNotFoundExceptionSActorgetActor(java.lang.String actorName, long scopeId)Get actor by actor name and scope id If the actor by a given actorName and scopeId is not found, it will throw SActorNotFoundExceptionSActorMembergetActorMember(long actorId, long userId, long groupId, long roleId)Get the actor memberjava.util.List<SActorMember>getActorMembers(long actorId, int fromIndex, int numberOfActorMembers)Get list of SActorMember objects by paginationjava.util.List<SActorMember>getActorMembersOfGroup(long groupId, int fromIndex, int numberOfActorMembers)Get a list of SActorMember objects for given groupIdjava.util.List<SActorMember>getActorMembersOfRole(long roleId, int fromIndex, int numberOfActorMembers)Get a list of SActorMember objects for given roleIdjava.util.List<SActorMember>getActorMembersOfUser(long userId, int fromIndex, int numberOfActorMembers)Get a list of SActorMember objects for given userIdjava.util.List<SActor>getActors(long processDefinitionId, QueryOptions queryOptions)Get paginated actorsjava.util.List<SActor>getActors(java.util.List<java.lang.Long> actorIds)Get a list of actors by the given list of actor idsjava.util.List<SActor>getActors(java.util.Set<java.lang.Long> scopeIds, java.lang.Long userId)Get a list of all actors for the id specified user in certain scopes specified by scopeIdslonggetNumberOfActorMembers(long actorId)Get number of ActorMembers for give actorIdlonggetNumberOfGroupsOfActor(long actorId)Get the number of groups corresponding to an actorlonggetNumberOfMembershipsOfActor(long actorId)Get the number of memberships (role and group) of an actorlonggetNumberOfRolesOfActor(long actorId)Get the number of roles of an actorlonggetNumberOfUsersOfActor(long actorId)Return the number of users corresponding to an actorjava.util.List<java.lang.Long>getPossibleUserIdsOfActorId(long actorId, int startIndex, int maxResults)SActorupdateActor(long actorId, EntityUpdateDescriptor descriptor)Update actor by its id If the actor by a given actorId is not found, it will throw processDefinitionNotFountExcetion
-
-
-
Constructor Detail
-
ActorMappingServiceImpl
public ActorMappingServiceImpl(ReadPersistenceService persistenceService, Recorder recorder, EventService eventService, QueriableLoggerService queriableLoggerService, IdentityService identityService)
-
-
Method Detail
-
addActors
public java.util.Set<SActor> addActors(java.util.Set<SActor> actors) throws SActorCreationException
Description copied from interface:ActorMappingServiceCreate actors by given actors- Specified by:
addActorsin interfaceActorMappingService- Parameters:
actors- The given actors without IDs- Returns:
- The set of the new created actors
- Throws:
SActorCreationException
-
addActor
public SActor addActor(SActor actor) throws SActorCreationException
Description copied from interface:ActorMappingServiceCreate an actor by given actor- Specified by:
addActorin interfaceActorMappingService- Parameters:
actor- The given actor without id- Returns:
- the new created actor with id
- Throws:
SActorCreationException
-
getActor
public SActor getActor(long actorId) throws SActorNotFoundException, SBonitaReadException
Description copied from interface:ActorMappingServiceGet actor by actor id If the actor by a given actorId is not found, it will throw SActorNotFoundException- Specified by:
getActorin interfaceActorMappingService- Parameters:
actorId- Id of actor- Returns:
- SActor object response to the given actorId
- Throws:
SActorNotFoundExceptionSBonitaReadException
-
getNumberOfUsersOfActor
public long getNumberOfUsersOfActor(long actorId)
Description copied from interface:ActorMappingServiceReturn the number of users corresponding to an actor- Specified by:
getNumberOfUsersOfActorin interfaceActorMappingService- Parameters:
actorId- the id of the actor to retrieve the users from- Returns:
- Number of users mapped to actor
-
getNumberOfRolesOfActor
public long getNumberOfRolesOfActor(long actorId)
Description copied from interface:ActorMappingServiceGet the number of roles of an actor- Specified by:
getNumberOfRolesOfActorin interfaceActorMappingService- Parameters:
actorId- the id corresponding to an actor- Returns:
- Number of roles mapped to actor
-
getNumberOfGroupsOfActor
public long getNumberOfGroupsOfActor(long actorId)
Description copied from interface:ActorMappingServiceGet the number of groups corresponding to an actor- Specified by:
getNumberOfGroupsOfActorin interfaceActorMappingService- Parameters:
actorId- the id of the actor to retrieve the groups from- Returns:
- Number of groups mapped to actor
-
getNumberOfMembershipsOfActor
public long getNumberOfMembershipsOfActor(long actorId)
Description copied from interface:ActorMappingServiceGet the number of memberships (role and group) of an actor- Specified by:
getNumberOfMembershipsOfActorin interfaceActorMappingService- Parameters:
actorId- the id of the actor to retrieve the memberships from- Returns:
- Number of memberships mapped to actor
-
getActors
public java.util.List<SActor> getActors(java.util.List<java.lang.Long> actorIds) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet a list of actors by the given list of actor ids- Specified by:
getActorsin interfaceActorMappingService- Parameters:
actorIds- the list of actor ids to retrieve- Returns:
- a list of actors
- Throws:
SBonitaReadException
-
getActor
public SActor getActor(java.lang.String actorName, long scopeId) throws SActorNotFoundException
Description copied from interface:ActorMappingServiceGet actor by actor name and scope id If the actor by a given actorName and scopeId is not found, it will throw SActorNotFoundException- Specified by:
getActorin interfaceActorMappingService- Parameters:
actorName- Name of actorscopeId- Id of scope, it can be processDefinitionId- Returns:
- SActor object corresponding to the given actorName and scopeId
- Throws:
SActorNotFoundException- Error thrown if no actor have an id corresponding to the parameter.
-
updateActor
public SActor updateActor(long actorId, EntityUpdateDescriptor descriptor) throws SActorNotFoundException, SActorUpdateException, SBonitaReadException
Description copied from interface:ActorMappingServiceUpdate actor by its id If the actor by a given actorId is not found, it will throw processDefinitionNotFountExcetion- Specified by:
updateActorin interfaceActorMappingService- Parameters:
actorId- Id of actordescriptor- Update description- Returns:
- the updated actor
- Throws:
SActorNotFoundException- Error thrown if no actor have an id corresponding to the parameter actorId.SActorUpdateException- Error thrown if has exceptions while try to update an actorSBonitaReadException
-
deleteActors
public void deleteActors(long scopeId) throws SActorDeletionExceptionDescription copied from interface:ActorMappingServiceDelete actors in the id specified scope- Specified by:
deleteActorsin interfaceActorMappingService- Parameters:
scopeId- Id of scope, it can be processDefinitionId- Throws:
SActorDeletionException- Error thrown if has exceptions while try to delete actors
-
getActors
public java.util.List<SActor> getActors(java.util.Set<java.lang.Long> scopeIds, java.lang.Long userId) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet a list of all actors for the id specified user in certain scopes specified by scopeIds- Specified by:
getActorsin interfaceActorMappingService- Parameters:
scopeIds- Ids of scope, it can be processDefinitionIduserId- Id of user which is added to actor- Returns:
- The list of SActor Objects
- Throws:
SBonitaReadException
-
addUserToActor
public SActorMember addUserToActor(long actorId, long userId) throws SActorMemberCreationException
Description copied from interface:ActorMappingServiceAdd the userId specified user to the actorId specified actor- Specified by:
addUserToActorin interfaceActorMappingService- Parameters:
actorId- Id of actoruserId- Id of user- Returns:
- SActorMember object
- Throws:
SActorMemberCreationException- Error thrown if has exceptions while try to create the SActorMember object
-
addGroupToActor
public SActorMember addGroupToActor(long actorId, long groupId) throws SActorNotFoundException, SActorMemberCreationException
Description copied from interface:ActorMappingServiceAdd the groupId specified group to the actorId specified actor- Specified by:
addGroupToActorin interfaceActorMappingService- Parameters:
actorId- Id of actorgroupId- Id of group- Returns:
- SActorMember object
- Throws:
SActorNotFoundException- Error thrown if no actor have an id corresponding to the parameter actorId.SActorMemberCreationException- Error thrown if has exceptions while try to create the SActorMember object
-
addRoleToActor
public SActorMember addRoleToActor(long actorId, long roleId) throws SActorMemberCreationException
Description copied from interface:ActorMappingServiceAdd the roleId specified role to the actorId specified actor- Specified by:
addRoleToActorin interfaceActorMappingService- Parameters:
actorId- Id of actorroleId- Id of role- Returns:
- SActorMember object
- Throws:
SActorMemberCreationException- Error thrown if has exceptions while try to create the SActorMember object
-
addRoleAndGroupToActor
public SActorMember addRoleAndGroupToActor(long actorId, long roleId, long groupId) throws SActorNotFoundException, SActorMemberCreationException
Description copied from interface:ActorMappingServiceAdd the roleId and groupId specified relationship to the actorId specified actor- Specified by:
addRoleAndGroupToActorin interfaceActorMappingService- Parameters:
actorId- Id of actorroleId- Id of rolegroupId- Id of group- Returns:
- SActorMember object
- Throws:
SActorNotFoundException- Error thrown if no actor have an id corresponding to the parameter actorId.SActorMemberCreationException- Error thrown if has exceptions while try to create the SActorMember object
-
deleteActorMember
public SActorMember deleteActorMember(long actorMemberId) throws SActorMemberNotFoundException, SActorMemberDeletionException
Description copied from interface:ActorMappingServiceRemove actorMember for the give actorMemberId- Specified by:
deleteActorMemberin interfaceActorMappingService- Parameters:
actorMemberId- Id of actorMember- Throws:
SActorMemberNotFoundException- Error thrown if no actorMember have an id corresponding to the parameter actorMemberId.SActorMemberDeletionException- Error thrown if has exceptions while try to remove the SActorMember object
-
deleteActorMember
public void deleteActorMember(SActorMember sActorMember) throws SActorMemberDeletionException
Description copied from interface:ActorMappingServiceRemove an actor member- Specified by:
deleteActorMemberin interfaceActorMappingService- Parameters:
sActorMember- the actorMember to remove- Throws:
SActorMemberDeletionException- Error thrown if has exceptions while try to remove the SActorMember object
-
getActorMember
public SActorMember getActorMember(long actorId, long userId, long groupId, long roleId) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet the actor member- Specified by:
getActorMemberin interfaceActorMappingService- Parameters:
actorId- The identifier of the actoruserId- The identifier of the usergroupId- The identifier of the grouproleId- The identifier of the role- Returns:
- The corresponding actor member
- Throws:
SBonitaReadException
-
getNumberOfActorMembers
public long getNumberOfActorMembers(long actorId) throws SBonitaReadExceptionDescription copied from interface:ActorMappingServiceGet number of ActorMembers for give actorId- Specified by:
getNumberOfActorMembersin interfaceActorMappingService- Parameters:
actorId- Id of actor- Returns:
- the number of ActorMembers
- Throws:
SBonitaReadException
-
getActorMembers
public java.util.List<SActorMember> getActorMembers(long actorId, int fromIndex, int numberOfActorMembers) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet list of SActorMember objects by pagination- Specified by:
getActorMembersin interfaceActorMappingService- Parameters:
actorId- Id of actorfromIndex- Index of the record to be retrieved from. First record has pageNumber 0.numberOfActorMembers- Number of result we want to get. Maximum number of result returned.- Returns:
- List of SActorMember objects, ordered by id ascending
- Throws:
SBonitaReadException
-
getActorMembersOfUser
public java.util.List<SActorMember> getActorMembersOfUser(long userId, int fromIndex, int numberOfActorMembers) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet a list of SActorMember objects for given userId- Specified by:
getActorMembersOfUserin interfaceActorMappingService- Parameters:
userId- Id of userfromIndex- Index of the record to be retrieved from. First record has pageNumber 0.numberOfActorMembers- Number of result we want to get. Maximum number of result returned.- Returns:
- List of SActorMember objects, ordered by id ascending
- Throws:
SBonitaReadException
-
getActorMembersOfGroup
public java.util.List<SActorMember> getActorMembersOfGroup(long groupId, int fromIndex, int numberOfActorMembers) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet a list of SActorMember objects for given groupId- Specified by:
getActorMembersOfGroupin interfaceActorMappingService- Parameters:
groupId- Id of group- Returns:
- a list of SActorMember objects, ordered by id ascending
- Throws:
SBonitaReadException
-
getActorMembersOfRole
public java.util.List<SActorMember> getActorMembersOfRole(long roleId, int fromIndex, int numberOfActorMembers) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet a list of SActorMember objects for given roleId- Specified by:
getActorMembersOfRolein interfaceActorMappingService- Parameters:
roleId- Id of role- Returns:
- a list of SActorMember objects, ordered by id ascending
- Throws:
SBonitaReadException
-
canUserStartProcessDefinition
public boolean canUserStartProcessDefinition(long userId, long processDefinitionId) throws SBonitaReadExceptionDescription copied from interface:ActorMappingServiceIs a specified user allowed to start a process?- Specified by:
canUserStartProcessDefinitionin interfaceActorMappingService- Parameters:
userId- Id of userprocessDefinitionId- Id of processDefinition- Returns:
- a list of SActor objects
- Throws:
SBonitaReadException
-
getActors
public java.util.List<SActor> getActors(long processDefinitionId, QueryOptions queryOptions) throws SBonitaReadException
Description copied from interface:ActorMappingServiceGet paginated actors- Specified by:
getActorsin interfaceActorMappingService- Parameters:
processDefinitionId- identifier of process definition- Returns:
- the list of actors
- Throws:
SBonitaReadException
-
deleteAllActorMembers
public void deleteAllActorMembers() throws SActorMemberDeletionExceptionDescription copied from interface:ActorMappingServiceDelete all actor members for the connected tenant- Specified by:
deleteAllActorMembersin interfaceActorMappingService- Throws:
SActorMemberDeletionException
-
getPossibleUserIdsOfActorId
public java.util.List<java.lang.Long> getPossibleUserIdsOfActorId(long actorId, int startIndex, int maxResults) throws SBonitaReadException- Specified by:
getPossibleUserIdsOfActorIdin interfaceActorMappingService- Throws:
SBonitaReadException
-
-