Search in sources :

Example 1 with RuleVariableNewestStageEvent

use of org.hisp.dhis.rules.models.RuleVariableNewestStageEvent in project dhis2-android-sdk by dhis2.

the class RuleVariableValueMapBuilder method buildRuleVariableValues.

private void buildRuleVariableValues(@Nonnull Map<String, RuleVariableValue> valueMap) {
    for (RuleVariable ruleVariable : ruleVariables) {
        if (ruleVariable instanceof RuleVariableAttribute) {
            RuleVariableAttribute ruleVariableAttribute = (RuleVariableAttribute) ruleVariable;
            createAttributeVariableValue(valueMap, ruleVariableAttribute);
        } else if (ruleVariable instanceof RuleVariableCurrentEvent) {
            RuleVariableCurrentEvent currentEventVariable = (RuleVariableCurrentEvent) ruleVariable;
            createCurrentEventVariableValue(valueMap, currentEventVariable);
        } else if (ruleVariable instanceof RuleVariablePreviousEvent) {
            RuleVariablePreviousEvent ruleVariablePreviousEvent = (RuleVariablePreviousEvent) ruleVariable;
            createPreviousEventVariableValue(valueMap, ruleVariablePreviousEvent);
        } else if (ruleVariable instanceof RuleVariableNewestEvent) {
            RuleVariableNewestEvent ruleVariableNewestEvent = (RuleVariableNewestEvent) ruleVariable;
            createNewestEventVariableValue(valueMap, ruleVariableNewestEvent);
        } else if (ruleVariable instanceof RuleVariableNewestStageEvent) {
            RuleVariableNewestStageEvent ruleVariableNewestEvent = (RuleVariableNewestStageEvent) ruleVariable;
            createNewestStageEventVariableValue(valueMap, ruleVariableNewestEvent);
        } else {
            throw new IllegalArgumentException("Unsupported RuleVariable type: " + ruleVariable.getClass());
        }
    }
}
Also used : RuleVariablePreviousEvent(org.hisp.dhis.rules.models.RuleVariablePreviousEvent) RuleVariableNewestStageEvent(org.hisp.dhis.rules.models.RuleVariableNewestStageEvent) RuleVariableAttribute(org.hisp.dhis.rules.models.RuleVariableAttribute) RuleVariableCurrentEvent(org.hisp.dhis.rules.models.RuleVariableCurrentEvent) RuleVariableNewestEvent(org.hisp.dhis.rules.models.RuleVariableNewestEvent) RuleVariable(org.hisp.dhis.rules.models.RuleVariable)

Aggregations

RuleVariable (org.hisp.dhis.rules.models.RuleVariable)1 RuleVariableAttribute (org.hisp.dhis.rules.models.RuleVariableAttribute)1 RuleVariableCurrentEvent (org.hisp.dhis.rules.models.RuleVariableCurrentEvent)1 RuleVariableNewestEvent (org.hisp.dhis.rules.models.RuleVariableNewestEvent)1 RuleVariableNewestStageEvent (org.hisp.dhis.rules.models.RuleVariableNewestStageEvent)1 RuleVariablePreviousEvent (org.hisp.dhis.rules.models.RuleVariablePreviousEvent)1