Package org.activiti.engine.repository

Examples of org.activiti.engine.repository.DeploymentBuilder


        // Create a separate deployment for each resource using the resource name

        for (final Resource resource : resources) {

            final String resourceName = determineResourceName(resource);
            final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(resourceName);

            try {
                if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
                    deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
                } else {
                    deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
                }
            } catch (IOException e) {
                throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
            }

            deploymentBuilder.deploy();
        }
    }
View Full Code Here


    repositoryService.activateProcessDefinitionByKey(processDefinitionKey);
  }

  @ManagedOperation(description = "Deploy Process Definition")
  public void deployProcessDefinition(String resourceName, String processDefinitionFile) throws FileNotFoundException {
    DeploymentBuilder deploymentBuilder =  repositoryService.createDeployment();
    Deployment deployment = deploymentBuilder.addInputStream(resourceName, new FileInputStream(processDefinitionFile)).deploy();
  }
View Full Code Here

    }
   
    MultipartFile file = multipartRequest.getFileMap().values().iterator().next();
   
    try {
      DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
      String fileName = file.getName();
      if (fileName.endsWith(".bpmn20.xml") || fileName.endsWith(".bpmn")) {
        deploymentBuilder.addInputStream(fileName, file.getInputStream());
      } else if (fileName.toLowerCase().endsWith(".bar") || fileName.toLowerCase().endsWith(".zip")) {
        deploymentBuilder.addZipInputStream(new ZipInputStream(file.getInputStream()));
      } else {
        throw new ActivitiIllegalArgumentException("File must be of type .bpmn20.xml, .bpmn, .bar or .zip");
      }
      deploymentBuilder.name(fileName);
     
      if(tenantId != null) {
        deploymentBuilder.tenantId(tenantId);
      }
     
      Deployment deployment = deploymentBuilder.deploy();
     
      response.setStatus(HttpStatus.CREATED.value());
     
      return restResponseFactory.createDeploymentResponse(deployment, request.getRequestURL().toString().replace("/repository/deployments", ""));
     
View Full Code Here

    @Override
    public void deployResources(final String deploymentNameHint, final Resource[] resources, final RepositoryService repositoryService) {

        // Create a single deployment for all resources using the name hint as the
        // literal name
        final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(deploymentNameHint);

        for (final Resource resource : resources) {
            final String resourceName = determineResourceName(resource);

            try {
                if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
                    deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
                } else {
                    deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
                }
            } catch (IOException e) {
                throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
            }
        }

        deploymentBuilder.deploy();

    }
View Full Code Here

      showUploadedDeployment();
    }
  }

  protected void deployUploadedFile() {
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().name(fileName);
    DeploymentFilter deploymentFilter = ExplorerApp.get().getComponentFactory(DeploymentFilterFactory.class).create();
    try {
      try {
        if (fileName.endsWith(".bpmn20.xml") || fileName.endsWith(".bpmn")) {
          validFile = true;
          deploymentBuilder.addInputStream(fileName, new ByteArrayInputStream(outputStream.toByteArray()));
        } else if (fileName.endsWith(".bar") || fileName.endsWith(".zip")) {
          validFile = true;
          deploymentBuilder.addZipInputStream(new ZipInputStream(new ByteArrayInputStream(outputStream.toByteArray())));
        } else {
          notificationManager.showErrorNotification(Messages.DEPLOYMENT_UPLOAD_INVALID_FILE,
              i18nManager.getMessage(Messages.DEPLOYMENT_UPLOAD_INVALID_FILE_EXPLANATION));
        }
       
        // If the deployment is valid, run it through the beforeDeploy and actually deploy it in Activiti
        if(validFile) {
          deploymentFilter.beforeDeploy(deploymentBuilder);
          deployment = deploymentBuilder.deploy();
        }
      } catch (ActivitiException e) {
        String errorMsg = e.getMessage().replace(System.getProperty("line.separator"), "<br/>");
        notificationManager.showErrorNotification(Messages.DEPLOYMENT_UPLOAD_FAILED, errorMsg);
      }
View Full Code Here

        String name = method.getName();
        String resource = getBpmnProcessDefinitionResource(testClass, name);
        resources = new String[]{resource};
      }
     
      DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService()
        .createDeployment()
        .name(testClass.getSimpleName()+"."+methodName);
     
      for (String resource: resources) {
        deploymentBuilder.addClasspathResource(resource);
      }
     
      deploymentId = deploymentBuilder.deploy().getId();
    }
   
    return deploymentId;
  }
View Full Code Here

    }

    public String deployProcessDefinition(String processName, InputStream definitionStream, InputStream processMapImageStream) {
        RepositoryService service = getProcessEngine()
                .getRepositoryService();
        DeploymentBuilder deployment = service.createDeployment();
//        deployment.name(processName);
        deployment.addInputStream(processName + ".bpmn20.xml", definitionStream);
        if (processMapImageStream != null)
            deployment.addInputStream(processName + ".png", processMapImageStream);
        Deployment deploy = deployment.deploy();
        return deploy.getId();
    }
View Full Code Here

    RepositoryService repoSvc = eng.getRepositoryService();
    RuntimeService rtSvc = eng.getRuntimeService();
   
    String wfn = "/diagrams/Wf.bpmn";
    String wffn = wfn+"20.xml"; // workaround for http://forums.activiti.org/en/viewtopic.php?f=8&t=3745&start=10
        DeploymentBuilder db = repoSvc
                 .createDeployment()
                 .addInputStream(wffn,this.getClass().getResourceAsStream(wfn));
   
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .deploymentId(d.getId())
                                 .singleResult();
View Full Code Here

        RepositoryService repoSvc = eng.getRepositoryService();
        RuntimeService rtSvc = eng.getRuntimeService();
       
        String wfn = "/diagrams/GenDiag.bpmn";
        String wffn = wfn+"20.xml"; // workaround for http://forums.activiti.org/en/viewtopic.php?f=8&t=3745&start=10
        DeploymentBuilder db = repoSvc
                               .createDeployment()
                               .addInputStream(wffn,this.getClass().getResourceAsStream(wfn));
       
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .deploymentId(d.getId())
                                 .singleResult();
       
View Full Code Here

    RepositoryService repoSvc = eng.getRepositoryService();
    RuntimeService rtSvc = eng.getRuntimeService();
   
    String wfn = "/diagrams/ScriptScript.bpmn";
    String wffn = wfn+"20.xml"; // workaround for http://forums.activiti.org/en/viewtopic.php?f=8&t=3745&start=10
        DeploymentBuilder db = repoSvc
                 .createDeployment()
                 .addInputStream(wffn,this.getClass().getResourceAsStream(wfn));
   
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .deploymentId(d.getId())
                                 .singleResult();
View Full Code Here

TOP

Related Classes of org.activiti.engine.repository.DeploymentBuilder

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.