public ProcessInstanceImpl(final ProcessInstance processInstance) { super(processInstance); this.startedDate = processInstance.getStartedDate(); this.startedBy = processInstance.getStartedBy(); this.parentInstanceUUID = processInstance.getParentInstanceUUID(); Set<ProcessInstanceUUID> children = processInstance.getChildrenInstanceUUID(); if (children != null && !children.isEmpty()) { this.childrenInstanceUUID = new HashSet<ProcessInstanceUUID>(); for (ProcessInstanceUUID child : children) { this.childrenInstanceUUID.add(child); } } this.instanceState = processInstance.getInstanceState(); this.initialVariableValues = processInstance.getInitialVariableValues(); this.endedDate = processInstance.getEndedDate(); this.endedBy = processInstance.getEndedBy(); List<VariableUpdate> list = processInstance.getVariableUpdates(); if (list != null && !list.isEmpty()) { this.variableUpdates = new ArrayList<VariableUpdate>(); for (VariableUpdate varUpdate : list) { this.variableUpdates.add(new VariableUpdateImpl(varUpdate)); } } }
public ProcessInstanceImpl(final ProcessInstance processInstance) { super(processInstance); this.startedDate = processInstance.getStartedDate(); this.startedBy = processInstance.getStartedBy(); this.parentInstanceUUID = processInstance.getParentInstanceUUID(); final Set<ProcessInstanceUUID> children = processInstance.getChildrenInstanceUUID(); if (children != null && !children.isEmpty()) { this.childrenInstanceUUID = new HashSet<ProcessInstanceUUID>(); for (final ProcessInstanceUUID child : children) { this.childrenInstanceUUID.add(child); } } this.initialVariableValues = processInstance.getInitialVariableValues(); this.endedDate = processInstance.getEndedDate(); this.endedBy = processInstance.getEndedBy(); final List<VariableUpdate> list = processInstance.getVariableUpdates(); if (list != null && !list.isEmpty()) { this.variableUpdates = new ArrayList<VariableUpdate>(); for (final VariableUpdate varUpdate : list) { this.variableUpdates.add(new VariableUpdateImpl(varUpdate)); } } final List<InstanceStateUpdate> lisu = processInstance.getInstanceStateUpdates(); if (lisu != null && !lisu.isEmpty()) { this.instanceStateUpdates = new ArrayList<InstanceStateUpdate>(); for (final InstanceStateUpdate isu : lisu) { this.instanceStateUpdates.add(new InstanceStateUpdateImpl(isu)); } } }
throwEvent(eventService, activity); final ProcessInstance instance = execution.getInstance(); if (instance.getParentInstanceUUID() != null) { return false;
private void deleteAllProcessInstances(final ProcessDefinition process) throws ProcessNotFoundException, UndeletableInstanceException { FacadeUtil.checkArgsNotNull(process); final ProcessDefinitionUUID processUUID = process.getUUID(); final Querier querier = EnvTool.getAllQueriers(); List<InternalProcessInstance> parentProcessInstances = querier.getParentProcessInstances(processUUID, 0, 200); do { for (final InternalProcessInstance parentProcessInstance : parentProcessInstances) { try { deleteProcessInstance(parentProcessInstance.getUUID()); } catch (final InstanceNotFoundException infe) { final String message = ExceptionManager.getInstance().getFullMessage("bai_RAPII_6"); throw new BonitaInternalException(message, infe); } } parentProcessInstances = querier.getParentProcessInstances(processUUID, 0, 200); } while (!parentProcessInstances.isEmpty()); final Set<InternalProcessInstance> instances = querier.getProcessInstances(processUUID); if (instances != null && !instances.isEmpty()) { final ProcessInstance first = instances.iterator().next(); throw new UndeletableInstanceException("bai_RAPII_7", first.getUUID(), first.getParentInstanceUUID()); } }
public void deleteAllProcessInstances(ProcessDefinitionUUID processUUID) throws ProcessNotFoundException, UndeletableInstanceException { FacadeUtil.checkArgsNotNull(processUUID); Querier querier = EnvTool.getAllQueriers(); ProcessFullDefinition process = querier.getProcess(processUUID); if (process == null) { throw new ProcessNotFoundException(processUUID); } Set<ProcessFullInstance> instances = querier.getProcessInstances(processUUID); for (ProcessFullInstance instance : instances) { //deletes only parent instances if (instance.getParentInstanceUUID() == null) { try { deleteProcessInstance(instance.getUUID()); } catch (InstanceNotFoundException e) { throw new BonitaInternalException("Invalid state", e); } } } instances = querier.getProcessInstances(processUUID); if (instances != null && !instances.isEmpty()) { ProcessInstance first = instances.iterator().next(); throw new UndeletableInstanceException(first.getUUID(), first.getParentInstanceUUID()); } }
public LightProcessInstanceImpl(final ProcessInstance processInstance) { super(processInstance); if (processInstance.getParentInstanceUUID() != null) { parentInstanceUUID = new ProcessInstanceUUID(processInstance.getParentInstanceUUID()); } if (processInstance.getParentActivityUUID() != null) { parentActivityUUID = new ActivityInstanceUUID(processInstance.getParentActivityUUID()); } nb = processInstance.getNb(); lastUpdate = Misc.getTime(processInstance.getLastUpdate()); state = processInstance.getInstanceState(); endedBy = processInstance.getEndedBy(); endedDate = Misc.getTime(processInstance.getEndedDate()); startedBy = processInstance.getStartedBy(); startedDate = Misc.getTime(processInstance.getStartedDate()); isArchived = processInstance.isArchived(); }
public LightProcessInstanceImpl(final ProcessInstance processInstance) { super(processInstance); if (processInstance.getParentInstanceUUID() != null) { parentInstanceUUID = new ProcessInstanceUUID(processInstance.getParentInstanceUUID()); } if (processInstance.getParentActivityUUID() != null) { parentActivityUUID = new ActivityInstanceUUID(processInstance.getParentActivityUUID()); } nb = processInstance.getNb(); lastUpdate = Misc.getTime(processInstance.getLastUpdate()); state = processInstance.getInstanceState(); endedBy = processInstance.getEndedBy(); endedDate = Misc.getTime(processInstance.getEndedDate()); startedBy = processInstance.getStartedBy(); startedDate = Misc.getTime(processInstance.getStartedDate()); isArchived = processInstance.isArchived(); }
static Job getTargetErrorJob(final Execution execution) { final ProcessDefinition process = execution.getProcessDefinition(); final ProcessInstance instance = execution.getInstance(); ActivityInstanceUUID parentActivityUUID = null; if (ProcessType.EVENT_SUB_PROCESS.equals(process.getType())) { final InternalProcessInstance rootEventSubProcess = EnvTool.getJournalQueriers().getProcessInstance( instance.getParentInstanceUUID()); parentActivityUUID = rootEventSubProcess.getParentActivityUUID(); } else { parentActivityUUID = instance.getParentActivityUUID(); } if (parentActivityUUID != null) { final Execution exec = EnvTool.getJournalQueriers().getExecutionOnActivity( parentActivityUUID.getProcessInstanceUUID(), parentActivityUUID); final String eventName = ActivityUtil.getErrorEventName(exec.getNode(), execution.getNode().getTimerCondition()); if (eventName != null) { final int indexOf = eventName.indexOf(EventConstants.SEPARATOR); return JobBuilder.boundaryErrorJob(eventName.substring(0, indexOf), exec.getInstance().getRootInstanceUUID(), exec.getEventUUID(), exec.getInstance().getProcessInstanceUUID()); } } return null; }