3 Replies Latest reply on Aug 1, 2008 1:49 PM by kukeltje

    ContextInstance of a non-null ProcessInstance is null

    coolex

      Hello!

      I have this method which I call from a jboss rule:

      public void dosth(org.jbpm.graph.exe.ProcessInstance processInstance){
       System.out.println("The Id of the process is: "+ processInstance.getId() );
       System.out.println("The value of the variabel is: "+ processInstance.getContextInstance().getVariable("owner") );
      }
      The result is:
      The Id of the process is: 1
      The value of the variabel is: null

      I am 100% sure that I have set the process variable before with this code:
      org.jboss.seam.bpm.ProcessInstance.instance().getContextInstance().setVariable("owner", "testowner");

      I made some other tests, so I know very well that this variable has been set perfectly.
      The rule is also working without any problems.
      But why I can't get the ContextInstance out of my non-null ProcessInstance?

      bye

        • 1. Re: ContextInstance of a non-null ProcessInstance is null
          coolex

          Maybe the processdefinition will help:

          <process-definition xmlns="" name="Ordering">
          
           <start-state name="start">
           <transition to="FirstNode" name="firstNode"></transition>
           </start-state>
          
           <task-node name="FirstNode">
           <task name="FirstNode">
           <assignment class="org.jboss.seam.drools.DroolsAssignmentHandler">
           <workingMemoryName>policyPricingWorkingMemory</workingMemoryName>
           <assertObjects>
           <element>#{actor}</element>
           <element>#{processInstance}</element>
           <element>#{processManager}</element>
           </assertObjects>
           </assignment>
           </task>
           <transition to="SecondNode" name="secondNode"></transition>
           </task-node>
          ...
          </process-definition>


          • 2. Re: ContextInstance of a non-null ProcessInstance is null
            coolex

            I figured out that the rule (defined in the first Node) is triggered before the process instance was created.
            But this does not happen if I define the rule in the second node. In this case everything works fine.
            Can I define the process that way that the process-instance will be created before the rule (in the first task is triggered).

            • 3. Re: ContextInstance of a non-null ProcessInstance is null
              kukeltje

              This assignmenthandler is developed within Seam. I think you might have more success is their forum.