public class XmlPayloadTranslator extends XmlPayloadTranslatorImpl
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-item | If set to a String metadata item name will specify the metadata item to contain the number of rows returned by your query | Metadata item name |
update-count-metadata-item | If set to a String metadata item name will specify the metadata item to contain the number of rows updated by your SQL statement | Metadata 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.
XmlPayloadTranslatorImpl.DocumentWrapper
StyledResultTranslatorImp.ColumnStyle
ELEMENT_NAME_COLUMN, ELEMENT_NAME_RESULTS, ELEMENT_NAME_ROW
log
Constructor and Description |
---|
XmlPayloadTranslator() |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
getPreserveOriginalMessage() |
void |
setPreserveOriginalMessage(java.lang.Boolean b)
Sets whether to incorporate the original message in the output message body
|
long |
translateResult(JdbcResult source,
AdaptrisMessage target)
Translate the result returning the number of rows translated.
|
close, createInputSource, createListFromResultSet, createTextNode, createXmlUtils, getCdataColumnRegexp, getOutputMessageEncoding, getStripIllegalXmlChars, getXmlColumnPrefix, getXmlColumnRegexp, init, isCdataColumn, isXmlColumn, setCdataColumnRegexp, setOutputMessageEncoding, setStripIllegalXmlChars, setXmlColumnPrefix, setXmlColumnRegexp, stripIllegalXmlChars
addColumnTranslator, getAttemptAutoConvert, getColumnTranslators, getDisplayColumnErrors, getResultCountMetadataItem, getUpdateCountMetadataItem, isDisplayColumnErrors, logColumnErrors, setAttemptAutoConvert, setColumnTranslators, setDisplayColumnErrors, setResultCountMetadataItem, setUpdateCountMetadataItem, toString, translate, updateMetadata, updateMetadataQueryCount, updateMetadataUpdateCount, withAttemptAutoConvert, withColumnTranslators, withColumnTranslators
getColumnNameStyle, setColumnNameStyle, withColumnNameStyle
prepare
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
start, stop
public long translateResult(JdbcResult source, AdaptrisMessage target) throws java.sql.SQLException, ServiceException
ResultSetTranslatorImp
translateResult
in class ResultSetTranslatorImp
java.sql.SQLException
ServiceException
public java.lang.Boolean getPreserveOriginalMessage()
public void setPreserveOriginalMessage(java.lang.Boolean b)
b
- true or false, default is false.