/** * Returns a string useful for substitution. * * @param valueType the value type. * @return the string. */ public static String getSubstitutionValue( ValueType valueType ) { if ( valueType.isNumeric() || valueType.isBoolean() ) { return "1"; } else if ( valueType.isDate() ) { return "'2000-01-01'"; } else { return "'A'"; } }
private RuleValueType toMappedValueType( ProgramRuleVariable programRuleVariable ) { ValueType valueType = VALUE_TYPE_MAPPER.getOrDefault( programRuleVariable.getSourceType(), prv -> ValueType.TEXT ).apply( programRuleVariable ); if ( valueType.isBoolean() ) { return RuleValueType.BOOLEAN; } if ( valueType.isText() ) { return RuleValueType.TEXT; } if ( valueType.isNumeric() ) { return RuleValueType.NUMERIC; } return RuleValueType.TEXT; }
else if ( valueType.isBoolean() )
else if ( valueType.isBoolean() )
private String getTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue ) { ValueType valueType = attributeValue.getAttribute().getValueType(); if ( valueType.isBoolean() ) { return attributeValue.getValue() != null ? attributeValue.getValue() : "false"; } if ( valueType.isNumeric() ) { return attributeValue.getValue() != null ? attributeValue.getValue() : "0"; } return attributeValue.getValue() != null ? attributeValue.getValue() : ""; }
private String getTrackedEntityDataValue( TrackedEntityDataValue dataValue ) { ValueType valueType = dataValue.getDataElement().getValueType(); if ( valueType.isBoolean() ) { return dataValue.getValue() != null ? dataValue.getValue() : "false"; } if ( valueType.isNumeric() ) { return dataValue.getValue() != null ? dataValue.getValue() : "0"; } return dataValue.getValue() != null ? dataValue.getValue() : ""; } }