-
1. Re: Showing the process diagram in my own application
sebastian.s Sep 27, 2009 4:49 AM (in response to sebastian.s)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. -
2. Re: Showing the process diagram in my own application
kukeltje Sep 28, 2009 3:18 AM (in response to sebastian.s)it is read from the processdefinition xml file itself.
Which task is active is based on the name. -
3. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 3:30 AM (in response to sebastian.s)But the information is exposed nowhere via an API? Can I get a copy of the process definition xml via the API?
-
4. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 6:15 AM (in response to sebastian.s)Hello Ronald,
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?
Thanks,
Sebastian -
5. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 6:22 AM (in response to sebastian.s)Okay, I overlooked getActivityCoordinates() in RepositoryService. But how to retrieve the process image from the engine?
-
6. Re: Showing the process diagram in my own application
kukeltje Sep 28, 2009 6:38 AM (in response to sebastian.s)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. -
7. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 7:10 AM (in response to sebastian.s)repositoryService.getResourceAsStream(deploymentId, resourceName)
And I have to know the deploymentId. Is there a way to determine to which deployment a process belongs? -
8. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 7:10 AM (in response to sebastian.s)I mean: a process definition belongs
-
9. Re: Showing the process diagram in my own application
kukeltje Sep 28, 2009 3:07 PM (in response to sebastian.s)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 -
10. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 3:27 PM (in response to sebastian.s)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
:) -
11. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 3:29 PM (in response to sebastian.s)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. :(
-
12. Re: Showing the process diagram in my own application
kukeltje Sep 28, 2009 3:31 PM (in response to sebastian.s)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. -
13. Re: Showing the process diagram in my own application
sebastian.s Sep 28, 2009 3:33 PM (in response to sebastian.s)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.