8 Replies Latest reply on May 8, 2009 7:30 AM by tfennelly

    Transformation Actions to handle specific use cases

    tfennelly

      We have a few of these already (ByteArrayToString, ObjectToXStream etc).

      What other specific use cases would people see as being made easier by having a more specialized ESB action?

        • 1. Re: Transformation Actions to handle specific use cases
          tfennelly

          Transformation Actions to handle specific use cases

          • 2. Re: Transformation Actions to handle specific use cases
            tfennelly

            Grrrr... posted last comment in the wrong place :)

            • 3. Re: Transformation Actions to handle specific use cases
              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

                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

                  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

                    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

                      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

                         

                        "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 :)