7 Replies Latest reply on Jun 6, 2007 12:39 PM by clandestino_bgd

    Deploy new version of a Process defintion loaded and updated

    matthieugd

      Hello,

      When you deploy a processdefinition (xml,par file) with a name that already exists in DB, a new procedefinition is created (and the nodes etc ...) in the DB with a new version number.

      If I load a processdefinition with the API, change the node and deploy with the method on GraphSession Class, a new definition is inserted with a new version number but the nodes are updated and not created. The definition with the verison number - 1 doesn't have anymore nodes.

      How can I have the same behavior trough the API : deploy a new version of a process definition that I have previously loaded ?

      Matthieu

        • 1. Re: Deploy new version of a Process defintion loaded and upd
          kukeltje

          by passing on a version number? Otherwise look at how the webapp/servlet does it.

          • 2. Re: Deploy new version of a Process defintion loaded and upd
            matthieugd

             

            "kukeltje" wrote:
            by passing on a version number? Otherwise look at how the webapp/servlet does it.


            Passing a version number ? The deploy method of GraphSession already increments the version number.

            You can't change a process definition in the webapp, can't you ? You deploy a process defintion in a par file. What I want : modify a process definition and deploy it as a new version of the existing one trough the API.

            Matthieu

            • 3. Re: Deploy new version of a Process defintion loaded and upd
              kukeltje

              the API (JbpmContext) has a method deployProcessDefinition. If you dig into this (the code IS open you know, you will see a getGraphSession().deployProcessDefinition(processDefinition);

              and if you go into that, you will see

              public void deployProcessDefinition(ProcessDefinition processDefinition) {
               String processDefinitionName = processDefinition.getName();
               // if the process definition has a name (process versioning only applies to named process definitions)
               if (processDefinitionName!=null) {
               // find the current latest process definition
               ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processDefinitionName);
               // if there is a current latest process definition
               if (previousLatestVersion!=null) {
               // take the next version number
               processDefinition.setVersion( previousLatestVersion.getVersion()+1 );
               } else {
               // start from 1
               processDefinition.setVersion(1);
               }
              
               session.save(processDefinition);
              
               } else {
               throw new JbpmException("process definition does not have a name");
               }
               }


              So deploying a pd via the api increments the version.

              Ahhh wait.... that is not what you meant right.......

              you want to make a copy of the pd, change that and deploy it. Remember, this is hibernate etc... just changing the pd and nodes below, changes all nodes currently loaded and will update them..... you have to make a full copy not change the existing loaded pd and deploy it again.....

              • 4. Re: Deploy new version of a Process defintion loaded and upd
                matthieugd

                 

                "kukeltje" wrote:
                the API (JbpmContext) has a method deployProcessDefinition. If you dig into this (the code IS open you know, you will see a getGraphSession().deployProcessDefinition(processDefinition);


                yes :) If you read my previous message you'll see that I've read the code when I say "The deploy method of GraphSession already increments the version number."

                "kukeltje" wrote:

                you want to make a copy of the pd, change that and deploy it. Remember, this is hibernate etc... just changing the pd and nodes below, changes all nodes currently loaded and will update them..... you have to make a full copy not change the existing loaded pd and deploy it again.....


                okay I fear that it would be the problem.

                • 5. Re: Deploy new version of a Process defintion loaded and upd
                  kukeltje

                  I (mis)read your previous message... shame on me (don't know the 'shame' smiley)

                  Maybe the hibernate docs/wiki/forum can answer this for you. I am curious btw to the outcome

                  • 6. Re: Deploy new version of a Process defintion loaded and upd
                    matthieugd

                    No problem :)

                    I will look deeper soon but maybe I should go trough the graph of object from the ProcessDefinition and set the ID to 0 since Hibernate check the ID attribute to save or update.

                    Matthieu

                    • 7. Re: Deploy new version of a Process defintion loaded and upd
                      clandestino_bgd

                      Hi, we have a very same problem.
                      There is a requirement to edit process definition on fly (workflow composition by common user, not developer). So, we have template process definition, which can be customized through some interface. The result should be modified copy of template process definition.
                      The mentioned issue with Hibernate we have already faced.

                      Any hint, about the best way for that.
                      Thanx
                      Milan