Package org.jbpm.api

Examples of org.jbpm.api.ProcessDefinition


    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();

    try
    {
      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(procDefId)
          .uniqueResult();
      return ModelAdaptor.adoptDefinition(processDefinition);

    }
View Full Code Here


    try
    {

      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(procDefId)
          .uniqueResult();
      if (processDefinition!=null) {
        repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentId());
      }
      return getProcessDefinitions();
    }
    finally
    {
View Full Code Here

  public ProcessDefinitionQueryImpl createProcessDefinitionQuery() {
    return new ProcessDefinitionQueryImpl();
  }

  public ProcessDefinitionImpl findProcessDefinitionByKey(String processDefinitionKey) {
    ProcessDefinition processDefinition = createProcessDefinitionQuery()
      .processDefinitionKey(processDefinitionKey)
      .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
      .page(0, 1)
      .uniqueResult();

    if (processDefinition!=null) {
      return findProcessDefinitionById(processDefinition.getId());
    }

    return null;
  }
View Full Code Here

      if (processInstanceIds.size()>0) {
        throw new JbpmException("still "+processInstanceIds.size()+" process instances for process definition "+processDefinitionId);
      }
    }
   
    ProcessDefinition processDefinition = findProcessDefinitionById(processDefinitionId);
    session.delete(processDefinition);
  }
View Full Code Here

      if (log.isTraceEnabled()) log.trace("created id '"+id+"' for "+processDefinition);
      processDefinition.setId(id);
    }
   
    RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
    ProcessDefinition existingProcessDefinition = repositorySession.createProcessDefinitionQuery()
        .processDefinitionId(id)
        .uniqueResult();
    if (existingProcessDefinition != null) {
      deployment.addProblem("process '" + id + "' already exists");
    }
View Full Code Here

    int version = processDefinition.getVersion();
    String key = processDefinition.getKey();
    if (version==ProcessDefinitionImpl.UNASSIGNED_VERSION) {
      RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
     
      ProcessDefinition latestDeployedVersion = repositorySession
          .createProcessDefinitionQuery()
          .processDefinitionKey(key)
          .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
          .page(0, 1)
          .uniqueResult();

      if (latestDeployedVersion!=null) {
        version = latestDeployedVersion.getVersion() + 1;
      } else {
        version = 1;
      }
      if (log.isTraceEnabled()) log.trace("assigning version "+version+" to process definition "+key);
      processDefinition.setVersion(version);
View Full Code Here

      // check if a template exists
      String startFormResourceName = getStartFormName(ref.getReferenceId());
      if(null==startFormResourceName)
        throw new IllegalArgumentException("Process " +ref.getReferenceId() + " doesn't provide a start form");

      ProcessDefinition procDef =
          repoService
              .createProcessDefinitionQuery()
              .processDefinitionId(ref.getReferenceId())
              .uniqueResult();

      InputStream template = repoService.getResourceAsStream(
          procDef.getDeploymentId(), startFormResourceName
      );

      // merge template with process variables
      if(template!=null)
      {
View Full Code Here

    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();

    try
    {
      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(processId)
          .uniqueResult();

      String imgRes = processDefinition.getImageResourceName();
      InputStream in = repositoryService.getResourceAsStream(
          processDefinition.getDeploymentId(), imgRes
      );

      if(null==in)
        throw new RuntimeException("Failed to retrieve image resource: " +imgRes);
View Full Code Here

    boolean hasImageResource = false;

    try
    {
      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(id)
          .uniqueResult();

      InputStream inputStream = null;
      if(processDefinition!=null)//TODO: JBPM-2383 Suspended definitions don't show up here
      {
        String imgRes = processDefinition.getImageResourceName();
        inputStream = repositoryService.getResourceAsStream(
            processDefinition.getDeploymentId(), imgRes
        );
      }

      if(inputStream!=null)
      {
View Full Code Here

    public void pic() throws IOException
    {
        init();
        ProcessInstance processInstance = executionService.findProcessInstanceById(id);
        String processDefinitionId = processInstance.getProcessDefinitionId();
        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).uniqueResult();
       
        String path=ServletActionContext.getRequest().getRealPath("");
//        String filePath=path+"\\WEB-INF\\classes\\leave2.png";
        String filePath="leave2.png";
        System.out.println("filePath: "+filePath);
        File file=new File(filePath);
        System.out.println("存在么: "+file.exists());
       
        //此处不知道为什么还要特别的通过repositoryService和processDefinition.getDeploymentId()来显示此图片
        InputStream inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),filePath);
      
        System.out.println("inputStream2: "+inputStream);
        //InputStream inputStream =new FileInputStream(new File("D:/program/java/servers/apache-tomcat-5.5.23/webapps/jbpm2/WEB-INF/classes/leave.png"));
        byte[] b = new byte[1024];
        int len = -1;
View Full Code Here

TOP

Related Classes of org.jbpm.api.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.