use of org.openforis.idm.model.BooleanAttribute in project collect by openforis.
the class ExpressionTest method testTrueThisBoolean.
@Test
public void testTrueThisBoolean() throws InvalidExpressionException {
BooleanAttribute gpsRealtime = EntityBuilder.addValue(cluster, "gps_realtime", Boolean.TRUE);
Assert.assertTrue((Boolean) evaluateExpression(cluster, gpsRealtime, "$this"));
}
use of org.openforis.idm.model.BooleanAttribute in project collect by openforis.
the class ExpressionTest method testNotWithThisTrueBoolean.
@Test
public void testNotWithThisTrueBoolean() throws InvalidExpressionException {
BooleanAttribute gpsRealtime = EntityBuilder.addValue(cluster, "gps_realtime", Boolean.TRUE);
Assert.assertFalse((Boolean) evaluateExpression(cluster, gpsRealtime, "not($this)"));
}
use of org.openforis.idm.model.BooleanAttribute in project collect by openforis.
the class ExpressionTest method testNotWithThisFalseBoolean.
@Test
public void testNotWithThisFalseBoolean() throws InvalidExpressionException {
BooleanAttribute gpsRealtime = EntityBuilder.addValue(cluster, "gps_realtime", Boolean.FALSE);
Assert.assertTrue((Boolean) evaluateExpression(cluster, gpsRealtime, "not($this = true())"));
}
use of org.openforis.idm.model.BooleanAttribute in project collect by openforis.
the class RecordUpdater method applyInitialValue.
private Value applyInitialValue(Attribute<?, ?> attr) {
Value value = null;
if (!attr.getDefinition().isCalculated()) {
if (attr.isEmpty() && isDefaultValueToBeApplied(attr)) {
value = performDefaultValueApply(attr);
}
if (attr instanceof BooleanAttribute && ((BooleanAttributeDefinition) attr.getDefinition()).isAffirmativeOnly() && attr.isEmpty()) {
BooleanAttribute boolAttr = (BooleanAttribute) attr;
value = new BooleanValue(false);
boolAttr.setValue((BooleanValue) value);
boolAttr.updateSummaryInfo();
}
}
return value;
}
use of org.openforis.idm.model.BooleanAttribute in project collect by openforis.
the class ExpressionTest method testFalseThisBoolean.
@Test
public void testFalseThisBoolean() throws InvalidExpressionException {
BooleanAttribute gpsRealtime = EntityBuilder.addValue(cluster, "gps_realtime", Boolean.FALSE);
Assert.assertFalse((Boolean) evaluateExpression(cluster, gpsRealtime, "$this"));
}
Aggregations