[jboss-user] [jBPM] - Visualize workflow and it's current state

Eugene Dzhurinsky do-not-reply at jboss.com
Thu Aug 19 10:34:20 EDT 2010

Eugene Dzhurinsky [http://community.jboss.org/people/jdevelop] replied to the discussion

"Visualize workflow and it's current state"

To view the discussion, visit: http://community.jboss.org/message/558152#558152

Well, in the meantime I tried to implement generation of an image after workflow is deployed.

I tried to get image with the following code:

        NewDeployment deployment = repositoryService.createDeployment();
        String name = workflow.getName().replaceAll(" ", "_");
        String key = deployment.addResourceFromString(
                name + "_" + workflow.getVersion() + ".jpdl.xml",
        ProcessDefinitionQuery pdq = repositoryService
        List<ProcessDefinition> processDefinitions = pdq.processDefinitionKey(
        for (ProcessDefinition pd : processDefinitions) {
            String imageName = pd.getImageResourceName();
            File f = new File("/home/bofh/" + imageName);
            try {
                FileOutputStream fos = new FileOutputStream(f);
                System.out.println("Created file " + f.getAbsolutePath());
                InputStream imageInputStream = repositoryService
                        .getResourceAsStream(pd.getDeploymentId(), imageName);
                byte[] buffer = new byte[10240];
                int read = 0;
                while ((read = imageInputStream.read(buffer)) > 0) {
                    fos.write(buffer, 0, read);
            } catch (Exception e) {

However the name of image at line

String imageName = pd.getImageResourceName();

is always null, which causes NPE on getting the actual image stream

Am I missing something?

Thank you in advance!


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100819/3e08b6f0/attachment.html 

More information about the jboss-user mailing list