use of org.openforis.idm.metamodel.validation.ValidationResultFlag in project collect by openforis.
the class CollectMinCountValidator method evaluate.
@Override
public ValidationResultFlag evaluate(Entity entity) {
CollectRecord record = (CollectRecord) entity.getRecord();
ValidationResultFlag resultFlag = super.evaluate(entity);
// you can approve missing values in entry phase as well
if (resultFlag == ValidationResultFlag.ERROR) {
if (record.getStep() == Step.CLEANSING && record.isMissingApproved(entity, getNodeDefinition())) {
resultFlag = ValidationResultFlag.WARNING;
}
}
return resultFlag;
}
use of org.openforis.idm.metamodel.validation.ValidationResultFlag in project collect by openforis.
the class CollectNumberValueUnitValidator method evaluate.
@Override
public ValidationResultFlag evaluate(NumberAttribute<?, ?> attribute) {
CollectRecord record = (CollectRecord) attribute.getRecord();
Step step = record.getStep();
ValidationResultFlag resultFlag = super.evaluate(attribute);
if (resultFlag == ValidationResultFlag.ERROR && step == Step.ENTRY) {
Character unitSymbolChar = attribute.getUnitField().getSymbol();
FieldSymbol unitSymbol = FieldSymbol.valueOf(unitSymbolChar);
if (unitSymbol != null && unitSymbol.isReasonBlank()) {
return ValidationResultFlag.WARNING;
}
}
return resultFlag;
}
use of org.openforis.idm.metamodel.validation.ValidationResultFlag in project collect by openforis.
the class CollectValidator method validateNumericRangeUnit.
@Override
protected void validateNumericRangeUnit(NumericRangeAttribute<?, ?> attribute, ValidationResults results) {
NumericRangeUnitValidator unitValidator = new CollectNumericRangeUnitValidator();
ValidationResultFlag unitValidationResult = unitValidator.evaluate(attribute);
results.addResult(unitValidator, unitValidationResult);
}
use of org.openforis.idm.metamodel.validation.ValidationResultFlag in project collect by openforis.
the class CollectValidator method validateMaxCount.
@Override
public ValidationResultFlag validateMaxCount(Entity entity, NodeDefinition childDef) {
ValidationResultFlag flag = super.validateMaxCount(entity, childDef);
CollectRecord record = (CollectRecord) entity.getRecord();
record.updateMaxCountsValidationCache(entity, childDef, flag);
return flag;
}
use of org.openforis.idm.metamodel.validation.ValidationResultFlag in project collect by openforis.
the class CollectValidator method validateNumericAttributeUnit.
@Override
protected void validateNumericAttributeUnit(NumberAttribute<?, ?> attribute, ValidationResults results) {
NumberValueUnitValidator validator = new CollectNumberValueUnitValidator();
ValidationResultFlag result = validator.evaluate(attribute);
results.addResult(validator, result);
}
Aggregations