-
1. Re: Generate Image from ProcessDefinition
koen.aers Feb 15, 2006 5:33 AM (in response to afgomez)In the GPD it is done using the provided features of the Eclipse GEF framework. I am afraid that this is the only way it is currently possible.
Regards,
Koen -
2. Re: Generate Image from ProcessDefinition
anisj1m Mar 5, 2010 6:25 AM (in response to koen.aers)is there a solution (programmatically) with the new version?
creating a png file from the ProcessDefinition
-
3. Re: Generate Image from ProcessDefinition
kukeltje Mar 8, 2010 7:19 AM (in response to anisj1m)no, sorry. -
4. Re: Generate Image from ProcessDefinition
bestage Mar 9, 2010 5:55 PM (in response to anisj1m)Like Ronald answered, there is no ready solution to do that.
But actually you can achieve what you want... Here is the concept:
- for any Process Definition you can get the iImage resource name by calling String
getImageResourceName()...
- now you can use RepositoryService and say
getResourceAsStream(java.lang.String deploymentId, java.lang.String resourceName) that will return you the InputStream of the process image
- now you can use RepositoryService again and say
getActivityCoordinates(java.lang.String processDefinitionId, java.lang.String activityName)
- and now presuming you know the name of the current activity in your given process instance (= execution) you can draw that rectangle on the image... How exactly this can be done, can't say for now, but that shouldn't be impossible.
By the way this is not my original idea, this was mentioned somewhere on this forum. Also maybe have a look at the GWT console, the guys have solved the same problem already.
NB: for this to work your deployment must contain the process image: deployment.addResourceFromClasspath(path/to/your/process/image.png
The original discussion was here: http://community.jboss.org/thread/119104
- for any Process Definition you can get the iImage resource name by calling String
-
5. Re: Generate Image from ProcessDefinition
kukeltje Mar 9, 2010 5:11 PM (in response to bestage)Henry,
Sorry, but you miss his point (I think, but I might be wrong instead)
NB: for this to work your deployment must contain the process image: deployment.addResourceFromClasspath(path/to/your/process/image.png
Because generating this image itself is what he wants to achieve...Cheers,
Ronald
-
6. Re: Generate Image from ProcessDefinition
bestage Mar 9, 2010 5:54 PM (in response to kukeltje)Oh, right... it's too late now I guess
-
7. Re: Generate Image from ProcessDefinition
sreeraaman Mar 10, 2010 2:50 AM (in response to bestage)Hi All,
I am not sure if this is what you are looking at. Assuming that you designed the process using the GPD eclipse plugin, after deployment of the process (.par archive), you can get the image of the process as a byte[] as shown below:
public byte[] getProcessDiagram(Long processDefinitionId) {
byte[] returnValue = null;
JbpmContext context = getJbpmContext();
try{
GraphSession graphSession = context.getGraphSession();
ProcessDefinition processDefinition = graphSession.getProcessDefinition(processDefinitionId);
FileDefinition fileDefinition = processDefinition.getFileDefinition();
returnValue = fileDefinition.getBytes("processimage.jpg");
}
catch(Exception e){
e.printStackTrace();
}
finally{
context.close();
}
return returnValue;
}Form the returning byte[] you can manipulate the image as desired. This is as of JBPM 3.2.3.
-
8. Re: Generate Image from ProcessDefinition
anisj1m Mar 10, 2010 4:02 AM (in response to afgomez)As Ronald saied: "Generating this image itself is what he wants to achieve..."
yes I am creating the process for the first time and then i am going to deply it and i want to create it's image and deploy it with the process.
so my problem is how to create the image for the first time.
-
9. Re: Generate Image from ProcessDefinition
sreeraaman Mar 10, 2010 4:28 AM (in response to anisj1m)Hi All,
When you create a jbpm process with GPD plugin, the image is already created for you as part of the process archive by GPD plugin.
The par file generated will have the following structure:
test.par
|
|____ gpd.xml
|
|____ processdefinition.xml|
|____ processimage.jpg
When you deploy the test.par file, the processimage.jpg gets stored in the jbpm tables that can later be retrieved using the code shown above.
Hope this helps.
-
10. Re: Generate Image from ProcessDefinition
anisj1m Mar 10, 2010 5:02 AM (in response to sreeraaman)as i saied the problem is how to create a jbpm image programatically, without using GPD? -
11. Re: Generate Image from ProcessDefinition
kukeltje Mar 10, 2010 1:46 PM (in response to anisj1m)As I said before, there is no solution, other then implementing something yourself -
12. Re: Generate Image from ProcessDefinition
shar May 22, 2010 12:24 AM (in response to kukeltje)It is very a pity. In my opinion, it there would be a useful function.
By the way, how to create an image for schemes bpmn2 using GPD?
It seems to me, visual editing only for jpdl schemes. -
13. Re: Generate Image from ProcessDefinition
rebody May 23, 2010 10:28 PM (in response to shar)Hi Andrej,
Because most of server cannot support image library, so we can just upload a image file to server. Even if we provide a plugin to generate image from xml, it could be very limited.