public String getName() { return jbpmProc.getName(); }
/** * Dynamically deploy a page flow definition, if a pageflow with an * identical name already exists, the pageflow is updated. * * @return true if the pageflow definition has been updated */ public boolean deployPageflowDefinition(ProcessDefinition pageflowDefinition) { return pageflowProcessDefinitions.put( pageflowDefinition.getName(), pageflowDefinition )!=null; }
@Override public String toString() { String name = processInstance==null ? "null" : processInstance.getProcessDefinition().getName(); return "Pageflow(" + name + ")"; }
/** * 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(); }
private ProcessDefinition resolveSubProcess(Element subProcessElement, JpdlXmlReader jpdlReader) { SubProcessResolver subProcessResolver = getSubProcessResolver(); try { ProcessDefinition subProcess = subProcessResolver.findSubProcess(subProcessElement); if (subProcess != null) { if (log.isDebugEnabled()) log.debug("bound " + this + " to " + subProcess); return subProcess; } } catch (JpdlException e) { jpdlReader.addError(e.getMessage()); } // check whether this is a recursive process invocation String subProcessName = subProcessElement.attributeValue("name"); if (subProcessName != null && subProcessName.equals(processDefinition.getName())) { if (log.isDebugEnabled()) { log.debug("bound " + this + " to its own " + processDefinition); } return processDefinition; } return null; }
private void installPageflowDefinitions() { Set<String> mergedPageflowDefinitions = new LinkedHashSet<String>(); if ( pageflowDefinitions!=null ) { mergedPageflowDefinitions.addAll(Arrays.asList(pageflowDefinitions)); } for (FileDescriptor fileDescriptor : ((PageflowDeploymentHandler) ((DeploymentStrategy) Contexts.getEventContext().get(StandardDeploymentStrategy.NAME)).getDeploymentHandlers().get(PageflowDeploymentHandler.NAME)).getResources()) { mergedPageflowDefinitions.add(fileDescriptor.getName()); } for (String pageflow: mergedPageflowDefinitions) { ProcessDefinition pd = getPageflowDefinitionFromResource(pageflow); pageflowProcessDefinitions.put( pd.getName(), pd ); } }
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); } }
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 deployProcess(JbpmContext jbpmContext, String definitionResource) { ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource(definitionResource); if (log.isDebugEnabled()) { log.debug( "deploying process definition : " + processDefinition.getName() ); } jbpmContext.deployProcessDefinition(processDefinition); }
private boolean isPageflow(final ExecutionContext context) { return Contexts.isConversationContextActive() && Jbpm.instance().isPageflowProcessDefinition( context.getProcessDefinition().getName() ); }
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 static ProcessInstance createInstance(ProcessDefinition processDefinition) { JbpmContext jbpmContext = Jbpm.createPageflowContext(); try { log.debug( "new pageflow instance for definition: " + processDefinition.getName() ); return processDefinition.createProcessInstance(); } finally { jbpmContext.close(); } }
/** * Reposition the pageflow at the named node. * * @param nodeName the name of a node */ public void reposition(String nodeName) { if (processInstance==null) { throw new IllegalStateException("no pageflow in progress"); } ProcessInstance subProcess = getSubProcessInstance(); Node node = subProcess.getProcessDefinition().getNode(nodeName); if (node==null) { throw new IllegalArgumentException( "no node named: " + nodeName + " for pageflow: " + subProcess.getProcessDefinition().getName() ); } subProcess.getRootToken().setNode(node); setDirty(); }
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; } }
/** * 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); }
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; } } }