4 Replies Latest reply on Sep 1, 2009 8:41 AM by jbarrez

    Process definition xml

    gleenders

      Is it possible to retrieve the xml String of the processdefinition of a processinstance via the api?

        • 1. Re: Process definition xml
          kukeltje

          in 4? Yes, look e.g. at the sourcecode of the form integration module. It retrieves the .ftl files from the deployment.

          • 2. Re: Process definition xml
            gleenders

            Ronald thanks a lot. You helped me out here.

            The following does the trick:

             ExecutionService executionService = PE.getExecutionService();
             RepositoryService repositoryService = PE.getRepositoryService();
             //Find the process instance.
             ProcessInstance processInstance = executionService.findProcessInstanceById(processInstanceById);
             String processDefinitionId = processInstance.getProcessDefinitionId();
             //Find the processDefinition.
             ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).uniqueResult();
             //long deploymentId = Long.parseLong(processDefinition.getDeploymentId());
             //DeploymentImpl deployment = (DeploymentImpl)repositoryService.createDeploymentQuery().deploymentDbid(deploymentId).uniqueResult();
             InputStream in = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), "xmlstring.jpdl.xml");
             if (in != null){
             return in.toString();
             } else {
             return null;
             }


            but this created a new problem, currently the second parameter (xmlstring.jpdl.xml) is hard-code. I can't find a way to query this resource name. Can you help me out?


            Thanks

            • 3. Re: Process definition xml
              kukeltje

              Unfortunately (afaik) you cannot do a 'ls/dir' on it. But what you *could* do is store an additional file in there where you do some kind of mapping? (me: just having wild thoughts)

              • 4. Re: Process definition xml
                jbarrez

                @Gert: this is an interesting suggestion, the mapping could be provided by the framework itself. Can you file an issue in Jira exactly describing what would be the easiest solution for you, so we can discuss/plan it?