AnsweredAssumed Answered

Programmatic deployment --> process definition not detected

Question asked by mtaal on Jan 2, 2012
Latest reply on Oct 17, 2014 by jbarrez
Hi,
I am programmatically deploying a bpmn definition (the vacation request example). The deployment is visible in the admin ui of the explorer, but no processdefinition is created. I can see that the xml is there. If I upload directly in the UI then the process definition is found.

I checked and I do exactly the same as the auto deployment code in the SpringProcessEngineConfiguration code.

I run my code (see below) in the ContextListener.contextInitialized method. Should I do an explicit commit somehow? Or something else? (I do .deploy after adding input streams)

Thanks!

gr. Martin

        String deploymentName;
        if (workFlow.getModule().isInDevelopment()) {
          deploymentName = workFlow.getName() + "_" + System.currentTimeMillis();
        } else {
          deploymentName = workFlow.getName() + "_" + workFlow.getModule().getVersion();
        }
        deploymentName += ".bpnm20.xml";
        final Deployment deployment = repositoryService.createDeploymentQuery()
            .deploymentName(deploymentName).singleResult();
        if (deployment == null) {
          final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment()
              .enableDuplicateFiltering().name(deploymentName);
          if (workFlow.getImagePath() != null) {
            deploymentBuilder.addInputStream(workFlow.getImagePath(), this.getClass()
                .getResourceAsStream("/" + workFlow.getImagePath()));
          }
          deploymentBuilder.addInputStream(deploymentName, new ByteArrayInputStream(workFlow
              .getWorkflow().getBytes("UTF-8")));
          deploymentBuilder.deploy();
        }

Outcomes