-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ForeachSpec, RuleOutcome, Builders, flere rulesets (#80)
* Diskusjonsutkast forbedring av Sequence * Foreach spec for å erstatte DynamicRuleSvc * Riktig summary der roten er en leaf * Evaluation output og enkel carryon * Forenkle output/carryon - bruk heller RuleOutcome * Forenkle tilfeller av evaluate(t, serviceArgument * Siste finpuss * Konservativ ... * Flere builders og utilities Co-authored-by: Michal J. Sladek <mrsladek@users.noreply.github.com>
- Loading branch information
Showing
25 changed files
with
712 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/no/nav/fpsak/nare/evaluation/RuleOutcome.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package no.nav.fpsak.nare.evaluation; | ||
|
||
/* | ||
* Implementer gjerne en lokal DomemeRuleOutcome som kan gi ut en enum eller record, unngå getReasonCode og string-kode-magi | ||
* - Bruk T for typet grunn til utfallet | ||
* - Bruk R for beregnet resultat | ||
*/ | ||
public record RuleOutcome<T, R>(T reason, String reasonCode, String reasonTextTemplate, R calculated) implements RuleReasonRef { | ||
|
||
public RuleOutcome(R calculated) { | ||
this(null, null, "", calculated); | ||
} | ||
|
||
public RuleOutcome(T reason, String reasonCode) { | ||
this(reason, reasonCode, "", null); | ||
} | ||
|
||
public RuleOutcome(T reason, String reasonCode, String reasonTextTemplate) { | ||
this(reason, reasonCode, reasonTextTemplate, null); | ||
} | ||
|
||
@Override | ||
public String getReasonTextTemplate() { | ||
return reasonTextTemplate; | ||
} | ||
|
||
@Override | ||
public String getReasonCode() { | ||
return reasonCode; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
src/main/java/no/nav/fpsak/nare/evaluation/RuleReasonRefImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/no/nav/fpsak/nare/evaluation/node/ForeachEvaluation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package no.nav.fpsak.nare.evaluation.node; | ||
|
||
import no.nav.fpsak.nare.evaluation.AggregatedEvaluation; | ||
import no.nav.fpsak.nare.evaluation.Evaluation; | ||
import no.nav.fpsak.nare.evaluation.Operator; | ||
import no.nav.fpsak.nare.evaluation.Resultat; | ||
|
||
public class ForeachEvaluation extends AggregatedEvaluation { | ||
|
||
public ForeachEvaluation(String id, String ruleDescription, Evaluation... children) { | ||
super(Operator.FOREACH, id, ruleDescription, children); | ||
} | ||
|
||
@Override | ||
public String reason() { | ||
return "Utført " + ruleDescriptionText(); | ||
} | ||
|
||
@Override | ||
public Resultat result() { | ||
// Endre hvis man tillater andre outcomes fra loop | ||
return lastChild().result(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.