@Override public String toString() { String name = processInstance==null ? "null" : processInstance.getProcessDefinition().getName(); return "Pageflow(" + name + ")"; }
public ProcessDefinition getProcessDefinition() { ProcessInstance processInstance = getProcessInstance(); return (processInstance != null ? processInstance.getProcessDefinition() : null); }
public ProcessDefinition getProcessDefinition() { ProcessInstance processInstance = getProcessInstance(); return (processInstance != null ? processInstance.getProcessDefinition() : null); }
/** * 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); }
/** * 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); }
public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof ProcessInstance)) return false; ProcessInstance other = (ProcessInstance) o; if (id != 0 && id == other.getId()) return true; return key != null && key.equals(other.getKey()) && processDefinition.equals(other.getProcessDefinition()); }
public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof ProcessInstance)) return false; ProcessInstance other = (ProcessInstance) o; if (id != 0 && id == other.getId()) return true; return key != null && key.equals(other.getKey()) && processDefinition.equals(other.getProcessDefinition()); }
private void adjustTaskInstancesForToken(Token token) { ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition(); boolean debug = log.isDebugEnabled(); for (Iterator i = getTasksForToken(token).iterator(); i.hasNext();) { TaskInstance ti = (TaskInstance) i.next(); // find new task Task oldTask = ti.getTask(); Node oldNode = oldTask.getTaskNode(); Task newTask = findReplacementTask(newDef, oldNode, oldTask); ti.setTask(newTask); if (debug) log.debug("adjusted " + ti); } }
private void adjustTaskInstancesForToken(Token token) { ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition(); boolean debug = log.isDebugEnabled(); for (Iterator i = getTasksForToken(token).iterator(); i.hasNext();) { TaskInstance ti = (TaskInstance) i.next(); // find new task Task oldTask = ti.getTask(); Node oldNode = oldTask.getTaskNode(); Task newTask = findReplacementTask(newDef, oldNode, oldTask); ti.setTask(newTask); if (debug) log.debug("adjusted " + ti); } }
public Object getValue() { if (isValueCached) return valueCache; Object value = getObject(); if (value != null && converter != null) { if (converter instanceof SerializableToByteArrayConverter && processInstance != null) { SerializableToByteArrayConverter s2bConverter = (SerializableToByteArrayConverter) converter; value = s2bConverter.revert(value, processInstance.getProcessDefinition()); } else { value = converter.revert(value); } valueCache = value; isValueCached = true; } return value; }
public Object getValue() { if (isValueCached) return valueCache; Object value = getObject(); if (value != null && converter != null) { if (converter instanceof SerializableToByteArrayConverter && processInstance != null) { SerializableToByteArrayConverter s2bConverter = (SerializableToByteArrayConverter) converter; value = s2bConverter.revert(value, processInstance.getProcessDefinition()); } else { value = converter.revert(value); } valueCache = value; isValueCached = true; } return value; }
public ProcessInstance execute(ProcessInstance pi) { ProcessDefinition oldDef = pi.getProcessDefinition(); ProcessDefinition newDef = findNewProcessDefinition(oldDef.getName()); boolean debug = log.isDebugEnabled(); if (debug) { log.debug("migrating " + pi + " from version " + oldDef.getVersion() + " to " + newDef.getVersion()); } pi.setProcessDefinition(newDef); changeTokenVersion(pi.getRootToken()); if (debug) log.debug(pi + " migrated to version " + newDef.getVersion()); return pi; }
private void changeTokenVersion(Token token) { // change node reference on token (current node) Node oldNode = token.getNode(); ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition(); Node newNode = findReplacementNode(newDef, oldNode); token.setNode(newNode); // Change timers too! adjustTimersForToken(token); // change tasks adjustTaskInstancesForToken(token); // change children recursively Map children = token.getChildren(); if (children != null) { for (Iterator i = children.values().iterator(); i.hasNext();) { changeTokenVersion((Token) i.next()); } } }
public ProcessInstance execute(ProcessInstance pi) { ProcessDefinition oldDef = pi.getProcessDefinition(); ProcessDefinition newDef = findNewProcessDefinition(oldDef.getName()); boolean debug = log.isDebugEnabled(); if (debug) { log.debug("migrating " + pi + " from version " + oldDef.getVersion() + " to " + newDef.getVersion()); } pi.setProcessDefinition(newDef); changeTokenVersion(pi.getRootToken()); if (debug) log.debug(pi + " migrated to version " + newDef.getVersion()); return pi; }
private void changeTokenVersion(Token token) { // change node reference on token (current node) Node oldNode = token.getNode(); ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition(); Node newNode = findReplacementNode(newDef, oldNode); token.setNode(newNode); // Change timers too! adjustTimersForToken(token); // change tasks adjustTaskInstancesForToken(token); // change children recursively Map children = token.getChildren(); if (children != null) { for (Iterator i = children.values().iterator(); i.hasNext();) { changeTokenVersion((Token) i.next()); } } }
protected void raiseEndEventIfNecessary() { if ( processInstance.hasEnded() ) { Events.instance().raiseEvent( "org.jboss.seam.endPageflow." + processInstance.getProcessDefinition().getName() ); Events.instance().raiseEvent( "org.jboss.seam.endPageflow"); } }
/** * Signal the given transition for the current process instance. * * @param transitionName the jBPM transition name */ public void transition(String transitionName) { ProcessInstance process = org.jboss.seam.bpm.ProcessInstance.instance(); process.signal(transitionName); if ( process.hasEnded() ) { Events.instance().raiseEvent("org.jboss.seam.endProcess." + process.getProcessDefinition().getName()); } }
private boolean afterResumeProcess(long processId, ProcessInstance process) { if ( process==null ) { processNotFound(processId); return false; } else if ( process.hasEnded() ) { processEnded(processId); return false; } else { Events.instance().raiseEvent("org.jboss.seam.initProcess." + process.getProcessDefinition().getName()); return true; } }
private boolean afterResumeProcess(String processKey, ProcessInstance process) { if ( process==null ) { processNotFound(processKey); return false; } else if ( process.hasEnded() ) { processEnded(processKey); return false; } else { Events.instance().raiseEvent("org.jboss.seam.initProcess." + process.getProcessDefinition().getName()); return true; } }
public void storePageflow() { if ( Init.instance().isJbpmInstalled() ) { Pageflow pageflow = Pageflow.instance(); if ( pageflow.isInProcess() /*&& !pageflow.getProcessInstance().hasEnded()*/ && Manager.instance().isLongRunningConversation() ) { pageflowName = pageflow.getSubProcessInstance().getProcessDefinition().getName(); pageflowNodeName = pageflow.getNode().getName(); pageflowCounter = pageflow.getPageflowCounter(); } else { pageflowName = null; pageflowNodeName = null; pageflowCounter = null; } } }