public ProcessDefinition readFromArchive(ProcessArchive processArchive, ProcessDefinition processDefinition) throws JpdlException { // getting the value byte[] processBytes = processArchive.getEntry("processdefinition.xml"); if (processBytes == null) { throw new JpdlException("no processdefinition.xml inside process archive"); } ByteArrayInputStream processStream = new ByteArrayInputStream(processBytes); JpdlXmlReader jpdlXmlReader = new JpdlXmlReader(new InputSource(processStream), processArchive); return jpdlXmlReader.readProcessDefinition(); } }
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; }
/** * parse a process definition from an xml resource file. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseXmlResource(String xmlResource) { URL resourceURL = ClassLoaderUtil.getClassLoader().getResource(xmlResource); if (resourceURL == null) { throw new JpdlException("resource not found: " + xmlResource); } JpdlXmlReader jpdlReader = new JpdlXmlReader(new InputSource(resourceURL.toString())); return jpdlReader.readProcessDefinition(); }
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; }
/** * parse a process definition from an xml resource file. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseXmlResource(String xmlResource) { URL resourceURL = ClassLoaderUtil.getClassLoader().getResource(xmlResource); if (resourceURL == null) { throw new JpdlException("resource not found: " + xmlResource); } JpdlXmlReader jpdlReader = new JpdlXmlReader(new InputSource(resourceURL.toString())); return jpdlReader.readProcessDefinition(); }
public ProcessDefinition readFromArchive(ProcessArchive processArchive, ProcessDefinition processDefinition) throws JpdlException { // getting the value byte[] processBytes = processArchive.getEntry("processdefinition.xml"); if (processBytes == null) { throw new JpdlException("no processdefinition.xml inside process archive"); } ByteArrayInputStream processStream = new ByteArrayInputStream(processBytes); JpdlXmlReader jpdlXmlReader = new JpdlXmlReader(new InputSource(processStream), processArchive); return jpdlXmlReader.readProcessDefinition(); } }
public ProcessDefinition parseProcessDefinition() { ProcessDefinition processDefinition = ProcessDefinition.createNewProcessDefinition(); for (Iterator iter = getParsers().iterator(); iter.hasNext();) { ProcessArchiveParser processArchiveParser = (ProcessArchiveParser) iter.next(); processDefinition = processArchiveParser.readFromArchive(this, processDefinition); } if (Problem.containsProblemsOfLevel(problems, Problem.LEVEL_ERROR)) { throw new JpdlException(problems); } return processDefinition; }
public ProcessDefinition parseProcessDefinition() { ProcessDefinition processDefinition = ProcessDefinition.createNewProcessDefinition(); for (Iterator iter = getParsers().iterator(); iter.hasNext();) { ProcessArchiveParser processArchiveParser = (ProcessArchiveParser) iter.next(); processDefinition = processArchiveParser.readFromArchive(this, processDefinition); } if (Problem.containsProblemsOfLevel(problems, Problem.LEVEL_ERROR)) { throw new JpdlException(problems); } return processDefinition; }
public void write(ProcessDefinition processDefinition) { if (processDefinition == null) throw new JbpmException("process definition is null"); problems.clear(); try { // collect the actions of the process definition // we will remove each named event action and the remaining ones will be written // on the process definition. Document document = createDomTree(processDefinition); // write the document using the given writer XMLWriter xmlWriter = new XMLWriter(writer, OutputFormat.createPrettyPrint()); xmlWriter.write(document); xmlWriter.flush(); } catch (IOException e) { Problem problem = new Problem(Problem.LEVEL_ERROR, "could not write process definition", e); problems.add(problem); } if (problems.size() > 0) throw new JpdlException(problems); }
public void write(ProcessDefinition processDefinition) { if (processDefinition == null) throw new JbpmException("process definition is null"); problems.clear(); try { // collect the actions of the process definition // we will remove each named event action and the remaining ones will be written // on the process definition. Document document = createDomTree(processDefinition); // write the document using the given writer XMLWriter xmlWriter = new XMLWriter(writer, OutputFormat.createPrettyPrint()); xmlWriter.write(document); xmlWriter.flush(); } catch (IOException e) { Problem problem = new Problem(Problem.LEVEL_ERROR, "could not write process definition", e); problems.add(problem); } if (problems.size() > 0) throw new JpdlException(problems); }
throw new JpdlException("missing sub-process name"); throw new JpdlException("bad sub-process version value: " + subProcessVersion);
public static ProcessDefinition getPageflowDefinitionFromResource(String resourceName) { InputStream resource = ResourceLoader.instance().getResourceAsStream(resourceName); if (resource==null) { throw new IllegalArgumentException("pageflow resource not found: " + resourceName); } try { return Jbpm.parseInputSource( new InputSource(resource) ); } catch (JpdlException e) { throw new JpdlException("Unable to parse process definition " + resourceName, e); } finally { Resources.closeStream(resource); } }
throw new JpdlException("missing sub-process name"); throw new JpdlException("bad sub-process version value: " + subProcessVersion);
throw new JpdlException("failed to parse process document", e); throw new JpdlException(problems);
throw new JpdlException("failed to parse process document", e); throw new JpdlException(problems);