Package org.jbpm.graph.def

Examples of org.jbpm.graph.def.ProcessDefinition


                final String contentType = fileMatcher.getContentType();
                final String file = fileMatcher.getFile();
                final HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
                final JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
                try {
                    final ProcessDefinition processDefinition = jbpmContext.getGraphSession().getProcessDefinition(id);
                    if (processDefinition == null) {
                        try {
                            response.sendError(404, "Process definition " + id + " does not exist");
                            facesContext.responseComplete();
                            break;
                        } catch (IOException e) {
                            log.log(Level.SEVERE, "Failed to send 404 Not Found to client", e);
                        }
                    }
                    if (!processDefinition.getFileDefinition().hasFile(file)) {
                        try {
                            response.sendError(404, "Process definition " + id + " does not contain file '" + file + "'");
                            facesContext.responseComplete();
                            break;
                        } catch (IOException e) {
                            log.log(Level.SEVERE, "Failed to send 404 Not Found to client", e);
                        }
                    }
                    final byte[] bytes;
                    bytes = processDefinition.getFileDefinition().getBytes(file);
                    response.setContentLength(bytes.length);
                    response.setContentType(contentType);
                    try {
                        final OutputStream outputStream = response.getOutputStream();
                        try {
View Full Code Here


            }
            if (!(processValue instanceof ProcessDefinition)) {
                context.setError("Error starting process", "Attempted to start something other than a process");
                return;
            }
            final ProcessDefinition definition = (ProcessDefinition) processValue;
            final ProcessInstance instance = definition.createProcessInstance();
            // Signal the root token based on the following criteria:
            // 1. If there is no start task, and
            // 2. If the root token is still at the start state, and
            // 3. If the start state has a default leaving transition, then
            // signal the token along the default transition.
View Full Code Here

  // parse the process definition from the contents ///////////////////////////

  public ProcessDefinition parseProcessDefinition()
  {
    ProcessDefinition processDefinition = ProcessDefinition.createNewProcessDefinition();
    Iterator iter = processArchiveParsers.iterator();
    while (iter.hasNext())
    {
      ProcessArchiveParser processArchiveParser = (ProcessArchiveParser)iter.next();
      processDefinition = processArchiveParser.readFromArchive(this, processDefinition);
View Full Code Here

        final String file = (String) fileExpression.getValue(ctx);
        if (file == null || file.length() == 0) {
            return;
        }
        final ProcessDefinition processDefinition = (ProcessDefinition) processExpression.getValue(ctx);
        if (processDefinition == null) {
            throw new TagException(tag, "Value for process attribute is null");
        }
        final FileDefinition fileDefinition = processDefinition.getFileDefinition();
        if (fileDefinition == null) {
            throw new TagException(tag, "Process has a null fileDefinition property");
        }
        if (! fileDefinition.hasFile(file)) {
            throw new TagException(tag, "Process does not contain file '" + file + "'");
        }
        VariableMapper orig = ctx.getVariableMapper();
        final VariableMapperWrapper newVarMapper = new VariableMapperWrapper(orig);
        ctx.setVariableMapper(newVarMapper);
        try {
            final StringBuffer buffer = new StringBuffer();
            buffer.append(processDefinition.getId());
            buffer.append("/");
            buffer.append(file);
            nextHandler.apply(ctx, parent);
            ctx.includeFacelet(parent, new URL("par", "", 0, buffer.toString(), new FileDefinitionURLStreamHandler(fileDefinition, file)));
        } finally {
View Full Code Here

  public Object execute(JbpmContext jbpmContext) throws Exception
  {
    if (par == null && xml == null)
      throw new JbpmException("either xml string or process archive must be given.");

    ProcessDefinition processDefinition;
    if (par != null)
    {
      log.debug("parse process from archive");

      // Thanks to George Mournos who helped to improve this:
View Full Code Here

   *
   * @throws JbpmException when no processDefinition with the given name is deployed.
   */
  public ProcessInstance newProcessInstance(String processDefinitionName)
  {
    ProcessDefinition processDefinition = getGraphSession().findLatestProcessDefinition(processDefinitionName);
    return new ProcessInstance(processDefinition);
  }
View Full Code Here

   *
   * @throws JbpmException when no processDefinition with the given name is deployed.
   */
  public ProcessInstance newProcessInstanceForUpdate(String processDefinitionName)
  {
    ProcessDefinition processDefinition = getGraphSession().findLatestProcessDefinition(processDefinitionName);
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    addAutoSaveProcessInstance(processInstance);
    return processInstance;
  }
View Full Code Here

  public void execute(ExecutionContext executionContext)
  {
    Token superProcessToken = executionContext.getToken();

    ProcessDefinition usedSubProcessDefinition = subProcessDefinition;
    // if this process has late binding
    if ((subProcessDefinition == null) && (subProcessName != null))
    {
      SubProcessResolver subProcessResolver = getSubProcessResolver();
      List<FlyweightAttribute> attributes = new ArrayList<FlyweightAttribute>();
View Full Code Here

  }

  private void deployProcessArchive(JbpmConfiguration jbpmConfiguration, File processFile) {
    try {
      log("deploying process from archive "+processFile.getName());
      ProcessDefinition processDefinition = parseProcessArchive(processFile);
      deployProcessDefinition(processDefinition, jbpmConfiguration);
    }
    catch (IOException e) {
      log("failed to read process archive " + processFile.getName(), e, Project.MSG_ERR);
      throw new BuildException(e.getMessage(), e);
View Full Code Here

  }

  private ProcessDefinition parseProcessArchive(File processFile) throws IOException {
    ZipInputStream processStream = new ZipInputStream(new FileInputStream(processFile));
    try {
      ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(processStream);
      log("created process definition " + processDefinition.getName());
      return processDefinition;
    }
    finally {
      processStream.close();
    }
View Full Code Here

TOP

Related Classes of org.jbpm.graph.def.ProcessDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.