Examples of JpdlProcessDefinition


Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

    private WorkflowDefinition convertToWorkflowDefinition(ProcessDefinition value, Locale locale) {
        WorkflowDefinition wf = new WorkflowDefinition(value.getName(), value.getKey(), this.key);
        wf.setFormResourceName(repositoryService.getStartFormResourceName(value.getId(),
                repositoryService.getStartActivityNames(value.getId()).get(0)));
        if (value instanceof JpdlProcessDefinition) {
            JpdlProcessDefinition definition = (JpdlProcessDefinition) value;
            final Map<String, TaskDefinitionImpl> taskDefinitions = definition.getTaskDefinitions();
            final Set<String> tasks = new LinkedHashSet<String>();
            tasks.add(WorkflowService.START_ROLE);
            tasks.addAll(taskDefinitions.keySet());
            wf.setTasks(tasks);
        }
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

    private void registerProcessListeners() {
        final List<ProcessDefinition> definitionList = repositoryService.createProcessDefinitionQuery().list();

        for (ProcessDefinition definition : definitionList) {
            if (definition instanceof JpdlProcessDefinition) {
                JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) definition;
                addEventListener(processDefinition, "start");
                addEventListener(processDefinition, "end");
            }
        }
    }
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

    public Object parseJpdl(Element element, Parse parse, JpdlParser parser)
    {
        MuleReceiveActivity activity;
       
        JpdlProcessDefinition processDefinition = parse.contextStackFind(JpdlProcessDefinition.class);       
        if (processDefinition.getInitial() == null)
        {
            processDefinition.setInitial(parse.contextStackFind(ActivityImpl.class));         
            activity = new MuleReceiveActivity(true);
        }
        else
        {
            activity = new MuleReceiveActivity(false);
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

    public Object parseJpdl(Element element, Parse parse, JpdlParser parser)
    {
        MuleReceiveActivity activity;
       
        JpdlProcessDefinition processDefinition = parse.contextStackFind(JpdlProcessDefinition.class);       
        if (processDefinition.getInitial() == null)
        {
            processDefinition.setInitial(parse.contextStackFind(ActivityImpl.class));         
            activity = new MuleReceiveActivity(true);
        }
        else
        {
            activity = new MuleReceiveActivity(false);
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

    super("start");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
    JpdlProcessDefinition processDefinition = parse.findObject(JpdlProcessDefinition.class);
   
    if (processDefinition.getInitial()==null) {
      processDefinition.setInitial(startActivity);
     
    } else if (startActivity.getParentActivity()==null) {
      parse.addProblem("multiple start events not yet supported", element);
    }
   
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

        InputStream inputStream = new ByteArrayInputStream(bytes);
        Parse parse = jpdlParser.createParse();
        parse.setProblems(deployment.getProblems());
        parse.setInputStream(inputStream);
        parse.execute();
        JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) parse.getDocumentObject();
        if ((processDefinition != null) && (processDefinition.getName() != null)) {
          String processDefinitionName = processDefinition.getName();
         
          processDefinition.setSuspended(deployment.isSuspended());
         
          String imageResourceName = resourceName.substring(0, resourceName.lastIndexOf(".jpdl.xml"))+".png";
          if (deployment.getResourceNames().contains(imageResourceName)) {
            processDefinition.setImageResourceName(imageResourceName);
          }

          processDefinition.setDeploymentDbid(deployment.getDbid());

          if (deployment.hasObjectProperties(processDefinitionName)) {
            String key = deployment.getProcessDefinitionKey(processDefinitionName);
            String id = deployment.getProcessDefinitionId(processDefinitionName);
            Long version = deployment.getProcessDefinitionVersion(processDefinitionName);
            processDefinition.setId(id);
            processDefinition.setKey(key);
            processDefinition.setVersion(version.intValue());

          } else {
            checkKey(processDefinition, deployment);
            checkVersion(processDefinition, deployment);
            checkId(processDefinition, deployment);

            deployment.setProcessDefinitionId(processDefinitionName, processDefinition.getId());
            deployment.setProcessDefinitionKey(processDefinitionName, processDefinition.getKey());
            deployment.setProcessDefinitionVersion(processDefinitionName, new Long(processDefinition.getVersion()));
          }

          deployment.addObject(processDefinitionName, processDefinition);
        }
      }
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

      }
    }
  }

  public Object parseDocumentElement(Element documentElement, Parse parse) {
    JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) parse.getDocumentObject();
    if (processDefinition==null) {
      processDefinition = new JpdlProcessDefinition();
      parse.setDocumentObject(processDefinition);
    }
   
    parse.pushObject(processDefinition);
    try {
      // process attribues
      String name = XmlUtil.attribute(documentElement, "name", true, parse);
      processDefinition.setName(name);
     
      String packageName = XmlUtil.attribute(documentElement, "package");
      processDefinition.setPackageName(packageName);

      Integer version = XmlUtil.attributeInteger(documentElement, "version", false, parse);
      if (version!=null) {
        processDefinition.setVersion(version);
      }

      String key = XmlUtil.attribute(documentElement, "key", false, parse);
      if (key!=null) {
        processDefinition.setKey(key);
      }

      Element descriptionElement = XmlUtil.element(documentElement, "description");
      if (descriptionElement!=null) {
        String description = XmlUtil.getContentText(descriptionElement);
        processDefinition.setDescription(description);
      }
     
      UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
      parse.pushObject(unresolvedTransitions);
     
      // swimlanes
      List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
      for (Element swimlaneElement: swimlaneElements) {
        String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", true, parse);
        if (swimlaneName!=null) {
          SwimlaneDefinitionImpl swimlaneDefinition =
              processDefinition.createSwimlaneDefinition(swimlaneName);
          JpdlParser.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
        }
      }

      // on events
      parseOnEvents(documentElement, parse, processDefinition);
     
      // activities
      parseActivities(documentElement, parse, processDefinition);

      // bind activities to their destinations
      resolveTransitionDestinations(parse, processDefinition, unresolvedTransitions);

    } finally {
      parse.popObject();
    }

    if (processDefinition.getInitial()==null) {
      parse.addProblem("no start activity in process", documentElement);
    }
   
    return processDefinition;
  }
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

      processDefinition.addTaskDefinitionImpl(taskDefinition);
    }

    String swimlaneName = XmlUtil.attribute(element, "swimlane");
    if (swimlaneName!=null) {
      JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
      SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
      if (swimlaneDefinition!=null) {
        taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
      } else {
        parse.addProblem("swimlane "+swimlaneName+" not declared", element);
      }
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

  }

  public Object parseDocumentElement(Element documentElement, Parse parse) {
    List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
   
    JpdlProcessDefinition processDefinition = instantiateNewJpdlProcessDefinition();
   
    processDefinitions.add(processDefinition);
   
    parse.contextStackPush(processDefinition);
    try {
      // process attribues
      String name = XmlUtil.attribute(documentElement, "name", true, parse);
      processDefinition.setName(name);

      // make the process language version available for bindings
      // to allow for specific parsing behaviour per version
     
      // first check if the langid is available as a deployment property
      DeploymentImpl deployment = (DeploymentImpl) parse.contextMapGet(Parse.CONTEXT_KEY_DEPLOYMENT);
      if (deployment!=null) {
        String processLanguageId = deployment.getProcessLanguageId(name);
        if (processLanguageId==null) {
          // if it is not available as a deployment property, check if the
          // jpdlparser attribute specifies a specific jpdl version.
          // this is the case for certain compatibility tests in our test suite
          String jpdlParser = XmlUtil.attribute(documentElement, "jpdlparser");
          if (jpdlParser!=null) {
            processLanguageId = "jpdl-"+jpdlParser;

          } else {
            // if none of the above, check if this is a parser test run for a specific verion
            // specify the jpdltestversion with "mvn -Djpdlparser=jpdl-4.3 clean install"
            // that way, the whole test suite will be use the specified parser
            jpdlParser = System.getProperty("jpdlparser");
            if (jpdlParser!=null) {
              processLanguageId = "jpdl-"+jpdlParser;

            } else {
              // if this process has a namespace, then use the namespace
              // to see what jpdl parser version should be used
              String namespaceUri = documentElement.getNamespaceURI();
              if (namespaceUri!=null) {
                processLanguageId = "jpdl-"+namespaceUri.substring(16, 19);

              } else {
                // if none of the above, just deploy it as the current library version
                processLanguageId = CURRENT_VERSION_PROCESS_LANGUAGE_ID;
              }
            }
          }
          // saving the process language will make sure that 
          // the right parser version is used after an upgrade of jbpm
          // as the old format xml will still be in the db
          deployment.setProcessLanguageId(name, processLanguageId);
        }
        parse.contextMapPut(Parse.CONTEXT_KEY_PROCESS_LANGUAGE_ID, processLanguageId);
      }

      String packageName = XmlUtil.attribute(documentElement, "package");
      processDefinition.setPackageName(packageName);

      Integer version = XmlUtil.attributeInteger(documentElement, "version", false, parse);
      if (version!=null) {
        processDefinition.setVersion(version);
      }

      String key = XmlUtil.attribute(documentElement, "key", false, parse);
      if (key!=null) {
        processDefinition.setKey(key);
      }

      Element descriptionElement = XmlUtil.element(documentElement, "description");
      if (descriptionElement!=null) {
        String description = XmlUtil.getContentText(descriptionElement);
        processDefinition.setDescription(description);
      }
     
      UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
      parse.contextStackPush(unresolvedTransitions);
     
      // swimlanes
      List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
      for (Element swimlaneElement: swimlaneElements) {
        String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", true, parse);
        if (swimlaneName!=null) {
          SwimlaneDefinitionImpl swimlaneDefinition =
              processDefinition.createSwimlaneDefinition(swimlaneName);
          parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
        }
      }

      // on events
      parseOnEvents(documentElement, parse, processDefinition);
     
      // activities
      parseActivities(documentElement, parse, processDefinition);

      // bind activities to their destinations
      resolveTransitionDestinations(parse, processDefinition, unresolvedTransitions);

      // process migration information
      Element migrationElement = XmlUtil.element(documentElement, "migrate-instances");
      if (migrationElement != null) {
        MigrationHelper.parseMigrationDescriptor(migrationElement, parse, processDefinition);
      }

    } finally {
      parse.contextStackPop();
    }

    if (processDefinition.getInitial()==null) {
      parse.addProblem("no start activity in process", documentElement);
    }
   
    return processDefinitions;
  }
View Full Code Here

Examples of org.jbpm.jpdl.internal.model.JpdlProcessDefinition

   
    return processDefinitions;
  }

  protected JpdlProcessDefinition instantiateNewJpdlProcessDefinition() {
    return new JpdlProcessDefinition();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.