Class XmlPayloadTranslator

  • All Implemented Interfaces:
    ComponentLifecycle, ComponentLifecycleExtension, ResultSetTranslator

    public class XmlPayloadTranslator
    extends XmlPayloadTranslatorImpl
    Translate the ResultSet contents into an XML Payload.

    The original message can be included in the output message in order to allow consolidation of XML data and SQL data in a subsequent XSLT step. The format of the returned message is as follows:

     
     <Results>
       <OriginalMessage>
       ...
       </OriginalMessage>
       <Row>
         <column1>...</column1>
         <column2>...</column2>
         ...
       </Row>
       <Row> ... </Row>
     </Results>
     
     

    Note that column1, column2, etc. is replaced by the actual column name as returned in the query. As such, the column name must be a valid XML element name. If the actual name (in the database table definition) is not valid, the query should specify an alias name in the query. E.g: SELECT "col 1" AS "col1" FROM mytable;

    If you want to see how many rows were processed you can set one/both of the following;

    Item Description Value
    result-count-metadata-itemIf set to a String metadata item name will specify the metadata item to contain the number of rows returned by your queryMetadata item name
    update-count-metadata-itemIf set to a String metadata item name will specify the metadata item to contain the number of rows updated by your SQL statementMetadata item name

    In the adapter configuration file this class is aliased as jdbc-xml-payload-translator which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • XmlPayloadTranslator

        public XmlPayloadTranslator()
    • Method Detail

      • getPreserveOriginalMessage

        public java.lang.Boolean getPreserveOriginalMessage()
        Returns:
        whether to incorporate the original message in the output message body
      • setPreserveOriginalMessage

        public void setPreserveOriginalMessage​(java.lang.Boolean b)
        Sets whether to incorporate the original message in the output message body
        Parameters:
        b - true or false, default is false.