/** * 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); }