[jboss-dev-forums] [Design of JBoss ESB] - Re: Smooks JavaBinding

tfennelly do-not-reply at jboss.com
Fri Mar 27 09:22:20 EDT 2009


I don't think you can do this directly, but it wouldn't be hard to get it to work with the help of a little Groovy scripting to manually wire the address records into the address Map.  

Also, you can probably abreviate the binding config for mapping the csv-record set data into the Map.

Here's what it would look like (untested)...


  | <jb:bindings beanId="addresses" class="java.util.HashMap" createOnElement="csv-set" />
  | 
  | <jb:bindings beanId="addressRecord" class="java.util.HashMap" createOnElement="csv-record">
  |     <!-- Omit the property + use a wildcard selector => Smooks will use the element name as the Map key -->
  |     <jb:value data="csv-record/*" />
  | </jb:bindings>
  | 
  | <g:groovy executeOnElement="csv-record">
  |     <g:script>
  |         <!--
  |         // Manually wire each addressRecord into the address Map...
  |         Map addresses = BeanRepository.getInstance(executionContext).getBean("addresses");
  |         Map addressRecord = BeanRepository.getInstance(executionContext).getBean("addressRecord");
  | 
  |         addresses.put(addressRecord.ADDR_ID, addressRecord);
  |         -->
  |     </g:script>
  | </g:groovy>
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221550#4221550

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221550



More information about the jboss-dev-forums mailing list