[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",
                workflowSerializer.serialize(workflow)).deploy();
        ProcessDefinitionQuery pdq = repositoryService
                .createProcessDefinitionQuery();
        List<ProcessDefinition> processDefinitions = pdq.processDefinitionKey(
                key).list();
        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);
                }
                fos.flush();
                fos.close();
                imageInputStream.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

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
[http://community.jboss.org/message/558152#558152]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- 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