use of io.atlasmap.v2.Constants in project atlasmap by atlasmap.
the class AtlasField method readConstant.
/**
* Reads the constant.
* @param name name
* @return read field
* @throws AtlasException unexpected error
*/
public AtlasField readConstant(String name) throws AtlasException {
ConstantModule module = session.getConstantModule();
List<Constant> constants = session.getMapping().getConstants().getConstant();
for (Constant constant : constants) {
if (constant.getName() != null && constant.getName().equals(name)) {
Field sourceField = module.createField();
sourceField.setName(constant.getName());
sourceField.setFieldType(constant.getFieldType());
sourceField.setValue(constant.getValue());
session.head().setSourceField(sourceField);
module.readSourceValue(session);
setRawField(sourceField);
return this;
}
}
throw new AtlasException(String.format("Constant '%s' not found", name));
}
use of io.atlasmap.v2.Constants in project atlasmap by atlasmap.
the class AtlasTestData method generateAtlasMapping.
public static AtlasMapping generateAtlasMapping() {
AtlasMapping mapping = AtlasModelFactory.createAtlasMapping();
mapping.setName("generated.mapping." + UUID.randomUUID().toString().replace('-', '.'));
mapping.getProperties().getProperty().addAll(generateAtlasProperties());
mapping.setConstants(new Constants());
return mapping;
}
Aggregations