public void addLog(ProcessLog processLog) { if (!compositeLogStack.isEmpty()) { CompositeLog compositeLog = (CompositeLog) compositeLogStack.get(compositeLogStack.size() - 1); compositeLog.addChild(processLog); processLog.setParent(compositeLog); } processLog.setDate(Clock.getCurrentTime()); logs.add(processLog); }
public synchronized void addLog(ProcessLog processLog) { if (!compositeLogStack.isEmpty()) { CompositeLog compositeLog = (CompositeLog) compositeLogStack.get(compositeLogStack.size() - 1); compositeLog.addChild(processLog); processLog.setParent(compositeLog); } processLog.setDate(Clock.getCurrentTime()); logs.add(processLog); }
public void create(ExecutionContext executionContext) { if (create != null) { throw new IllegalStateException(this + " was already created"); } create = Clock.getCurrentTime(); // if this task instance is associated with a task... if (task != null && executionContext != null) { // fire task create event // WARNING: The events create and assign are fired in the right order, // yet the logs are still not ordered properly executionContext.setTaskInstance(this); executionContext.setTask(task); task.fireEvent(Event.EVENTTYPE_TASK_CREATE, executionContext); } }
public void create(ExecutionContext executionContext) { if (create != null) { throw new IllegalStateException(this + " was already created"); } create = Clock.getCurrentTime(); // if this task instance is associated with a task... if (task != null && executionContext != null) { // fire task create event // WARNING: The events create and assign are fired in the right order, // yet the logs are still not ordered properly executionContext.setTaskInstance(this); executionContext.setTask(task); task.fireEvent(Event.EVENTTYPE_TASK_CREATE, executionContext); } }
public void fireStartEvent(Node initialNode) { start = Clock.getCurrentTime(); // fire the process start event if (initialNode != null) { ExecutionContext executionContext = new ExecutionContext(rootToken); processDefinition.fireEvent(Event.EVENTTYPE_PROCESS_START, executionContext); // execute the start node initialNode.execute(executionContext); } }
public void fireStartEvent(Node initialNode) { start = Clock.getCurrentTime(); // fire the process start event if (initialNode != null) { ExecutionContext executionContext = new ExecutionContext(rootToken); processDefinition.fireEvent(Event.EVENTTYPE_PROCESS_START, executionContext); // execute the start node initialNode.execute(executionContext); } }
protected void addNodeLog(Token token) { token.addLog(new NodeLog(this, token.getNodeEnter(), Clock.getCurrentTime())); }
protected void addNodeLog(Token token) { token.addLog(new NodeLog(this, token.getNodeEnter(), Clock.getCurrentTime())); }
/** * can optionally be used to indicate that the actor is starting to work on this task * instance. */ public void start() { if (start != null) { throw new IllegalStateException(this + " is already started"); } start = Clock.getCurrentTime(); // fire task start event if (token != null && task != null) { ExecutionContext executionContext = new ExecutionContext(token); executionContext.setTask(task); executionContext.setTaskInstance(this); task.fireEvent(Event.EVENTTYPE_TASK_START, executionContext); } }
/** * creates a root token. */ public Token(ProcessInstance processInstance) { this.start = Clock.getCurrentTime(); this.processInstance = processInstance; this.node = processInstance.getProcessDefinition().getStartState(); this.isTerminationImplicit = processInstance.getProcessDefinition().isTerminationImplicit(); // assign an id to this token before events get fired // skip, process instance is saved shortly after constructing root token // Services.assignId(this); }
/** * can optionally be used to indicate that the actor is starting to work on this task * instance. */ public void start() { if (start != null) { throw new IllegalStateException(this + " is already started"); } start = Clock.getCurrentTime(); // fire task start event if (token != null && task != null) { ExecutionContext executionContext = new ExecutionContext(token); executionContext.setTask(task); executionContext.setTaskInstance(this); task.fireEvent(Event.EVENTTYPE_TASK_START, executionContext); } }
/** * creates a root token. */ public Token(ProcessInstance processInstance) { this.start = Clock.getCurrentTime(); this.processInstance = processInstance; this.node = processInstance.getProcessDefinition().getStartState(); this.isTerminationImplicit = processInstance.getProcessDefinition().isTerminationImplicit(); // assign an id to this token before events get fired // skip, process instance is saved shortly after constructing root token // Services.assignId(this); }
protected void cancelProcess(long processIdToCancel) { ProcessInstance pi = jbpmContext.getGraphSession().loadProcessInstance(processIdToCancel); log.info("cancel process instance " + pi.getId()); // Record a standardized variable that we can use to determine that this // process has been 'canceled' and not just ended. pi.getContextInstance().createVariable(CANCELLATION_INDICATOR_VARIABLE_NAME, Clock.getCurrentTime()); try { // End the process instance and any open tokens // TODO: Think about maybe canceling sub processes? cancelToken(pi.getRootToken()); pi.end(); log.info("finished process cancellation"); } catch (RuntimeException ex) { log.error("problems while cancel process", ex); throw ex; } }
protected void cancelProcess(long processIdToCancel) { ProcessInstance pi = jbpmContext.getGraphSession().loadProcessInstance(processIdToCancel); log.info("cancel process instance " + pi.getId()); // Record a standardized variable that we can use to determine that this // process has been 'canceled' and not just ended. pi.getContextInstance().createVariable(CANCELLATION_INDICATOR_VARIABLE_NAME, Clock.getCurrentTime()); try { // End the process instance and any open tokens // TODO: Think about maybe canceling sub processes? cancelToken(pi.getRootToken()); pi.end(); log.info("finished process cancellation"); } catch (RuntimeException ex) { log.error("problems while cancel process", ex); throw ex; } }
end = Clock.getCurrentTime();
end = Clock.getCurrentTime();
public Object execute(JbpmContext jbpmContext) throws Exception { this.jbpmContext = jbpmContext; Token token = jbpmContext.getGraphSession().loadToken(tokenId); // create a token local process variable to indicate this token was canceled token.getProcessInstance().getContextInstance().createVariable( CANCELLATION_INDICATOR_VARIABLE_NAME, Clock.getCurrentTime(), token); cancelToken(token); this.jbpmContext = null; return null; }
public Object execute(JbpmContext jbpmContext) throws Exception { this.jbpmContext = jbpmContext; Token token = jbpmContext.getGraphSession().loadToken(tokenId); // create a token local process variable to indicate this token was canceled token.getProcessInstance().getContextInstance().createVariable( CANCELLATION_INDICATOR_VARIABLE_NAME, Clock.getCurrentTime(), token); cancelToken(token); this.jbpmContext = null; return null; }
/** * creates a child token. */ public Token(Token parent, String name) { this.start = Clock.getCurrentTime(); this.processInstance = parent.getProcessInstance(); this.name = name; this.node = parent.getNode(); this.parent = parent; parent.addChild(this); this.isTerminationImplicit = parent.isTerminationImplicit(); parent.addLog(new TokenCreateLog(this)); // assign an id to this token before events get fired Services.assignId(this); }
/** * creates a child token. */ public Token(Token parent, String name) { this.start = Clock.getCurrentTime(); this.processInstance = parent.getProcessInstance(); this.name = name; this.node = parent.getNode(); this.parent = parent; parent.addChild(this); this.isTerminationImplicit = parent.isTerminationImplicit(); parent.addLog(new TokenCreateLog(this)); // assign an id to this token before events get fired Services.assignId(this); }