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; }
/** * Tells whether this process definition is equal to the given object. This method considers * two process definitions equal if they are equal in name and version, the name is not null * and the version is not negative. */ public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof ProcessDefinition)) return false; ProcessDefinition other = (ProcessDefinition) o; if (id != 0 && id == other.getId()) return true; return name != null && version >= 0 && name.equals(other.getName()) && version == other.getVersion(); }
/** * Tells whether this process definition is equal to the given object. This method considers * two process definitions equal if they are equal in name and version, the name is not null * and the version is not negative. */ public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof ProcessDefinition)) return false; ProcessDefinition other = (ProcessDefinition) o; if (id != 0 && id == other.getId()) return true; return name != null && version >= 0 && name.equals(other.getName()) && version == other.getVersion(); }
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; }
protected Class findClass(String className) throws ClassNotFoundException { ProcessDefinition processDefinition = getProcessDefinition(); FileDefinition fileDefinition; if (processDefinition == null || (fileDefinition = processDefinition.getFileDefinition()) == null) { throw new ClassNotFoundException(className); } // look in the classes directory of the file module definition String fileName = "classes/" + className.replace('.', '/') + ".class"; byte[] classBytes = fileDefinition.getBytes(fileName); if (classBytes == null) throw new ClassNotFoundException(className); // if the class is in a package int packageIndex = className.lastIndexOf('.'); if (packageIndex != -1) { // check whether this class loader (or any ancestor) defined the package already String packageName = className.substring(0, packageIndex); if (getPackage(packageName) == null) { // define the package prior to defining the class // see https://jira.jboss.org/jira/browse/JBPM-1404 definePackage(packageName, null, null, null, processDefinition.getName(), Integer.toString(processDefinition.getVersion()), null, null); } } return defineClass(className, classBytes, 0, classBytes.length); } }
protected Class findClass(String className) throws ClassNotFoundException { ProcessDefinition processDefinition = getProcessDefinition(); FileDefinition fileDefinition; if (processDefinition == null || (fileDefinition = processDefinition.getFileDefinition()) == null) { throw new ClassNotFoundException(className); } // look in the classes directory of the file module definition String fileName = "classes/" + className.replace('.', '/') + ".class"; byte[] classBytes = fileDefinition.getBytes(fileName); if (classBytes == null) throw new ClassNotFoundException(className); // if the class is in a package int packageIndex = className.lastIndexOf('.'); if (packageIndex != -1) { // check whether this class loader (or any ancestor) defined the package already String packageName = className.substring(0, packageIndex); if (getPackage(packageName) == null) { // define the package prior to defining the class // see https://jira.jboss.org/jira/browse/JBPM-1404 definePackage(packageName, null, null, null, processDefinition.getName(), Integer.toString(processDefinition.getVersion()), null, null); } } return defineClass(className, classBytes, 0, classBytes.length); } }
/** * assigns a version number to the given process definition and then makes it persistent. */ public void deployProcessDefinition(ProcessDefinition processDefinition) { // versioning applies to named process definitions only String processName = processDefinition.getName(); if (processName == null) { throw new JbpmException("process definition has no name"); } // find the current latest process definition ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processName); // if there is a current latest process definition if (previousLatestVersion != null) { // take the next version number processDefinition.setVersion(previousLatestVersion.getVersion() + 1); } else { // start from 1 processDefinition.setVersion(1); } saveProcessDefinition(processDefinition); }
/** * assigns a version number to the given process definition and then makes it persistent. */ public void deployProcessDefinition(ProcessDefinition processDefinition) { // versioning applies to named process definitions only String processName = processDefinition.getName(); if (processName == null) { throw new JbpmException("process definition has no name"); } // find the current latest process definition ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processName); // if there is a current latest process definition if (previousLatestVersion != null) { // take the next version number processDefinition.setVersion(previousLatestVersion.getVersion() + 1); } else { // start from 1 processDefinition.setVersion(1); } saveProcessDefinition(processDefinition); }