2 Replies Latest reply on Apr 10, 2007 7:56 PM by smithbstl

    jBPM can't evaluate method

      I am taking my first stab at using jPdl page flows and can't get jBPM to recognize a component method.

      I have a SFSB that contains two DataModels. The first DataModel fills a clickable data table (AddressLookup.xhtml) which has a link to another page (AddressRequestListing.xhtml) with a second table filled by the second DataModel in the SFSB.

      I keep getting this error

      org.jbpm.JbpmException: couldn't evaluate expression '#{requestEntry.findRequests}'


      Here is my page flow - pageflow.jpdl.xml

      <pageflow-definition name="serviceRequestCreation">
       <start-page name="addressLookup" view-id="/AddressLookup.xhtml">
       <redirect/>
       <transition name="viewRequests" to="addressRequestListing">
       <action expression="#{requestEntry.findRequests}"/>
       </transition>
       </start-page>
       <page name="addressRequestListing" view-id="/AddressRequestListing.xhtml"/>
      </pageflow-definition>


      Here is pages.xml

      <pages>
       <page view-id="/AddressLookup.xhtml">
       <begin-conversation join="true" pageflow="serviceRequestCreation"/>
       </page>
      </pages>


      Here is my SFSB

      @Stateful
      @Name("requestEntry")
      public class RequestEntryAction implements com.stlouiscity.csb.ejb.action.RequestEntry {
      
       @PersistenceContext(unitName="CSB_Oracle", type=EXTENDED)
       private EntityManager em;
      
       @In(create=true)
       private Address address;
      
       @In(create=true, required=false)
       private AddressLookup addressLookup;
      
       @DataModel("addresses")
       private List<ParcelAddress> addresses;
      
       @DataModelSelection(value="addresses")
       @Out(required=false)
       private ParcelAddress selectedAddress;
      
       @DataModel("requests")
       private List<ServiceRequest> requests;
      
       @DataModelSelection(value="requests")
       private ServiceRequest selectedRequest;
      
       public RequestEntryAction() {
       }
      
       public void findAddresses() {
      
       if (address.getStreetName() != null) {
       System.out.println("Address Is NOT NULL");
       //Find ParcelAddress
       Query q = em.createQuery("Select a From ParcelAddress a Where" +
       " (a.structureAddress.nlc.streetDirection = :streetDirection OR :streetDirection IS NULL) AND" +
       " (lower(a.structureAddress.nlc.streetName) LIKE :street) AND" +
       " (((a.structureAddress.structureAddressPK.houseNumber = :houseNumber) OR" +
       " (:houseNumber BETWEEN a.structureAddress.houseLow AND a.structureAddress.houseHigh)) OR (:houseNumber IS NULL))");
       q.setParameter("houseNumber",address.getHouseNumber());
       q.setParameter("streetDirection",address.getStreetDirection());
       q.setParameter("street",address.getStreetName().toLowerCase() + "%");
      
       addresses = q.getResultList();
       } else {
       System.out.println("Address IS NULL");
       }
       }
      
       public void findRequests() {
       System.out.println("**********Entered findRequests*************");
       System.out.println("**********Selected Address: " + selectedAddress.toString());
       Query q = em.createQuery("Select s From ServiceRequest Where" +
       " s.parcelAddress = :parcelAddress");
       q.setParameter("parcelAddress",selectedAddress);
       requests = q.getResultList();
       }


        • 1. Re: jBPM can't evaluate method

          I have reworked this a bit but am still having problems getting any methods called from jPdl. As far as I can tell, I am closely following the DVD Seam example

          Here is my pageflow.jdpl.xml

          <pageflow-definition
           xmlns="http://jboss.com/products/seam/pageflow"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation= "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-1.2.xsd"
           name="serviceRequestCreation">
          
           <start-state name="start">
           <transition to="requestSearch"/>
           </start-state>
           <page name="requestSearch" view-id="/AddressLookup.xhtml">
           <redirect/>
           <transition name="viewRequests" to="requestListing">
           <action expression="#{requestEntry.viewRequests}"/>
           </transition>
           </page>
           <page name="requestListing" view-id="/AddressRequestListing.xhtml">
           <redirect/>
           <end-conversation/>
           </page>
          </pageflow-definition>


          SFSB
          @Stateful
          @Name("requestEntry")
          public class RequestEntryAction implements com.stlouiscity.csb.ejb.action.RequestEntry {
          
           @PersistenceContext(unitName="CSB_Oracle", type=EXTENDED)
           private EntityManager em;
          
           @In(create=true)
           private Address address;
          
           @In(create=true, required=false)
           private AddressLookup addressLookup;
          
           @DataModel("addresses")
           private List<ParcelAddress> addresses;
          
           @DataModelSelection(value="addresses")
           @Out(required=false)
           private ParcelAddress selectedAddress;
          
           @DataModel("requests")
           private List<ServiceRequest> requests;
          
           @DataModelSelection(value="requests")
           private ServiceRequest selectedRequest;
          
           /**
           * Creates a new instance of RequestEntryAction
           */
           public RequestEntryAction() {
           }
          
           @Begin(join=true)
           public void findAddresses() {
          
           if (address.getStreetName() != null) {
           System.out.println("Address Is NOT NULL");
           //Find ParcelAddress
           Query q = em.createQuery("Select a From ParcelAddress a Where" +
           " (a.structureAddress.nlc.streetDirection = :streetDirection OR :streetDirection IS NULL) AND" +
           " (lower(a.structureAddress.nlc.streetName) LIKE :street) AND" +
           " (((a.structureAddress.structureAddressPK.houseNumber = :houseNumber) OR" +
           " (:houseNumber BETWEEN a.structureAddress.houseLow AND a.structureAddress.houseHigh)) OR (:houseNumber IS NULL))");
           q.setParameter("houseNumber",address.getHouseNumber());
           q.setParameter("streetDirection",address.getStreetDirection());
           q.setParameter("street",address.getStreetName().toLowerCase() + "%");
          
           addresses = q.getResultList();
           } else {
           System.out.println("Address IS NULL");
           }
           }
          
           @Begin(nested=true, pageflow="serviceRequestCreation")
           public void viewRequests() {
           System.out.println("**********Started PageFlow*************");
           }
          
           @End
           public void findRequests(ParcelAddress address) {
           System.out.println("**********Entered findRequests*************");
           System.out.println("**********Selected Address: " + address.toString());
           Query q = em.createQuery("Select s From ServiceRequest s Where" +
           " s.parcelAddress.parcelAddressPK.houseNumber = :houseNumber AND" +
           " s.parcelAddress.parcelAddressPK.houseSuffix = :houseSuffix AND" +
           " s.parcelAddress.parcelAddressPK.nlc = :nlc AND" +
           " s.parcelAddress.parcelAddressPK.cityBlock = :cityBlock AND" +
           " s.parcelAddress.parcelAddressPK.parcelNumber = :parcelNumber)");
           q.setParameter("houseNumber", address.getParcelAddressPK().getHouseNumber());
           q.setParameter("houseSuffix", address.getParcelAddressPK().getHouseSuffix());
           q.setParameter("nlc", address.getParcelAddressPK().getNlc());
           q.setParameter("cityBlock", address.getParcelAddressPK().getCityBlock());
           q.setParameter("parcelNumber", address.getParcelAddressPK().getParcelNumber());
           requests = q.getResultList();
           }
          
           @Remove @Destroy
           public void destroy() {
          
           }



          Here is the link I am using to call the Transition. It is in the context of an h:dataTable column.

          <h:column>
           <f:facet name="header">
           <h:outputText value="#{msgs['ServiceRequestList.action']}"/>
           </f:facet>
           <h:commandLink id="viewRequestsLink"
           action="viewRequests"
           rendered="#{not empty addressRow.requestCollection}"
           value="#{msgs['AddressList.viewRequest']}">
           </h:commandLink>
           </h:column>


          When I click the link, the page just reloads, the transition is never activated. Its driving me nuts.

          Thanks for any help

          • 2. Re: jBPM can't evaluate method

            I got it working. I was never actually beginning the pageflow. I am now calling the viewRequests method of the bean directly via the action on the page. This begins the pageflow. Before I was trying to call a transition of the pageflow before it had ever been started.