use of org.talend.hl7.Field in project atlasmap by atlasmap.
the class AtlasModuleSupportTest method testListTargetPathsListOfBaseMapping.
@Test
public void testListTargetPathsListOfBaseMapping() {
List<BaseMapping> mappings = null;
assertEquals(0, AtlasModuleSupport.listTargetPaths(mappings).size());
mappings = new ArrayList<>();
assertEquals(0, AtlasModuleSupport.listTargetPaths(mappings).size());
Mapping mapping = new Mapping();
Field field = new MockField();
field.setPath("MockPath");
mapping.getOutputField().add(field);
mappings.add(mapping);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
Collection collection = null;
mappings.add(collection);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
collection = new Collection();
mappings.add(collection);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
Mappings mapings = new Mappings();
collection.setMappings(mapings);
assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
}
use of org.talend.hl7.Field in project atlasmap by atlasmap.
the class BaseDefaultAtlasContextTest method prepareTargetField.
protected Field prepareTargetField(Mapping mapping, String path, int index) {
Field field = prepareTargetField(mapping, path);
field.setIndex(index);
return field;
}
use of org.talend.hl7.Field in project atlasmap by atlasmap.
the class BaseDefaultAtlasContextTest method populateSourceField.
protected Field populateSourceField(Mapping mapping, FieldType type, Object value) {
Field field = new SimpleField();
field.setFieldType(type);
field.setPath("/testPath" + value);
mapping.getInputField().add(field);
reader.sources.put(field.getPath(), value);
return field;
}
use of org.talend.hl7.Field in project atlasmap by atlasmap.
the class DocumentJavaFieldReader method read.
@Override
public void read(AtlasInternalSession session) throws AtlasException {
try {
Field sourceField = session.head().getSourceField();
Method getter = null;
if (sourceField.getFieldType() == null && (sourceField instanceof JavaField || sourceField instanceof JavaEnumField)) {
getter = resolveGetMethod(sourceDocument, sourceField);
if (getter == null) {
AtlasUtil.addAudit(session, sourceField.getDocId(), String.format("Unable to auto-detect sourceField type path=%s docId=%s", sourceField.getPath(), sourceField.getDocId()), sourceField.getPath(), AuditStatus.WARN, null);
return;
}
Class<?> returnType = getter.getReturnType();
sourceField.setFieldType(conversionService.fieldTypeFromClass(returnType));
if (LOG.isTraceEnabled()) {
LOG.trace("Auto-detected sourceField type p=" + sourceField.getPath() + " t=" + sourceField.getFieldType());
}
}
populateSourceFieldValue(session, sourceField, sourceDocument, getter);
if (LOG.isDebugEnabled()) {
LOG.debug("Processed input field sPath=" + sourceField.getPath() + " sV=" + sourceField.getValue() + " sT=" + sourceField.getFieldType() + " docId: " + sourceField.getDocId());
}
} catch (Exception e) {
throw new AtlasException(e);
}
}
use of org.talend.hl7.Field in project atlasmap by atlasmap.
the class BaseDocumentWriterTest method write.
protected void write(String path, StateEnumClassLong targetValue) throws AtlasException {
Field field = createEnumField(path, targetValue);
setTargetValue(targetValue);
write(field);
}
Aggregations