use of io.atlasmap.v2.Validation in project atlasmap by atlasmap.
the class DefaultAtlasValidationService method validateMappingId.
private void validateMappingId(String id, Set<String> usedIds, List<Validation> validations) {
if (id == null) {
return;
}
if (usedIds.contains(id)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setMessage(String.format("Duplicated mapping ID '%s' is found", id));
validation.setStatus(ValidationStatus.WARN);
validations.add(validation);
} else {
usedIds.add(id);
}
}
use of io.atlasmap.v2.Validation in project atlasmap by atlasmap.
the class DefaultAtlasValidationService method validateLookupTables.
private void validateLookupTables(List<Mapping> lookupFieldMappings, LookupTables lookupTables, List<Validation> validations, Set<String> usedIds) {
if (lookupTables != null && lookupTables.getLookupTable() != null && !lookupTables.getLookupTable().isEmpty()) {
// check for duplicate names
Validators.LOOKUPTABLE_NAME_CHECK_FOR_DUPLICATE.get().validate(lookupTables, validations, null);
if (lookupFieldMappings.isEmpty()) {
Validation validation = new Validation();
validation.setScope(ValidationScope.LOOKUP_TABLE);
validation.setMessage("LookupTables are defined but no LookupFields are utilized.");
validation.setStatus(ValidationStatus.WARN);
validations.add(validation);
} else {
validateLookupFieldMapping(lookupFieldMappings, lookupTables, validations, usedIds);
}
}
}
use of io.atlasmap.v2.Validation in project atlasmap by atlasmap.
the class AtlasUtil method addAudit.
public static void addAudit(AtlasSession session, Validation validation) {
Audit audit = new Audit();
audit.setDocId(validation.getId());
audit.setMessage(validation.getMessage());
audit.setStatus(AtlasUtil.toAuditStatus(validation.getStatus()));
}
use of io.atlasmap.v2.Validation in project atlasmap by atlasmap.
the class BaseModuleValidationService method populateConversionConcerns.
protected void populateConversionConcerns(String mappingId, AtlasConversionInfo converterAnno, String inputFieldName, String outFieldName, List<Validation> validations) {
if (converterAnno == null || converterAnno.concerns() == null) {
return;
}
for (AtlasConversionConcern atlasConversionConcern : converterAnno.concerns()) {
String message = atlasConversionConcern.getMessage(converterAnno);
if (AtlasConversionConcern.NONE.equals(atlasConversionConcern)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(message);
validation.setStatus(ValidationStatus.INFO);
validations.add(validation);
} else if (atlasConversionConcern.equals(AtlasConversionConcern.RANGE) || atlasConversionConcern.equals(AtlasConversionConcern.FORMAT) || atlasConversionConcern.equals(AtlasConversionConcern.FRACTIONAL_PART) || atlasConversionConcern.equals(AtlasConversionConcern.TIMEZONE)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(message);
validation.setStatus(ValidationStatus.WARN);
validations.add(validation);
} else if (atlasConversionConcern.equals(AtlasConversionConcern.UNSUPPORTED)) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(message);
validation.setStatus(ValidationStatus.ERROR);
validations.add(validation);
}
}
}
use of io.atlasmap.v2.Validation in project atlasmap by atlasmap.
the class BaseModuleValidationService method validateField.
@SuppressWarnings("unchecked")
protected void validateField(String mappingId, Field field, FieldDirection direction, List<Validation> validations) {
if (field == null) {
Validation validation = new Validation();
validation.setScope(ValidationScope.MAPPING);
validation.setId(mappingId);
validation.setMessage(String.format("%s field %s is null", direction.value(), getFieldName(field)));
validation.setStatus(ValidationStatus.ERROR);
validations.add(validation);
} else if (getFieldType().isAssignableFrom(field.getClass())) {
validateModuleField(mappingId, (T) field, direction, validations);
}
}
Aggregations