diff --git a/src/main/java/org/hisp/dhis/rules/models/RuleAction.java b/src/main/java/org/hisp/dhis/rules/models/RuleAction.java deleted file mode 100644 index 70575c19..00000000 --- a/src/main/java/org/hisp/dhis/rules/models/RuleAction.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.hisp.dhis.rules.models; - -import javax.annotation.Nonnull; - -public interface RuleAction -{ - - /** - * @return dynamic data which can be potentially - * generated by the RuleEngine. - */ - @Nonnull - String data(); -} diff --git a/src/main/java/org/hisp/dhis/rules/models/RuleAction.kt b/src/main/java/org/hisp/dhis/rules/models/RuleAction.kt new file mode 100644 index 00000000..7568e545 --- /dev/null +++ b/src/main/java/org/hisp/dhis/rules/models/RuleAction.kt @@ -0,0 +1,7 @@ +package org.hisp.dhis.rules.models + +import javax.annotation.Nonnull + +fun interface RuleAction { + fun data(): String +} diff --git a/src/main/java/org/hisp/dhis/rules/models/RuleActionHideProgramStage.java b/src/main/java/org/hisp/dhis/rules/models/RuleActionHideProgramStage.java deleted file mode 100644 index 976d274f..00000000 --- a/src/main/java/org/hisp/dhis/rules/models/RuleActionHideProgramStage.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.hisp.dhis.rules.models; - -import javax.annotation.Nonnull; - -public record RuleActionHideProgramStage( - @Nonnull String data, - @Nonnull String programStage -) implements RuleAction { - - @Nonnull - public static RuleActionHideProgramStage create(@Nonnull String programStage) { - return new RuleActionHideProgramStage("", programStage); - } -} diff --git a/src/main/java/org/hisp/dhis/rules/models/RuleActionHideProgramStage.kt b/src/main/java/org/hisp/dhis/rules/models/RuleActionHideProgramStage.kt new file mode 100644 index 00000000..6f3f17fd --- /dev/null +++ b/src/main/java/org/hisp/dhis/rules/models/RuleActionHideProgramStage.kt @@ -0,0 +1,10 @@ +package org.hisp.dhis.rules.models + +data class RuleActionHideProgramStage( + val programStage: String, + val data: String = "" +) : RuleAction { + override fun data(): String { + return data + } +} diff --git a/src/test/java/org/hisp/dhis/rules/RuleEngineEffectTypesTest.kt b/src/test/java/org/hisp/dhis/rules/RuleEngineEffectTypesTest.kt index 4d375e97..986292a8 100644 --- a/src/test/java/org/hisp/dhis/rules/RuleEngineEffectTypesTest.kt +++ b/src/test/java/org/hisp/dhis/rules/RuleEngineEffectTypesTest.kt @@ -150,7 +150,7 @@ class RuleEngineEffectTypesTest { @Test fun simpleConditionMustResultInHideProgramStageEffect() { - val ruleAction: RuleAction = RuleActionHideProgramStage.create("test_program_stage") + val ruleAction: RuleAction = RuleActionHideProgramStage("test_program_stage") val rule = Rule.create(null, null, "true", List.of(ruleAction), "", "") val ruleEngine = getRuleEngine(rule) val ruleEffects = ruleEngine.evaluate(getTestRuleEvent(RuleEvent.Status.ACTIVE)).call()