3 Replies Latest reply on Jun 20, 2008 11:02 AM by Slawomir Wojtasiak

    Latest process definition and @ResumeProcess

    Slawomir Wojtasiak Newbie

      First of all I would like to point out that I'm using Seam 2.0.1


      Is there any concrete reason that @ResumeProcess annotation with processKey set takes into account only process instances associated with the latest process definition deployed? In such case there is no posibility to resume any process instance that is in relation with inactive definition. If there is processId used instead of processKey all works well and all available instances are taken into consideration. jBPM documentation tells that key field of processInstance is an unique business key so I'm wondering why there is such limitiation here?


      Thanks in advance

        • 1. Re: Latest process definition and @ResumeProcess
          Ronald van Kuijk Apprentice

          I'm wondering why there is such limitiation here?

          No specific reason I think. Might just be that the implementation of @ResumeProcess also uses the latest version id in the query... in fact I just looked at the seam code (very easy for you to do as well)


          From org.jboss.seam.bpm.BusinessProcess.java:


          285        /**
          286          * Associate the process instance with the given business key 
          287          * with the current conversation.
          288          * 
          289          * @param processDefinition the jBPM process definition name
          290          * @param key the jBPM process instance key
          291          * @return true if the process was found and was not ended
          292          */
          293         public boolean resumeProcess(String processDefinition, String key)
          294         {
          295            ProcessDefinition definition = ManagedJbpmContext.instance().getGraphSession().findLatestProcessDefinition(processDefinition);
          296            ProcessInstance process = definition==null ? 
          297                     null : ManagedJbpmContext.instance().getProcessInstanceForUpdate(definition, key);
          298            if (process!=null) setProcessId( process.getId() );
          299            return afterResumeProcess(key, process);
          300         }
          



          you can clearly see the latests version is retrieved. File a jira issue and propose to change this. The current behaviour is indeed not logical

          • 2. Re: Latest process definition and @ResumeProcess
            Ronald van Kuijk Apprentice

            The JbpmContext class that is used, only contains methods using a ProcessDefinition and a key. There also is no query defined in jBPM to retrieve process instances with just a businesskey. So besides that I filed a jira issue in Seam, I also filed one in
            jBPM and related the two.



            • 3. Re: Latest process definition and @ResumeProcess
              Slawomir Wojtasiak Newbie

              Hello, thanks for the answer.
              Looking at the source code was the first thing I had done before I posted it :), but I wasn't sure that there is no concrete reason to do it this way. I also think it should be changed and I'm glad that you have reported it.


              Regards,
              Slawomir Wojtasiak