3 Replies Latest reply on Jan 15, 2007 8:22 AM by aakil786

    Find a process via variable associated with it - unique syst

    aakil786

      Jbpm 3.1.2

      I went through the source code and the queries in the xml file and cannot find anyway to find a process if one has a variable value that is associated with the process. The closest I could find is the comments in ContextSession which looks like it still needs to be coded.

      Is there a way to do it in jbpm without customizing it? One way that one can get around it is to store the link between the process and in my case the loan application in the loan application. This however is instinctively the wrong way to do it and in previous workflow applications that I used the link was stored in the workflow/bpm engine.

      What is the recommended way to do it or if I missed the existing functionality please point me in the right direction.

      Thanks
      Aakil

        • 1. Re: Find a process via variable associated with it - unique

          I am trying to figure out the best way to do this as well. Please share any ideas you come up with. The way I have come up with for now is to define a link from my object to the variableInstance object in Hibernate. (Assuming you are saving your objects as HiberateLongVariable type objects.)

           <class name="MyObject" table="MY_TABLE">
          
           <set name="variableInstances">
           <key column="LONGVALUE_" />
           <one-to-many class="org.jbpm.context.exe.variableinstance.HibernateLongInstance" />
           </set>
           </class>
          
          


          Then you can call myObject.getVariableInstances to return a Set. On each variable in that list you can then call hibernateLongInstance.getProcessInstance();

          The ProcessInstance works fine... except...

          I am having a separate problem where when I access the ProcessInstance this way, and I then call

          processInstance.getContextInstance().createVariable("anotherVariable", anotherVariable)
          


          the variables dont get set in the DB at all. Hmmmmmm. Any thoughts?

          Again, I dont think this is the "best" way to access the variables from the object, so please share back any other thoughts.

          dan

          • 2. Re: Find a process via variable associated with it - unique
            aakil786

            I see this topic was previously discussed not sure why I did not find it before ;-) anyway here is the link

            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84817

            • 3. Re: Find a process via variable associated with it - unique
              aakil786

              I used the code in searchInstances() in MonitoringBean provided with the 3.1.2 webapp and bastardized it for my requirements. I also added an index for the name_ and longvalue_ column, which is what I am using in my where clause.

              My reason for not takng a similar approach to dslevine is that I need JBPM to be as losely coupled from the client application as possible. All access to jBPM is via a Stateless Session Bean without the frontend application knowing to much about the internal workings of the JBPM.