Search in sources :

Example 21 with RuleAction

use of org.hisp.dhis.rules.models.RuleAction in project dhis2-core by dhis2.

the class ShowErrorWarningImplementerTest method getRuleEffects.

private List<RuleEffect> getRuleEffects() {
    RuleAction actionShowWarning = RuleActionShowWarning.create(IssueType.WARNING.name() + CONTENT, DATA, "", UNKNOWN);
    RuleAction actionShowWarningOnComplete = RuleActionWarningOnCompletion.create(IssueType.WARNING.name() + CONTENT, DATA, "", UNKNOWN);
    RuleAction actionShowError = RuleActionShowError.create(IssueType.ERROR.name() + CONTENT, DATA, "", UNKNOWN);
    RuleAction actionShowErrorOnCompletion = RuleActionErrorOnCompletion.create(IssueType.ERROR.name() + CONTENT, DATA, "", UNKNOWN);
    return Lists.newArrayList(RuleEffect.create("", actionShowWarning, EVALUATED_DATA), RuleEffect.create("", actionShowWarningOnComplete, EVALUATED_DATA), RuleEffect.create("", actionShowError, EVALUATED_DATA), RuleEffect.create("", actionShowErrorOnCompletion, EVALUATED_DATA));
}
Also used : RuleAction(org.hisp.dhis.rules.models.RuleAction)

Example 22 with RuleAction

use of org.hisp.dhis.rules.models.RuleAction in project dhis2-core by dhis2.

the class ShowErrorWarningImplementerTest method getRuleEffectsLinkedToDataAnotherElement.

private List<RuleEffect> getRuleEffectsLinkedToDataAnotherElement() {
    RuleAction actionShowWarning = RuleActionShowWarning.create(IssueType.WARNING.name() + CONTENT, DATA, ANOTHER_DATA_ELEMENT_ID, DATA_ELEMENT);
    RuleAction actionShowWarningOnComplete = RuleActionWarningOnCompletion.create(IssueType.WARNING.name() + CONTENT, DATA, ANOTHER_DATA_ELEMENT_ID, DATA_ELEMENT);
    RuleAction actionShowError = RuleActionShowError.create(IssueType.ERROR.name() + CONTENT, DATA, ANOTHER_DATA_ELEMENT_ID, DATA_ELEMENT);
    RuleAction actionShowErrorOnCompletion = RuleActionErrorOnCompletion.create(IssueType.ERROR.name() + CONTENT, DATA, ANOTHER_DATA_ELEMENT_ID, DATA_ELEMENT);
    return Lists.newArrayList(RuleEffect.create("", actionShowWarning, EVALUATED_DATA), RuleEffect.create("", actionShowWarningOnComplete, EVALUATED_DATA), RuleEffect.create("", actionShowError, EVALUATED_DATA), RuleEffect.create("", actionShowErrorOnCompletion, EVALUATED_DATA));
}
Also used : RuleAction(org.hisp.dhis.rules.models.RuleAction)

Example 23 with RuleAction

use of org.hisp.dhis.rules.models.RuleAction in project dhis2-core by dhis2.

the class SetMandatoryFieldValidatorTest method getRuleEffects.

private List<RuleEffect> getRuleEffects() {
    RuleAction ruleActionSetMandatoryDataValue = RuleActionSetMandatoryField.create(DATA_ELEMENT_ID, DATA_ELEMENT);
    RuleAction ruleActionSetMandatoryAttribute = RuleActionSetMandatoryField.create(ATTRIBUTE_ID, TRACKED_ENTITY_ATTRIBUTE);
    return Lists.newArrayList(RuleEffect.create("RULE_ATTRIBUTE", ruleActionSetMandatoryAttribute), RuleEffect.create("RULE_DATA_VALUE", ruleActionSetMandatoryDataValue));
}
Also used : RuleAction(org.hisp.dhis.rules.models.RuleAction)

Aggregations

RuleAction (org.hisp.dhis.rules.models.RuleAction)23 RuleEffect (org.hisp.dhis.rules.models.RuleEffect)19 Date (java.util.Date)18 RuleEngine (org.hisp.dhis.rules.RuleEngine)18 Rule (org.hisp.dhis.rules.models.Rule)18 RuleEvent (org.hisp.dhis.rules.models.RuleEvent)18 Test (org.junit.Test)18 RuleVariable (org.hisp.dhis.rules.models.RuleVariable)7 RuleDataValue (org.hisp.dhis.rules.models.RuleDataValue)4 ArrayList (java.util.ArrayList)1 DhisConvenienceTest (org.hisp.dhis.DhisConvenienceTest)1 ProgramInstance (org.hisp.dhis.program.ProgramInstance)1 ProgramRuleAction (org.hisp.dhis.programrule.ProgramRuleAction)1 RuleActionSendMessage (org.hisp.dhis.rules.models.RuleActionSendMessage)1 Test (org.junit.jupiter.api.Test)1