Announcement Announcement Module
Collapse
No announcement yet.
help on xml output subflow-state definition (OgnlException) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • help on xml output subflow-state definition (OgnlException)

    Hello,

    When my subflow ends, i need to write an attribute of a bean which is in the parent flow scope.
    Using a bean subclassing a ParametrizableAttribueMapper and referenced in the subflow state, i succeeded. Trying to do the same thing using only xml descriptions of the mapping i get an ognl exception.

    Here the code for the mapper defined as a bean and referenced in the subflow state:
    Code:
    public void mapSubflowOutput(RequestContext rc) {
    		String ref=(String)rc.getSourceEvent().getParameter("refavis");
    		Scope parentScope=rc.getFlowContext().getActiveSession().getParent().getScope();
    		DemandeAdhesionMensualisation demande=(DemandeAdhesionMensualisation)parentScope.getAttribute("demandeadhesionmensualisation");
    		demande.getAvisimposition().setReference(ref);
    		super.mapSubflowOutput(rc);
    	}
    
    	public Map createSubflowInput(RequestContext rc) {
    		
    		DemandeAdhesionMensualisation demande=(DemandeAdhesionMensualisation)rc.getFlowScope().getAttribute("demandeadhesionmensualisation");
    		String identifiant=demande.getAvisimposition().getContribuableparticulier().getIdentifiant();
    		rc.getRequestScope().setAttribute("identifiant",identifiant);
    		return super.createSubflowInput(rc);
    	}
    the "refavis" is received when the user clicks on a link in a subflow view

    <a href="sub.flow?_flowExecutionId=0A&_eventId=select ion&refavis=666">Avis 666</a>



    Here the xml that i tried to do the same thing:

    Code:
    <attribute-mapper>
    			<input name="$&#123;demandeadhesionmensualisation.avisimposition.contribuableparticulier.identifiant&#125;" as="identifiant"/>
    			<output value="$&#123;sourceEvent.parameters.refavis&#125;" as="$&#123;demandeadhesionmensualisation.avisimposition.reference&#125;"/>
    		</attribute-mapper>

    With this definition, i get an OgnlException for the output arguing that sourceEvent is null. (getProperty(null,parameters)) but the sourceEvent in the java code isn't null... bug ?

    Thank you in advance.

  • #2
    Hmm... well, by xml you're defining your mapper in SPRING bean xml, not a subflow state of a webflow xml definition. Such usage from the webflow def will definitely read better....

    Is "reference" a property in the subflow's flow scope? It looks to me like it's an event parameter.

    I'm not sure what you're doing but if you're trying to map a 'reference' attribute in subflow scope to the parent it would look like:

    <entry key="${flowScope.reference} value="demandeadhesionmensualisation.avisimpositio n.reference"/>

    What a long name for a property! I hope you know what it means :-)

    The entry value is the target path to the attribute value returned from the key expression. The key expression evaluates the flow request context if enclosed in an expression ${} placeholder, otherwise it operates on flow scope.

    Comment


    • #3
      Are there any exceptions? Or is it just not mapping properly?

      Erwin

      Comment


      • #4
        the bean defined in spring xml is referenced in an attribute mapper of a sub flow state.
        The "reference" is a property of the subflow scope (posted by a form).
        The syntax you proposed (<entry key="${flowScope.reference} value="demandeadhesionmensualisation.avisimpositio n.reference"/>
        ) was logically and intuitively what i put in first but i get everytime an ognl exception. I tried also ${sourceEvent.parameters.reference} or ${lastEvent.parameters.reference} or ...
        so i tried with a java implementation of the attribute mapper to figure out if i could do the output mapping.

        Your phrase "The key expression evaluates the flow request context if enclosed in an expression ${} placeholder, otherwise it operates on flow scope" should help me a lot, thanks for this comprehension tip, i will retry on monday.

        Felicitations to clever people developping this great framework.Wish it long life.

        Comment


        • #5
          I edited the description of my problem.
          To resume, if i put this xml definition in the attribute mapper subflow definition :
          <output value="${sourceEvent.parameters.refavis}" as="${demandeadhesionmensualisation.avisimposition .reference}"/>

          the sourceEvent is null (ognl exception)

          If i do the same thing with a ParameterizableFlowAttributeMapper, i am able to retrieve the parameter refavis from the requestContext.getSourceEvent()

          Any idea ? Thanks

          Comment

          Working...
          X