use of io.atlasmap.json.core.JsonFieldReader in project atlasmap by atlasmap.
the class JsonModule method processSourceFieldMapping.
@Override
public void processSourceFieldMapping(AtlasInternalSession session) throws AtlasException {
Field sourceField = session.head().getSourceField();
JsonFieldReader reader = session.getFieldReader(getDocId(), JsonFieldReader.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.json.core.JsonFieldReader in project atlasmap by atlasmap.
the class JsonModule 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 {
String document = String.class.cast(sourceDocument);
JsonFieldReader fieldReader = new JsonFieldReader(getConversionService());
fieldReader.setDocument(document);
session.setFieldReader(getDocId(), fieldReader);
}
if (LOG.isDebugEnabled()) {
LOG.debug("{} processPreSourceExcution completed", getDocId());
}
}
Aggregations