public ActorInstance getActor(final String actorName, final ProcessDefinition processDefinition) throws ActorNotFoundException { final List<ActorInstance> actors = getProcessAPI().getActors(processDefinition.getId(), 0, 50, ActorCriterion.NAME_ASC); final ActorInstance actorInstance = getActorInstance(actors, actorName); if (actorInstance == null) { throw new ActorNotFoundException(actorName, processDefinition); } return actorInstance; }
@Override public ActorMember addUserToActor(final String actorName, final ProcessDefinition processDefinition, final long userId) throws CreationException, ActorNotFoundException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance ai : actors) { if (actorName.equals(ai.getName())) { return addUserToActor(ai.getId(), userId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addRoleToActor(final String actorName, final ProcessDefinition processDefinition, final long roleId) throws ActorNotFoundException, CreationException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance ai : actors) { if (actorName.equals(ai.getName())) { return addRoleToActor(ai.getId(), roleId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addUserToActor(final String actorName, final ProcessDefinition processDefinition, final long userId) throws CreationException, ActorNotFoundException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance ai : actors) { if (actorName.equals(ai.getName())) { return addUserToActor(ai.getId(), userId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addRoleAndGroupToActor(final String actorName, final ProcessDefinition processDefinition, final long roleId, final long groupId) throws ActorNotFoundException, CreationException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance ai : actors) { if (actorName.equals(ai.getName())) { return addRoleAndGroupToActor(ai.getId(), roleId, groupId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addGroupToActor(final String actorName, final long groupId, final ProcessDefinition processDefinition) throws CreationException, ActorNotFoundException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance actorInstance : actors) { if (actorName.equals(actorInstance.getName())) { return addGroupToActor(actorInstance.getId(), groupId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addRoleToActor(final String actorName, final ProcessDefinition processDefinition, final long roleId) throws ActorNotFoundException, CreationException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance ai : actors) { if (actorName.equals(ai.getName())) { return addRoleToActor(ai.getId(), roleId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addRoleAndGroupToActor(final String actorName, final ProcessDefinition processDefinition, final long roleId, final long groupId) throws ActorNotFoundException, CreationException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance ai : actors) { if (actorName.equals(ai.getName())) { return addRoleAndGroupToActor(ai.getId(), roleId, groupId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorMember addGroupToActor(final String actorName, final long groupId, final ProcessDefinition processDefinition) throws CreationException, ActorNotFoundException { final List<ActorInstance> actors = getActors(processDefinition.getId(), 0, Integer.MAX_VALUE, ActorCriterion.NAME_ASC); for (final ActorInstance actorInstance : actors) { if (actorName.equals(actorInstance.getName())) { return addGroupToActor(actorInstance.getId(), groupId); } } throw new ActorNotFoundException("Actor " + actorName + " not found in process definition " + processDefinition.getName()); }
@Override public ActorInstance getActor(final long actorId) throws ActorNotFoundException { try { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); final GetActor getActor = new GetActor(actorMappingService, actorId); getActor.execute(); return ModelConvertor.toActorInstance(getActor.getResult()); } catch (final SBonitaException e) { throw new ActorNotFoundException(e); } }
@Override public ActorInstance getActor(final long actorId) throws ActorNotFoundException { try { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); final GetActor getActor = new GetActor(actorMappingService, actorId); getActor.execute(); return ModelConvertor.toActorInstance(getActor.getResult()); } catch (final SBonitaException e) { throw new ActorNotFoundException(e); } }
return ModelConvertor.toActorInstance(updateActor); } catch (final SActorNotFoundException e) { throw new ActorNotFoundException(e); } catch (final SBonitaException e) { throw new UpdateException(e);
return ModelConvertor.toActorInstance(updateActor); } catch (final SActorNotFoundException e) { throw new ActorNotFoundException(e); } catch (final SBonitaException e) { throw new UpdateException(e);
@Override public ActorInstance getActorInitiator(final long processDefinitionId) throws ActorNotFoundException, ProcessDefinitionNotFoundException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ProcessDefinitionService processDefinitionService = tenantAccessor.getProcessDefinitionService(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); ActorInstance actorInstance = null; try { final SProcessDefinition definition = processDefinitionService.getProcessDefinition(processDefinitionId); final SActorDefinition sActorDefinition = definition.getActorInitiator(); if (sActorDefinition == null) { throw new ActorNotFoundException("No actor initiator defined on the process"); } final String name = sActorDefinition.getName(); final SActor sActor = actorMappingService.getActor(name, processDefinitionId); actorInstance = ModelConvertor.toActorInstance(sActor); } catch (final SProcessDefinitionNotFoundException e) { // no rollback need, we only read throw new ProcessDefinitionNotFoundException(e); } catch (final SBonitaException e) { throw new RetrieveException(e); } return actorInstance; }
@Override public ActorInstance getActorInitiator(final long processDefinitionId) throws ActorNotFoundException, ProcessDefinitionNotFoundException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ProcessDefinitionService processDefinitionService = tenantAccessor.getProcessDefinitionService(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); ActorInstance actorInstance = null; try { final SProcessDefinition definition = processDefinitionService.getProcessDefinition(processDefinitionId); final SActorDefinition sActorDefinition = definition.getActorInitiator(); if (sActorDefinition == null) { throw new ActorNotFoundException("No actor initiator defined on the process"); } final String name = sActorDefinition.getName(); final SActor sActor = actorMappingService.getActor(name, processDefinitionId); actorInstance = ModelConvertor.toActorInstance(sActor); } catch (final SProcessDefinitionNotFoundException e) { // no rollback need, we only read throw new ProcessDefinitionNotFoundException(e); } catch (final SBonitaException e) { throw new RetrieveException(e); } return actorInstance; }