Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: XML Attribute Mapping?

  1. #1

    Default XML Attribute Mapping?

    I was wondering if there was talk of using xml for sub-flow attribute mapping rather then full-blown classes? Maybe something like:

    Code:
    <webflow id="mySubflow" start-state="setupForm">
     <in-param name="city"/>
     <in-param name="state"/>
     ...
    </webflow>
    
    <webflow id="myRootFlow" start-state="setupForm">
     ...
     <subflow-state id="mySubflow" flow="mySubflow">
      <param-mapping parent="homeCity" child="city"/>
      <param-mapping parent="homeState" child="state"/>
     </subflow-state>
     ...
    </webflow>

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Yes, great idea. Could you open a JIRA issue so it doesn't get lost?
    Keith Donald
    Core Spring Development Team

  3. #3

    Default

    Done and done.

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    I'm thinking something like this:

    Code:
    	<subflow-state id="enterPassengerInformation" flow="passenger">
    		<attribute-mapper>
    			<input-mapping attribute="$&#123;requestScope.passenger.id&#125;"/>
    			<output-mapping attribute="some_flow_attribute"/>
    		</attribute-mapper>
    	</subflow-state>
    Keith Donald
    Core Spring Development Team

  5. #5

    Default

    Are you talking about that subflow-state syntax in addition to specifying parameters in the subflow itself? Because you need to specify the local key, as well as the foreign key to map it to for each input and output parameter. I actually forgot the output of the flow and subflow-state in my example. How about this:

    Code:
    <webflow id="mySubflow" start-state="setupForm">
     <!-- Don't really need anything here. -->
     ...
    </webflow>
    
    <webflow id="myRootFlow" start-state="setupForm">
     ...
     <subflow-state id="mySubflow" flow="mySubflow">
      <attribute-mapper>
       <in-mapping parent="$&#123;requestScope.person.city&#125;" child="city"/>
       <in-mapping parent="$&#123;requestScope.person.state&#125;" child="state"/>
       <out-mapping child="firstName" parent="$&#123;requestScope.person.firstName&#125;"/>
       <out-mapping child="lastName" parent="$&#123;requestScope.person.lastName&#125;"/>
      </attribute-mapper>
     </subflow-state>
     ...
    </webflow>
    Looks like you could do something like ParameterizableAttributeMapper.

  6. #6
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Oops, yea I see what you mean.

    Here ya go:
    Code:
    <subflow-state id="enterPassengerInformation" flow="passenger"> 
          <attribute-mapper> 
             <input name="passengerId" value="$&#123;requestScope.passenger.id&#125;"/> 
             <input name="someInputAttributeName"/>
             <input name="someOtherInputAttributeName" as="someAdaptedInputAttributeName"/>
             <input value="$&#123;requestScope.someAttribute&#125;" as="someAdaptedInputAttributeName"/>
             <output name="someOutputAttributeName"/> 
             <output name="someOutputAttributeName" as="someAdaptedOutputAttributeName"/>
          </attribute-mapper> 
    </subflow-state>
    Those are all the useful combos I can think of. Others?

    Yes, the xml would just be a convenient way to configure a ParameterizableAttributeMapper.

    It doesn't make since to map output mappings from request scope, though :-) Only flowScope makes sense for output mappings. This is because the request scope is shared on a "per request" basis, regardless of what flow session is active...

    Now, you could map a input request attribute down into flowScope of a subflow, as shown below. This is arguably better than relying on shared requestScope attributes.
    Keith Donald
    Core Spring Development Team

  7. #7

    Default

    I like that syntax a lot. Does <input name="" value="" as=""/> make sense? If you have a value, why do you need a name?

    I didn't know that requests could overlap flows. Very good to know.

  8. #8
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Damn man you're quick ;-), no name does not make sense there--only value/as --- thanks :-)
    Keith Donald
    Core Spring Development Team

  9. #9

    Default

    I noticed that you've done some work with this. Is it complete, because I'm having some trouble getting it to work.

  10. #10
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    It's still a WIP for PR3 -- at least value expressions are.

    What is the problem you're seeing? Basic attribute mapping using static attribute names should work.
    Keith Donald
    Core Spring Development Team

Similar Threads

  1. Replies: 4
    Last Post: Oct 5th, 2005, 11:04 AM
  2. Replies: 1
    Last Post: Jul 28th, 2005, 05:08 PM
  3. stale Oracle processes
    By compostellas in forum Data
    Replies: 7
    Last Post: Jun 27th, 2005, 12:14 PM
  4. Replies: 13
    Last Post: Dec 7th, 2004, 10:00 AM
  5. Replies: 2
    Last Post: Sep 5th, 2004, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •