use of io.atlasmap.xml.core.XmlFieldReader in project atlasmap by atlasmap.
the class XmlModule method processSourceFieldMapping.
@Override
public void processSourceFieldMapping(AtlasInternalSession session) throws AtlasException {
Field sourceField = session.head().getSourceField();
XmlFieldReader reader = session.getFieldReader(getDocId(), XmlFieldReader.class);
if (reader == null) {
AtlasUtil.addAudit(session, sourceField.getDocId(), String.format("Source document '%s' doesn't exist", getDocId()), sourceField.getPath(), AuditStatus.ERROR, null);
return;
}
reader.read(session);
if (sourceField.getActions() != null && sourceField.getActions().getActions() != null) {
getFieldActionService().processActions(sourceField.getActions(), sourceField);
}
if (LOG.isDebugEnabled()) {
LOG.debug("{}: processSourceFieldMapping completed: SourceField:[docId={}, path={}, type={}, value={}]", getDocId(), sourceField.getDocId(), sourceField.getPath(), sourceField.getFieldType(), sourceField.getValue());
}
}
use of io.atlasmap.xml.core.XmlFieldReader in project atlasmap by atlasmap.
the class XmlModule method processPreSourceExecution.
@Override
public void processPreSourceExecution(AtlasInternalSession session) throws AtlasException {
Object sourceDocument = session.getSourceDocument(getDocId());
if (sourceDocument == null || !(sourceDocument instanceof String)) {
AtlasUtil.addAudit(session, getDocId(), String.format("Null or non-String source document: docId='%s'", getDocId()), null, AuditStatus.WARN, null);
} else {
Map<String, String> sourceUriParams = AtlasUtil.getUriParameters(getUri());
boolean enableNamespaces = true;
for (String key : sourceUriParams.keySet()) {
if ("disableNamespaces".equals(key) && ("true".equals(sourceUriParams.get("disableNamespaces")))) {
if (LOG.isDebugEnabled()) {
LOG.debug("Disabling namespace support");
}
enableNamespaces = false;
}
}
XmlFieldReader reader = new XmlFieldReader(getConversionService());
reader.setDocument(String.class.cast(sourceDocument), enableNamespaces);
session.setFieldReader(getDocId(), reader);
}
if (LOG.isDebugEnabled()) {
LOG.debug("{}: processPreSourceExecution completed", getDocId());
}
}
Aggregations