use of org.openforis.idm.model.Value in project collect by openforis.
the class RecordUpdater method recalculateValue.
private Value recalculateValue(Attribute<?, ?> attribute) {
try {
AttributeDefinition defn = attribute.getDefinition();
List<AttributeDefault> attributeDefaults = defn.getAttributeDefaults();
for (AttributeDefault attributeDefault : attributeDefaults) {
if (attributeDefault.evaluateCondition(attribute)) {
Value value = attributeDefault.evaluate(attribute);
return value;
}
}
return null;
} catch (InvalidExpressionException e) {
throw new IllegalStateException(String.format("Invalid expression for calculated attribute %s", attribute.getPath()));
}
}
Aggregations