public static InstanceNotFoundException build(Throwable e) { if (!(e instanceof InstanceNotFoundException)) { throw new BonitaInternalException("Cannot create a InstanceNotFoundException", e); } return new InstanceNotFoundException((InstanceNotFoundException)e); }
@Override public Set<ProcessInstanceUUID> getChildrenInstanceUUIDsOfProcessInstance(final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { final ProcessInstance instance = getInternalProcessInstanceWithoutAttachements(instanceUUID); if (instance == null) { throw new InstanceNotFoundException("bai_QRAPII_1", instanceUUID); } return new HashSet<ProcessInstanceUUID>(instance.getChildrenInstanceUUID()); }
@Override public Set<String> getInvolvedUsersOfProcessInstance(final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { final ProcessInstance instance = getInternalProcessInstanceWithoutAttachements(instanceUUID); if (instance == null) { throw new InstanceNotFoundException("bai_QRAPII_1", instanceUUID); } return new HashSet<String>(instance.getInvolvedUsers()); }
@Override public Map<String, Object> getProcessInstanceVariables(final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { final ProcessInstance processInstance = getInternalProcessInstanceWithoutAttachements(instanceUUID); if (processInstance == null) { throw new InstanceNotFoundException("bai_QRAPII_8", instanceUUID); } return processInstance.getLastKnownVariableValues(); }
@Override public Set<String> getActiveUsersOfProcessInstance(final ProcessInstanceUUID uuid) throws InstanceNotFoundException { final ProcessInstance instance = getInternalProcessInstanceWithoutAttachements(uuid); if (instance == null) { throw new InstanceNotFoundException("bai_QRAPII_1", uuid); } return instance.getActiveUsers(); }
public Map<String, Object> getProcessInstanceVariables(ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { ProcessInstance processInstance = getProcessInstance(instanceUUID); if (processInstance == null) { throw new InstanceNotFoundException(instanceUUID); } return processInstance.getLastKnownVariableValues(); }
@Override public ProcessInstance getProcessInstance(final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { final InternalProcessInstance instance = getInternalProcessInstanceWithAttachments(instanceUUID); if (instance == null) { throw new InstanceNotFoundException("bai_QRAPII_1", instanceUUID); } return new ProcessInstanceImpl(instance); }
@Override public LightProcessInstance getLightProcessInstance(final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { final ProcessInstance result = getInternalProcessInstanceWithoutAttachements(instanceUUID); if (result == null) { throw new InstanceNotFoundException("bai_QRAPII_1", instanceUUID); } return new LightProcessInstanceImpl(result); }
public ProcessInstance execute(Environment env) throws Exception { final ProcessInstance result = EnvTool.getAllQueriers().getProcessInstance(instanceUUID); if (result == null) { throw new InstanceNotFoundException(instanceUUID); } return new ProcessInstanceImpl(result); }
private void addComment(final Comment comment, final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { final InternalProcessInstance instance = EnvTool.getJournalQueriers().getProcessInstance(instanceUUID); if (instance == null) { throw new InstanceNotFoundException("bai_RAPII_27", instanceUUID); } instance.addComment(comment); }
private Collection<ActivityInstance<TaskInstance>> getTaskListUser(ProcessInstanceUUID instanceUUID, String userId, TaskState taskState) throws InstanceNotFoundException { FacadeUtil.checkArgsNotNull(instanceUUID, taskState, userId); ProcessInstance processInstance = getProcessInstance(instanceUUID); if (processInstance == null) { throw new InstanceNotFoundException(instanceUUID); } final Querier journal = EnvTool.getAllQueriers(); final Set<ActivityFullInstance<TaskInstance>> userInstanceTasks = journal.getUserInstanceTasks(userId, instanceUUID, taskState); final Collection<ActivityInstance<TaskInstance>> todos = new ArrayList<ActivityInstance<TaskInstance>>(); for (ActivityInstance<TaskInstance> taskActivity : userInstanceTasks) { todos.add(new ActivityInstanceImpl<TaskInstance>(taskActivity)); } return todos; } private Collection<ActivityInstance< TaskInstance >> getTaskListUser(String userId, TaskState taskState) {
public static InstanceNotFoundException build(final String id, final Throwable e) { if (!(e instanceof InstanceNotFoundException)) { final ExceptionManager manager = ExceptionManager.getInstance(); final String message = manager.getIdMessage(id) + manager.getMessage("INFE2"); throw new BonitaInternalException(message, e); } return new InstanceNotFoundException((InstanceNotFoundException) e); }
public static InstanceNotFoundException build(final String id, final Throwable e) { if (!(e instanceof InstanceNotFoundException)) { final ExceptionManager manager = ExceptionManager.getInstance(); final String message = manager.getIdMessage(id) + manager.getMessage("INFE2"); throw new BonitaInternalException(message, e); } return new InstanceNotFoundException((InstanceNotFoundException) e); }
private Collection<TaskInstance> getInternalTaskListUser(final ProcessInstanceUUID instanceUUID, final String userId, final ActivityState taskState) throws InstanceNotFoundException { FacadeUtil.checkArgsNotNull(instanceUUID, taskState, userId); final ProcessInstance processInstance = getInternalProcessInstanceWithoutAttachements(instanceUUID); if (processInstance == null) { throw new InstanceNotFoundException("bai_QRAPII_13", instanceUUID); } final Querier journal = EnvTool.getAllQueriers(getQueryList()); return journal.getUserInstanceTasks(userId, instanceUUID, taskState); }
public ProcessInstance getProcessInstance(ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException { FacadeUtil.checkArgsNotNull(instanceUUID); final ProcessInstance result = EnvTool.getAllQueriers().getProcessInstance(instanceUUID); if (result == null) { throw new InstanceNotFoundException(instanceUUID); } return new ProcessInstanceImpl(result); // try { // return FacadeUtil.executeCommand(new GetProcessInstance(instanceUUID)); // } catch (InstanceNotFoundException e) { // throw e; // } catch (RuntimeException e) { // throw e; // } catch (Exception e) { // // This should never happen // throw new BonitaInternalException("Ouch! Unexpected error: " + e, e); // } }
public ActivityInstance<ActivityBody> getActivityInstance(ProcessInstanceUUID instanceUUID, String activityId, String iterationId, String activityInstanceId) throws ActivityNotFoundException, InstanceNotFoundException { final ActivityInstance<ActivityBody> result = EnvTool.getAllQueriers().getActivityInstance(instanceUUID, activityId, iterationId, activityInstanceId); if (result == null) { if (EnvTool.getAllQueriers().getProcessInstance(instanceUUID) == null) { throw new InstanceNotFoundException(instanceUUID); } throw new ActivityNotFoundException(instanceUUID, activityId, iterationId); } return new ActivityInstanceImpl<ActivityBody>(result); }
@Override public void stopExecution(final ProcessInstanceUUID instanceUUID, final String activityName) throws InstanceNotFoundException, ActivityNotFoundException { FacadeUtil.checkArgsNotNull(instanceUUID, activityName); final InternalProcessInstance processInstance = EnvTool.getJournalQueriers().getProcessInstance(instanceUUID); if (processInstance == null) { throw new InstanceNotFoundException("bai_REAPII_1", instanceUUID); } final Set<Execution> activiesExecutions = searchActiveExecutions(processInstance.getRootExecution(), activityName, null); for (final Execution execution : activiesExecutions) { if (!Execution.STATE_CANCELLED.equals(execution.getState()) && !Execution.STATE_ENDED.equals(execution.getState())) { execution.setState(Execution.STATE_ACTIVE); execution.cancel(); } } }
@Override @Deprecated public void addComment(final ProcessInstanceUUID instanceUUID, final ActivityInstanceUUID activityUUID, final String message, final String userId) throws InstanceNotFoundException, ActivityNotFoundException { final InternalProcessInstance instance = EnvTool.getJournalQueriers().getProcessInstance(instanceUUID); if (instance == null) { throw new InstanceNotFoundException("bai_RAPII_27", instanceUUID); } if (activityUUID != null) { final ActivityInstance activity = EnvTool.getAllQueriers().getActivityInstance(activityUUID); if (activity == null) { throw new ActivityNotFoundException("bai_RAPII_28", activityUUID); } } CommentImpl comment; if (activityUUID != null) { comment = new CommentImpl(userId, message, activityUUID, instanceUUID); } else { comment = new CommentImpl(userId, message, instanceUUID); } instance.addComment(comment); }
public ActivityInstance getActivityInstance(final ProcessInstanceUUID instanceUUID, final String activityId, final String iterationId, final String activityInstanceId, final String loopId) throws ActivityNotFoundException, InstanceNotFoundException { final ActivityInstance result = EnvTool.getAllQueriers(getQueryList()).getActivityInstance(instanceUUID, activityId, iterationId, activityInstanceId, loopId); if (result == null) { if (EnvTool.getAllQueriers(getQueryList()).getProcessInstance(instanceUUID) == null) { throw new InstanceNotFoundException("bai_QRAPII_2", instanceUUID); } throw new ActivityNotFoundException("bai_QRAPII_3", instanceUUID, activityId, iterationId); } return new ActivityInstanceImpl(result); }
@Override public void cancelProcessInstance(final ProcessInstanceUUID instanceUUID) throws InstanceNotFoundException, UncancellableInstanceException { // if this instance is a child execution, throw an exception FacadeUtil.checkArgsNotNull(instanceUUID); final InternalProcessInstance instance = FacadeUtil.getInstance(instanceUUID, null); if (instance == null) { throw new InstanceNotFoundException("bai_RAPII_1", instanceUUID); } // if this instance is a child execution, throw an exception if (instance.getParentInstanceUUID() != null || !instance.getInstanceState().equals(InstanceState.STARTED)) { throw new UncancellableInstanceException("bai_RAPII_2", instanceUUID, instance.getParentInstanceUUID(), instance.getInstanceState()); } instance.cancel(); }