return getJbpmContext().getGraphSession().findProcessDefinition(processName, newVersion);
}
public ProcessInstance execute(ProcessInstance pi)
{
ProcessDefinition oldDef = pi.getProcessDefinition();
ProcessDefinition newDef = loadNewProcessDefinition(oldDef.getName());
if (newDef==null) {
throw new JbpmException("Process definition " + oldDef.getName() + " in version " + newVersion + " not found.");
}
// set process variable to remember old version
pi.getContextInstance().setVariable(OLD_VERSION_PROCESS_VARIABLE_NAME, oldDef.getVersion());
log.debug("Start changing process id " + pi.getId() + " from version " + pi.getProcessDefinition().getVersion() + " to new version " + newDef.getVersion());
pi.setProcessDefinition(newDef);
changeTokenVersion(pi.getRootToken());
log.debug("process id " + pi.getId() + " changed to version " + pi.getProcessDefinition().getVersion());