8 Replies Latest reply on Jul 26, 2006 4:38 PM by Ronald van Kuijk

    Handling process definitions

    Alex Oguz Newbie

      Hi,

      I am writing an admin application, where the user is able to deploy new process definitions (from file system) and gets a view of the currently deployed process definitions. For the deployed definitions I would like to show the process image + definition / xml. The picture is inside the database, no prob, but I can't find the process definition. Is this information lost the minute a definition is deployed to the database or is there a way to retrieve it?

      Thanks, the_dude

        • 1. Re: Handling process definitions
          New Bie Newbie

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

          Thanks.

          • 2. Re: Handling process definitions
            New Bie Newbie

            If you are not sure that the definition is persisted to the database, try loading it using graph session:

            ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);


            • 3. Re: Handling process definitions
              Alex Oguz Newbie

              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.

              • 4. Re: Handling process definitions
                Ronald van Kuijk Master

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

                • 5. Re: Handling process definitions
                  Alex Oguz Newbie

                   

                  "kukeltje" wrote:
                  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.

                  "kukeltje" wrote:

                  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
                  <your-JbpmContext-object-here>.getGraphSession().loadProcessDefinition(id).getFileDefinition().getBytes("processimage.jpg");
                  


                  • 6. Re: Handling process definitions
                    Ronald van Kuijk Master

                    if you replace processimage.jpg with the name of the processdefinition you should be fine (I never tried it though)

                    • 7. Re: Handling process definitions
                      Alex Oguz Newbie

                      I have tried that already :-)

                      • 8. Re: Handling process definitions
                        Ronald van Kuijk Master

                        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