4 Replies Latest reply on Feb 4, 2010 5:03 AM by Raji n

    Accessing process variables in task form

    Raji n Newbie

      Hi All,

      In JBPM 3.2.6, I have a main process invoking a subprocess. The subprocess has a task and an associated form.

       

      In the start node of the main process, I am attaching an Action Handler to set an employee object in a process variable. I would like to display the contents of the employee object in the form.

      Can you please guide me on how to do this?

       

      I am passing the variables when invoking the subprocess.

       

      In the form (xhtml), I am accessing the values like this :

       

      <h:outputText value="#{employee.firstName}" />

       

      <h:outputText value="#{employee.address.street}" />

       

      But this doesn't seem to work. Nothing gets displayed on the screen.

       

      P.S Both employee and address objects are serializable.

       

      Appreciate any help on this.

       

      thanks

      Raji

        • 1. Re: Accessing process variables in task form
          john britto Newbie
          I  do not think  it is possible to use process variable to do  this  process
          • 2. Re: Accessing process variables in task form
            Ronald van Kuijk Master

            You provide to little information. Basically it should work.

             

            Do you see any errors in the logging? Do you see anything specific when the log level is turned to debug?

            1 of 1 people found this helpful
            • 3. Re: Accessing process variables in task form
              Raji n Newbie

              Apologies for not providing the code details. Here is the code snippet...

               

              I don't see any errors printed in the console or log files..When i view the source of the task form displayed in the console, the table cell comes up as an empty cell.

               

              Process Defintion - Loan Approval

               

              [CODE]

              <process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="loanapproval">

               

              <start-state name="Start">

              <transition to="Document Verification"></transition>

              </start-state>

               

              <process-state name="Document Verification">

              <sub-process name="document_verification"  binding="late"/>

              <variable access="read,write" name="loanApplication" mapped-name="loanApplication"></variable>

              <transition to="Underwriting"></transition>

              </process-state>

              ...................

              .................

              <end-state name="End"></end-state>

               

              <event type="process-start">

              <action class="sample.test.InitializationActionHandler" name="InitializationActionHandler"></action>

              </event>

               

              </process-definition>

              [/CODE]

               

               

              Process Defintion - Subprocess

              [CODE]

              <process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="document_verification">

              <swimlane name="loan-executive">

              <assignment actor-id="manager"></assignment>

              </swimlane>

               

              <swimlane name="loan-officer">

              <assignment actor-id="user"></assignment>

              </swimlane>

               

              <start-state name="start">

              <transition to="Verify Application"></transition>

              </start-state>

               

              <task-node name="Verify Application Details">

              <task name="Verify Loan Details" duedate="5 business days" swimlane="loan-executive,loan-officer">

              <controller>

              <variable access="read,write" name="loanApplication" mapped-name="loanApplication"></variable>

              <variable access="read,write,required" name="docVerificationRemarks" mapped-name="docVerificationRemarks"></variable>

              </controller>

              </task>

              <transition name="Approved" to="Perform Risk Analysis &amp; Pricing"></transition>

              <transition to="Update Status - Doc Incomplete" name="Documents Incomplete"></transition>

              </task-node>

               

              ..........

              ...........

              .............

              </process-definition>

              [/CODE]

               

              Value Objects

              [CODE]

              public class LoanApplication implements Serializable {

                   private String applicationId;

                   private ArrayList<Borrower> borrowerList;   //borrower and co-borrower info

               

                   // getter and setter methods

              }

               

              public class Borrower implements Serializable {

                   private String firstName;

                   private String lastName;

                   private ArrayList<Employment>;  //history of present and past employment

               

                   //getter and setter methods

                   .........

              }

              [/CODE]

               

              When the main process is started, I am calling "InitializationActionHandler" to set the loanApplication object as a process variable.

              The loanApplication object contains borrower information.

               

              In the task form attached to the "Verify Loan Details" screen, I want to display the application details like borrower name, mortgage value etc.

              I used the following syntax,

              [CODE]

                <h:outputText value="#{var['loanApplication.applicationID']}"/>

              <h:outputText value="#{var['loanApplication. borrowerList[0].firstName']}"/>

              [/CODE]

              but nothing gets printed.  But i can see the data being populated in the process variable through the InitializationHandler.

              So looks like either the variable is not getting passed to the task form or i am using wrong syntax.

              • 4. Re: Accessing process variables in task form
                Raji n Newbie

                I also tried using the syntax #{loanAplication.applicationID}, but that didn't work for me either.

                 

                Here is the task form code (xhtml)

                 

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

                 

                <!-- the DOCTYPE means we are required to use html for a root element -->

                <html xmlns="http://www.w3.org/1999/xhtml"

                      xmlns:ui="http://java.sun.com/jsf/facelets"

                      xmlns:c="http://java.sun.com/jstl/core"

                      xmlns:h="http://java.sun.com/jsf/html"

                      xmlns:f="http://java.sun.com/jsf/core"

                      xmlns:tf="http://jbpm.org/jsf/tf"

                      xmlns:jbpm="http://jbpm.org/jsf">

                 

                  <ui:component>

                 

                  <jbpm:dataform>

                  <f:facet name="header">

                          <h:outputText value="#{taskName}"/>

                     </f:facet>

                 

                   <!-- TASKFORM BUTTONS -->

                  <jbpm:datacell>

                      <f:facet name="header">

                          <h:outputText value="Application ID"/>

                     </f:facet>

                     <h:outputText value="#{loanAplication.applicationID}"/>

                </jbpm:datacell>

                 

                  <jbpm:datacell>

                      <tf:transitionButton transition="Approved" value="Approve"/>

                      <tf:transitionButton transition="Documents Incomplete" value="Documents Incomplete"/>

                </jbpm:datacell>

                 

                </jbpm:dataform>

                 

                </ui:component>

                 

                </html>