I feel a bit lost in the source code of the console but I had already managed to find the section for showing the diagram and there was a method call similiar to:
info = getActiveTaskNodeInfo(); x = info.getX(); y = info.getY();
So the co-ordinates of the task nodes placed in the GPD seem to be deployed with the actual process definition, right?
I can't find it anymore and it did not get clear to me where the information about the active task node was taken from.
it is read from the processdefinition xml file itself.
Which task is active is based on the name.
But the information is exposed nowhere via an API? Can I get a copy of the process definition xml via the API?
thank you for your answer. Could you point me to the file where the reading of the co-ordinates to show the current process diagram is done?
Okay, I overlooked getActivityCoordinates() in RepositoryService. But how to retrieve the process image from the engine?
getResourceAsStream (like you normally would loading an image from a classpath ;-)) om the RepositoryService.
You just have to know the name of the image as it was deployed in the process archive.
And I have to know the deploymentId. Is there a way to determine to which deployment a process belongs?
I mean: a process definition belongs
Have a look at the sourcecode of the console or the jbpm testcase on how this is done (have no time to do that myself)
things like 'grep -R getResourceAsStream |grep -v target |grep -v svn' work amazingly well if you do not have an ide at hand)
I also found processDefinition.getImageResourceName() which can be used in the previously mentioned call
Thanks for the hint Ronald, I managed to succeed without looking how the console deals with it. They only thing missing was getting the image from the deployment in a comfortable and general way. So your hint helps a lot. I am now doing the image manipulation myself.
1. I get the process image as a stream.
2. I use ImageIO to instantiate a BufferedImage.
3. I call getGraphics() on the BufferedImage to get an Graphics Context
4. I use getActiveActivities() to get hold of the active tasks
5. I determine the positions of the active tasks via the API
6. I paint a red rectangle around each active tasks using drawRect() and the co-ordinates of the tasks
7. I display the image in my application
I just wrote a long post thanking you for the hint, Ronald and explaining how I I succeded without looking deeper into the console code. Then I pushed submit and it disappeared. :(
What the 3 console does (and I in my JSF console) is draw the rectangles in DHTML, so the image stays the same. Nice thing about that is that you can also display other details of a node on e.g. mouse-over etc.
I'm not sure how the GWT console for 4 does this btw, might be like you do it or like I do it.
I noticed this because the console retrieves the image via the REST-interface and there is just the possibility to get the original image. I think both methods have advantages and disadvantages.