4 Replies Latest reply: Nov 27, 2012 2:58 PM by 971290 RSS

    how to access payload  object in bean method

    971290
      I'm trying to access payload object in bean method like following but it gives the null or "" value.

      ELContext elctx = fctx.getELContext();
      ExpressionFactory expFactory = fctx.getApplication().getExpressionFactory();
      ValueExpression ve = expFactory.createValueExpression(elctx, "${payLoad.group}", String.class);//here group is attribute of payLoad object

      this.myGroup=(String)ve.getValue(elctx);



      Thanks
        • 1. Re: how to access payload  object in bean method
          Cvele_new_account
          http://one-size-doesnt-fit-all.blogspot.com/2010/08/jdev-contextual-events-payload-payload.html
          http://one-size-doesnt-fit-all.blogspot.com/2010/08/jdev-11g-programmatic-contextual-events.html
          • 2. Re: how to access payload  object in bean method
            Frank Nimphius-Oracle
            Hi,

            the payLoad object cannot be accessed this way as it is not a memory object. Its been passed with the event and available to the event map.

            Frank
            • 3. Re: how to access payload  object in bean method
              971290
              Hi Frank Thanks for reply though we were able to access payLoad object from with in bean method..Please check below code and let me know if that is not right way to access it..I would appriciate your reviw on it...

              //this get method as property called from handl condition of contextual event .if that returns true then only it propogates the event
              public boolean getShouldHandleEvent(){
              //boolean isHandle=false;
              //following line access payLoad object
              payLoadObject po=(payLoadObject)BindingContext.getCurrent().get(EventDispatcherImpl.PAYLOAD); //payLoadObject we pass as PayLoad from producer side


              String payloadFilter=po.getGroup().toString();
              String group=AdfFacesContext.getCurrentInstance().getPageFlowScope().get("group").toString();

              isHandle=payloadFilter.equalsIgnoreCase(group);

              return isHandle;


              }
              //page def of the consumer event

              <eventMap xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
              <event name="cityNameChange">
              <producer region="*">
              <consumer region="" handler="handleEventPayloadObject"
              handleCondition="#{pageFlowScope.refreshWithEventPayload.*shouldHandleEvent*}">
              <parameters>
              <parameter name="customPayLoad" value="#{payLoad.city}"/>
              <parameter name="filter" value="#{payLoad.group}"/>
              </parameters>
              </consumer>
              </producer>
              </event>
              </eventMap>

              Edited by: user732467 on Nov 15, 2012 7:21 AM
              • 4. Re: how to access payload  object in bean method
                971290
                Hi Frank,
                Sorry bother you again but its important for me to know if the way we access payload( in last response i have shown code) in to the bean is acceptable or not. I mean is there any drawbacks doing this ? I would appriciate if you can reply me your view on it.....Thanks