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)); } } }
instanceStateUpdates = new ArrayList<InstanceStateUpdate>(); for (final InstanceStateUpdate isu : lisu) { instanceStateUpdates.add(new InstanceStateUpdateImpl(isu));
instanceStateUpdates = new ArrayList<InstanceStateUpdate>(); for (final InstanceStateUpdate isu : lisu) { instanceStateUpdates.add(new InstanceStateUpdateImpl(isu));
public void setInstanceState(final InstanceState newState, final String userId) { updateLastUpdateDate(); final InstanceState oldState = getInstanceState(); state = newState; if (getInstanceStateUpdates() == null) { instanceStateUpdates = new ArrayList<InstanceStateUpdate>(); } // add a state update final Date newDate = new Date(); getInstanceStateUpdates().add(new InstanceStateUpdateImpl(newDate, userId, oldState, newState)); if (newState.equals(InstanceState.STARTED)) { startedDate = newDate.getTime(); startedBy = userId; } else { endedDate = newDate.getTime(); endedBy = userId; if (activities != null) { for (final ActivityInstance activity : activities) { if (activity.getEndedDate() == null) { EnvTool.getRecorder().recordBodyAborted(activity); TransientData.removeTransientData(activity.getUUID()); } } } } }