Search in sources :

Example 46 with Validation

use of io.atlasmap.v2.Validation in project atlasmap by atlasmap.

the class PositiveIntegerValidator method validate.

@Override
public void validate(Object target, List<Validation> validations, String id, ValidationStatus status) {
    Integer value = (Integer) target;
    if (value == null || value < 0) {
        Validation validation = new Validation();
        validation.setScope(scope);
        validation.setId(id);
        validation.setMessage(String.format(violationMessage, target != null ? target.toString() : null));
        validation.setStatus(status);
        validations.add(validation);
    }
}
Also used : Validation(io.atlasmap.v2.Validation)

Aggregations

Validation (io.atlasmap.v2.Validation)39 AtlasMapping (io.atlasmap.v2.AtlasMapping)17 Test (org.junit.Test)17 Mapping (io.atlasmap.v2.Mapping)14 Field (io.atlasmap.v2.Field)7 BaseMapping (io.atlasmap.v2.BaseMapping)6 JavaField (io.atlasmap.java.v2.JavaField)5 Validations (io.atlasmap.v2.Validations)5 DataSource (io.atlasmap.v2.DataSource)3 ArrayList (java.util.ArrayList)3 AtlasConversionService (io.atlasmap.api.AtlasConversionService)2 AtlasConverter (io.atlasmap.api.AtlasConverter)2 AtlasException (io.atlasmap.api.AtlasException)2 JsonField (io.atlasmap.json.v2.JsonField)2 AtlasConversionConcern (io.atlasmap.spi.AtlasConversionConcern)2 AtlasConversionInfo (io.atlasmap.spi.AtlasConversionInfo)2 AtlasModule (io.atlasmap.spi.AtlasModule)2 AtlasModuleDetail (io.atlasmap.spi.AtlasModuleDetail)2 FieldDirection (io.atlasmap.spi.FieldDirection)2 FieldType (io.atlasmap.v2.FieldType)2