Get subfile of deployment

Hi there,

in the new modeler (4.11.1) i have seen that you can upload your bpmn with additional files:

And now i try to get the content of the subfile of my deployment:

What i currently have is:

// get the name of current process definition
String processName = execution.getProcessEngineServices()

// get the last deployment with the name of the process definition
List<Deployment> lastdeployment = execution.getProcessEngineServices()

Anyone who knows how to get the content of the subfile?

Did you solve this problem?

No, not yet!

Still hope someone could help me :grin:

Hi @Jako and @richard_flip,

a deployment contains resources. Here you can access the file content.

String deploymentId = repositoryService().createDeploymentQuery().singleResult().getId();
List<Resource> deploymentResources = repositoryService().getDeploymentResources(deploymentId);

It’s very generic approach, you have to handle the content as bytes in your application.

Hope this helps, Ingo

1 Like

Thx @Ingo_Richtsmeier, i’ll try that and give feedback…

Thanks a lot @Ingo_Richtsmeier for your hint, here my solution:

        // get the name of current process
        String processName = execution.getProcessEngineServices()

        // search for the last deployment
        List<Deployment> lastDeployment = execution.getProcessEngineServices()

        // get the Id
        String lastDeploymentId = lastDeployment.get(0).getId();

        // get all resources of the deployment
        List<Resource> deploymentResources = execution.getProcessEngineServices()

        // convert the test_config.json resource into a SpinJsonNode object
        for (Resource file: deploymentResources) {
                byte[] configFile = file.getBytes();
                String decodedJsonString = new String(configFile, "UTF-8");
                SpinJsonNode resultJson = JSON(decodedJsonString);

It is important to select a software development service that understands the data input and output of their projects In addition, a software development service should be able to meet the needs of its clients. A well-developed product will meet the needs of its customers. A good software development service will understand the data input and output of the project and fit them within the company’s objectives. Moreover, a custom-built application will solve a problem and be compatible with other tasks in the company.