PullTransformer<DataObject, XMLStreamReader> {
public XMLStreamReader transform(DataObject source, TransformationContext context) {
try {
TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
Object logicalType = context.getSourceDataType().getLogical();
QName elementName =
(logicalType instanceof QName) ? (QName) logicalType : new QName("commonj.sdo", "dataObject");
XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
XMLDocument document =
xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
return streamHelper.createXMLStreamReader(document);
} catch (XMLStreamException e) {
// TODO: Add context to the exception
throw new TransformationException(e);
}
}