-
1. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 5:03 AM (in response to tfennelly)Transformation Actions to handle specific use cases
-
2. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 5:04 AM (in response to tfennelly)Grrrr... posted last comment in the wrong place :)
-
3. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 5:15 AM (in response to tfennelly)As far as processing CSV data is concerned, I think one useful action might be one that allows you to more easily bind the fields in a CSV record set into a Java object. It could allow you to produce a List or Map (keyed on one of the fields) of objects. Should also allow you to simply populate the fields into a Map i.e. don't force the user into implementing a custom Java object.
Might also be useful to allow this action to perform some basic splitting, by allowing you to specify the name of a Service to which each populated Java object could be sent for further processing. -
4. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 5:54 AM (in response to tfennelly)An action that allows you to perform some "rough" binding of data from an XML message into a simple Map structure might be useful.
As an example of what I mean...
XML:<Order> <header> <orderId>1</orderId> <orderDate>Wed Nov 15 13:45:28 EST 20061</orderDate> <statusCode>0</statusCode> </header> <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/> <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/> </Order>
Suppose the service is only interested in the header and product info in this message, the ESB Config for binding that data out of this message and into a Map based model (i.e. untyped and in a Map) might look something like:<action name="bindRequestData" class="org.jboss.esb.actions.XMLToMapBinder"> <property name="bindings"> <bean beanId="header" element="order/header" /> <bean beanId="product" element="order/Product" /> </property> </action>
This would allow the action following this action to access this info and use it in something like an MVEL or Groovy script e.g.:def orderData = message.getBody().get(); def price = orderData.product.price; if (price > 30.00) { def orderStatus = orderData.header.statusCode; def productId = orderData.product.productId; // Run some sort of check using the captured data... }
Of course you could also just tell it to bind the complete message into a Map structure, but that has obvious performance issues. Also, the likes of Groovy can do this for you anyway. -
5. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 5:56 AM (in response to tfennelly)A simple action for converting CSV to XML, aloowing you to specify the CSV fields, field separators, root element name, record element name etc.
-
6. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 7:28 AM (in response to tfennelly)A simple action for converting EDI to XML, allowing you to specify an EDI mapping model ala the Smooks EDIParser.
-
7. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 7:29 AM (in response to tfennelly)A simple action for converting JSON to XML, allowing you to specify an EDI mapping model ala the Smooks EDIParser.
-
8. Re: Transformation Actions to handle specific use cases
tfennelly May 8, 2009 7:30 AM (in response to tfennelly)"tfennelly" wrote:
A simple action for converting JSON to XML, allowing you to specify an EDI mapping model ala the Smooks EDIParser.
Doh... scrap the second part of that sentence of course :)