3 Replies Latest reply on Oct 7, 2007 4:35 AM by nebukadnezzar

    Business process injection doesn't work in a Seam component

    chawax

      Hi,

      I have a problem using JBpm with Seam.
      I modeled a process with nodes and binded actions to these nodes. But the injection of business process variables or processInstance in Seam component does not work when running these actions. I don't have the problem if the token did not go through a task-node before (ie a business process with no human action). I guess it deals with a context problem, but I can't understand what the problem exactly is.

      For example, I modeled my node this way :

      <node name="Acceptation">
       <transition to="End" />
       <action expression="#{demandeAbsenceAction.demandeAcceptee}" />
      </node>


      I have a first Seam component (conversation scope) which creates the process instance this way :

      @org.jboss.seam.annotations.bpm.CreateProcess(definition = "validationDemandeAbsence")
      @org.jboss.seam.annotations.End
      public void valider()
      {}


      It also outjects idDemandeAbsence variable in the business process :

      @org.jboss.seam.annotations.Out(required = false, scope = org.jboss.seam.ScopeType.BUSINESS_PROCESS)
      protected java.lang.Long idDemandeAbsence;


      I had a look in the JBPM tables and this outjection works well.

      I have another Seam component (conversation scope too) which contains methods binded to JPDL nodes. It injects processInstance and idDemandeAbsence variables this way :

      @org.jboss.seam.annotations.In(create = true)
      protected org.jbpm.graph.exe.ProcessInstance processInstance;
      
      @org.jboss.seam.annotations.In(value = "idDemandeAbsence", scope = org.jboss.seam.ScopeType.BUSINESS_PROCESS)
      protected java.lang.Long idDemandeAbsence;


      And of course it declares the action method binded to JPDL node (no annotation on this method, should there be some ?) :

      public void demandeAcceptee()
      {}


      But idDemandeAbsence and processInstance variables are alway null. Do I use JBpm and Seam the right way ? I work on this problem for several days, so any help will be greatly appreciated ;)

        • 1. Re: Business process injection doesn't work in a Seam compon
          chawax

          Forgot to tell that I use Seam 2.0.0 BETA 1 and JBPM 3.2.2

          • 2. Re: Business process injection doesn't work in a Seam compon
            chawax

            I solved my problem ! In fact my Seam component with action methods was both a "JBPM listener" and "JSF listener". It had methods with @StartTask end @EndTask annotations, that were called from a JSF page. I finally thought that it was not a good architecture choice, so I splitted my Seam component in a JSF listener component (with @StartTask and @EndTask annotated methods) and a JBPM listener component. And the injection of business process instance and variables into this JBPM listener worked !

            So what I see is that you can't have @StartTask and @EndTask methods in a JBPM listener. Is it something expected or is it a bug ? And if this is not a bug, could anyone explain to me the reason of all this ?

            Thanks in advance

            • 3. Re: Business process injection doesn't work in a Seam compon
              nebukadnezzar

              I think i've got the same problem.
              Everything works fine except the injection from the business-process-scope
              the variable is in the jbpm tables...

              has anyone a hint on this?

              do I have to resume the process additionally to starting the task?

              because when a method of my SFSB is called from the jpdl the injection works fine.

              but not from my.xhtml

              using Seam 1.2.1GA