How are you deploying the definition? Are you retreiving the process definition from the".par" file?
Here is what you can do:
ZipInputStream zipStream = new ZipInputStream(new FileInputStream(new File(<location of par file>))); ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipStream); jbpmContext.deployProcessDefinition(processDefinition);
The default jbpm web app already has that functionality (look at the "monitoring" menu of web app).
If you are not sure that the definition is persisted to the database, try loading it using graph session:
ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
Thanks for the quick reply.
You are describing the deployment of a process definition. What I was looking for is how to retrieve the xml of an already deployed process definition (from the database). I haven't used the default web app for some time - however I doubt they show you the plain xml there.
Why I want to deliver this functionality: Normally, you are making some minor changes to your process, e.g. changing timer setting or expressions. These changes are not shown in a process image. In order to document the progress of your process definition I thought it might be a good idea to show the xml file to the user, which contains all necessary definition information.
I would advise against using the pd from jBPM as the truth. Using a separated process (cvs with cmdb or whatever). You would want to have the changes to e.g. en expression (which could have a major impact) in there as well. Don't you want them tested in some way or another?
Even if you want to do it runtime, the process is in the db in string format, so you can retrieve the latest that way, adapt it and deploy it again. No need to reverse engineer anything this way. Think of it as jbpm not beeing xml beans or something like that ;-)
Using a separated process (cvs with cmdb or whatever). You would want to have the changes to e.g. en expression (which could have a major impact) in there as well. Don't you want them tested in some way or another?
I do that already. I thought it might be more comfortable for the user to have a quick look (from the web app) at the older process definitions than starting eclipse and look it up there.
Even if you want to do it runtime, the process is in the db in string format, so you can retrieve the latest that way [...]
Could you give a hint where to look / which method to call? I checked the JBPM_BYTEARRAY table, but couldn't find it there.
FYI: I fetch the process image via
if you replace processimage.jpg with the name of the processdefinition you should be fine (I never tried it though)
I have tried that already :-)
hmmm... according to http://jira.jboss.org/jira/browse/JBPM-617 it should work. I tried this with 3.2 head were it should also work, but there is indeed no processdefinition.xml in the db.
I checked the implementation in org/jbpm/jpdl/par/* files and it seems it is only partially implemented. I reopened the above issue.
Vote for te issue if you want to have it fixed