public void recordInstanceStarted(XpdlInstance instance, final String userId) { Misc.checkArgsNotNull(instance); XpdlInstance parentInstance = instance.getParentInstance(); ProcessInstanceUUID parentInstanceUUID = null; if (parentInstance != null) { parentInstanceUUID = parentInstance.getUUID(); getProcessInstance(parentInstanceUUID).addChildInstance(instance.getUUID()); } final ProcessFullInstanceImpl instanceRecord = new ProcessFullInstanceImpl(instance.getUUID(), instance.getPackageDefinitionUUID(), instance.getProcessDefinitionUUID(), parentInstanceUUID, instance.getRootExecution().getVariables()); instanceRecord.setStartedDate(new Date()); Misc.badStateIfNull(userId, "Ouch! Can't get the user id from the environment!"); instanceRecord.setStartedBy(userId); buffer.addInstance(instanceRecord); getQuerierDbSession().save(instanceRecord); }
public void cancel() { // cancel execution this.getRootExecution().cancel(); // record cancel ServiceEnvTool.getRecorder().recordInstanceCancelled( new ProcessInstanceCurrentInfo( this.getPackageDefinitionUUID(), this.getProcessDefinitionUUID(), this.getUUID(), this.getParentInstance() != null ? this.getParentInstance().getUUID() : null, this.getRootExecution().getVariables(), ServiceEnvTool.getUserId()) ); // execute finished instance handler if (this.getParentInstance() == null) { this.finish(); } }
xpdlInstance.getUUID(), (xpdlInstance.getParentInstance() != null) ? xpdlInstance.getParentInstance().getUUID() : null, xpdlExecution.getVariables(), ServiceEnvTool.getUserId()) );
childInstance.getUUID(), childInstance.getParentInstance().getUUID(), childInstance.getRootExecution().getVariables(), ServiceEnvTool.getUserId()) );
@Override public void signal(final ActivityExecution execution, final String signal, final Map<String, Object> parameters) { final XpdlExecution xpdlExecution = (XpdlExecution) execution; final XpdlInstance xpdlInstance = xpdlExecution.getXpdlInstance(); xpdlInstance.setInstanceState(InstanceState.STARTED); final Recorder recorder = ServiceEnvTool.getRecorder(); recorder.recordInstanceStarted(new ProcessInstanceCurrentInfo( xpdlInstance.getPackageDefinitionUUID(), xpdlInstance.getProcessDefinitionUUID(), xpdlInstance.getUUID(), (xpdlInstance.getParentInstance() != null) ? xpdlInstance.getParentInstance().getUUID() : null, xpdlExecution.getVariables(), ServiceEnvTool.getUserId()) ); final ActivityInstanceCurrentInfo activityInstanceCurrentInfo = new ActivityInstanceCurrentInfo( xpdlInstance.getPackageDefinitionUUID(), xpdlInstance.getProcessDefinitionUUID(), xpdlInstance.getUUID(), xpdlExecution.getCurrentActivityInstanceUUID(), this.getActivityType(), this.getActivityId(), xpdlExecution.getIterationId(), xpdlExecution.getActivityInstanceId(), xpdlExecution.getScopeVariables()); recorder.recordEnterActivity(activityInstanceCurrentInfo); recorder.recordBodyStarted(activityInstanceCurrentInfo); recorder.recordBodyEnded(activityInstanceCurrentInfo); executeSplit(execution, false); }