@Override public Map<String, Object> getProcessInstanceVariables(final ProcessInstanceUUID instanceUUID, final Date maxDate) throws InstanceNotFoundException { // take all initial instance var and for each varupdate being proceed before // max date, replace the initial value by // the new one final ProcessInstance processInstance = getInternalProcessInstanceWithoutAttachements(instanceUUID); final Map<String, Object> instanceInitialVars = processInstance.getInitialVariableValues(); final Map<String, Object> instanceVarBeforeMaxDate = new HashMap<String, Object>(); instanceVarBeforeMaxDate.putAll(instanceInitialVars); final Map<String, VariableUpdate> maxVarUpdates = new HashMap<String, VariableUpdate>(); for (final VariableUpdate varUpdate : processInstance.getVariableUpdates()) { if (varUpdate.getDate().getTime() <= maxDate.getTime()) { final VariableUpdate currentMax = maxVarUpdates.get(varUpdate.getName()); if (currentMax == null || currentMax.getDate().getTime() <= varUpdate.getDate().getTime()) { maxVarUpdates.put(varUpdate.getName(), varUpdate); instanceVarBeforeMaxDate.put(varUpdate.getName(), varUpdate.getValue()); } } } return instanceVarBeforeMaxDate; }
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)); } } }
final List<VariableUpdate> vu = processInstance.getVariableUpdates(); if (vu != null && !vu.isEmpty()) { variableUpdates = new ArrayList<VariableUpdate>();
final List<VariableUpdate> vu = processInstance.getVariableUpdates(); if (vu != null && !vu.isEmpty()) { variableUpdates = new ArrayList<VariableUpdate>();
maxDate = getActivityScopeDate(activityInstance, maxDate); final List<VariableUpdate> instanceVarUpdates = instance.getVariableUpdates(); final Map<String, VariableUpdate> tmp = new HashMap<String, VariableUpdate>();
public InternalProcessInstance(final ProcessInstance src) { super(src); activities = new HashSet<ActivityInstance>(); for (final ActivityInstance activity : src.getActivities()) { activities.add(new InternalActivityInstance(activity)); } variableUpdates = null; for (final VariableUpdate varUpdate : src.getVariableUpdates()) { final Serializable value = varUpdate.getValue(); addVariableUpdate(new InternalVariableUpdate(varUpdate.getDate(), varUpdate.getUserId(), varUpdate.getName(), VariableUtil.createVariable(src.getProcessDefinitionUUID(), varUpdate.getName(), value))); } setVariables(src.getInitialVariableValues()); if (src.getClass().equals(InternalProcessInstance.class)) { final InternalProcessInstance other = (InternalProcessInstance) src; userXPRead = other.getUserXPRead(); nbOfAttachments = other.nbOfAttachments; } }