-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Legger splitt i logikk inne i regelrepo (#433)
* Legger splitt i logikk inne i regelrepo * Retter opp kommentar * Bytter om rekkefølge på resultat for å unngå negering * Tilpasser regel-id
- Loading branch information
Showing
27 changed files
with
448 additions
and
157 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...kkeGjelderArbeidsforholdAndelsmessig.java → ...kkeGjelderArbeidsforholdAndelsmessig.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
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
2 changes: 1 addition & 1 deletion
2
...elerSomIkkeGjelderArbeidsforholdTil0.java → ...elerSomIkkeGjelderArbeidsforholdTil0.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
2 changes: 1 addition & 1 deletion
2
...e/svp/FastsettAndelForArbeidsforhold.java → ...verdi/FastsettAndelForArbeidsforhold.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
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
2 changes: 1 addition & 1 deletion
2
...ForBGAndelerSomGjelderArbeidsforhold.java → ...ForBGAndelerSomGjelderArbeidsforhold.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
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
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
6 changes: 3 additions & 3 deletions
6
...telse/svp/RegelFastsettAndelBGOver6G.java → ...enseverdi/RegelFastsettAndelBGOver6G.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
61 changes: 61 additions & 0 deletions
61
...lketrygdloven/beregningsgrunnlag/grenseverdi/RegelFastsettAndelBGOver6GUtenFordeling.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,61 @@ | ||
package no.nav.folketrygdloven.beregningsgrunnlag.grenseverdi; | ||
|
||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.AktivitetStatus; | ||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.BeregningsgrunnlagPeriode; | ||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.BeregningsgrunnlagPrStatus; | ||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.Fastsatt; | ||
import no.nav.fpsak.nare.RuleService; | ||
import no.nav.fpsak.nare.Ruleset; | ||
import no.nav.fpsak.nare.specification.Specification; | ||
|
||
public class RegelFastsettAndelBGOver6GUtenFordeling implements RuleService<BeregningsgrunnlagPeriode> { | ||
public static final String ID = "FP_BR_29.8_uten_fordeling"; | ||
public static final String BESKRIVELSE = "Fastsett avkortet BG over 6G når refusjon under 6G"; | ||
private BeregningsgrunnlagPeriode regelmodell; | ||
|
||
public RegelFastsettAndelBGOver6GUtenFordeling(BeregningsgrunnlagPeriode regelmodell) { | ||
super(); | ||
this.regelmodell = regelmodell; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Specification<BeregningsgrunnlagPeriode> getSpecification() { | ||
BeregningsgrunnlagPrStatus bgpsa = regelmodell.getBeregningsgrunnlagPrStatus(AktivitetStatus.ATFL); | ||
|
||
Ruleset<BeregningsgrunnlagPeriode> rs = new Ruleset<>(); | ||
|
||
//FP_BR_29.8.10 For alle beregningsgrunnlagsandeler som gjelder arbeidsforhold, fastsett Brukers Andel | ||
//FP_BR_29.8.4 Avkort alle beregningsgrunnlagsander som ikke gjelder arbeidsforhold andelsmessig | ||
Specification<BeregningsgrunnlagPeriode> avkortAndelerAndelsmessigOgFastsettBrukersAndel = rs.beregningsRegel( | ||
AvkortBGAndelerSomIkkeGjelderArbeidsforholdAndelsmessigUtenFordeling.ID, | ||
AvkortBGAndelerSomIkkeGjelderArbeidsforholdAndelsmessigUtenFordeling.BESKRIVELSE, | ||
new AvkortBGAndelerSomIkkeGjelderArbeidsforholdAndelsmessigUtenFordeling(), | ||
new FastsettAndelForBGAndelerSomGjelderArbeidsforholdUtenFordeling()); | ||
|
||
Specification<BeregningsgrunnlagPeriode> avkortAndelerSomIkkegjelderAFtil0 = new Fastsatt(); | ||
|
||
if (bgpsa != null) { | ||
Specification<BeregningsgrunnlagPeriode> fastsettAndelerForArbeidsforhold = rs.beregningsRegel( | ||
FastsettAndelForArbeidsforholdUtenFordeling.ID, | ||
FastsettAndelForArbeidsforholdUtenFordeling.BESKRIVELSE, | ||
new FastsettAndelForArbeidsforholdUtenFordeling(), | ||
new Fastsatt()); | ||
|
||
//FP_BR_29.8.3 Avkort alle beregningsgrunnlagsandeler som ikke gjelder arbeidsforhold til 0 | ||
avkortAndelerSomIkkegjelderAFtil0 = rs.beregningsRegel( | ||
AvkortBGAndelerSomIkkeGjelderArbeidsforholdTil0.ID, | ||
AvkortBGAndelerSomIkkeGjelderArbeidsforholdTil0.BESKRIVELSE, | ||
new AvkortBGAndelerSomIkkeGjelderArbeidsforholdTil0(), | ||
fastsettAndelerForArbeidsforhold); | ||
} | ||
|
||
//FP_BR_29.8.2 Er totalt BG for beregningsgrunnlagsandeler fra arbeidsforhold > 6G? | ||
Specification<BeregningsgrunnlagPeriode> erTotaltBGFraArbeidforholdStørreEnn6G = rs.beregningHvisRegel(new SjekkOmTotaltBGForArbeidsforholdStørreEnnGrenseverdi(), | ||
avkortAndelerSomIkkegjelderAFtil0, avkortAndelerAndelsmessigOgFastsettBrukersAndel); | ||
|
||
|
||
return erTotaltBGFraArbeidforholdStørreEnn6G; | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...main/java/no/nav/folketrygdloven/beregningsgrunnlag/grenseverdi/RegelFinnGrenseverdi.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,38 @@ | ||
package no.nav.folketrygdloven.beregningsgrunnlag.grenseverdi; | ||
|
||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.BeregningsgrunnlagPeriode; | ||
import no.nav.folketrygdloven.regelmodelloversetter.EksportRegel; | ||
import no.nav.fpsak.nare.Ruleset; | ||
import no.nav.fpsak.nare.evaluation.Evaluation; | ||
import no.nav.fpsak.nare.specification.Specification; | ||
|
||
public class RegelFinnGrenseverdi implements EksportRegel<BeregningsgrunnlagPeriode> { | ||
|
||
public static final String ID = "FP_BR_29"; | ||
|
||
private BeregningsgrunnlagPeriode regelmodell; | ||
|
||
public RegelFinnGrenseverdi(BeregningsgrunnlagPeriode regelmodell) { | ||
this.regelmodell = regelmodell; | ||
} | ||
|
||
@Override | ||
public Evaluation evaluer(BeregningsgrunnlagPeriode regelmodell) { | ||
return getSpecification().evaluate(regelmodell); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Specification<BeregningsgrunnlagPeriode> getSpecification() { | ||
Ruleset<BeregningsgrunnlagPeriode> rs = new Ruleset<>(); | ||
|
||
|
||
// FP_BR_29.1 Skal finne grenseverdi uten å ta hensyn til fordeling? | ||
Specification<BeregningsgrunnlagPeriode> skalfinneGrenseverdiUtenFordeling = rs.beregningHvisRegel( | ||
new SkalFinneGrenseverdiUtenFordeling(), | ||
new RegelFinnGrenseverdiUtenFordeling(regelmodell).getSpecification(), | ||
new RegelFinnGrenseverdiMedFordeling(regelmodell).getSpecification()); | ||
|
||
return skalfinneGrenseverdiUtenFordeling; | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
...nav/folketrygdloven/beregningsgrunnlag/grenseverdi/RegelFinnGrenseverdiUtenFordeling.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,57 @@ | ||
package no.nav.folketrygdloven.beregningsgrunnlag.grenseverdi; | ||
|
||
import no.nav.folketrygdloven.beregningsgrunnlag.fastsette.SjekkBeregningsgrunnlagStørreEnnGrenseverdi; | ||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.BeregningsgrunnlagPeriode; | ||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.Fastsatt; | ||
import no.nav.folketrygdloven.regelmodelloversetter.EksportRegel; | ||
import no.nav.fpsak.nare.Ruleset; | ||
import no.nav.fpsak.nare.evaluation.Evaluation; | ||
import no.nav.fpsak.nare.specification.Specification; | ||
|
||
public class RegelFinnGrenseverdiUtenFordeling implements EksportRegel<BeregningsgrunnlagPeriode> { | ||
|
||
public static final String ID = "FP_BR_29_uten_fordeling"; | ||
|
||
private BeregningsgrunnlagPeriode regelmodell; | ||
|
||
public RegelFinnGrenseverdiUtenFordeling(BeregningsgrunnlagPeriode regelmodell) { | ||
this.regelmodell = regelmodell; | ||
} | ||
|
||
@Override | ||
public Evaluation evaluer(BeregningsgrunnlagPeriode regelmodell) { | ||
return getSpecification().evaluate(regelmodell); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Specification<BeregningsgrunnlagPeriode> getSpecification() { | ||
Ruleset<BeregningsgrunnlagPeriode> rs = new Ruleset<>(); | ||
|
||
// Fastsett grenseverdi for fastsetting av beregningsgrunnlag | ||
Specification<BeregningsgrunnlagPeriode> fastsettGrenseverdi = rs.beregningsRegel(FinnGrenseverdiUtenFordeling.ID, FinnGrenseverdiUtenFordeling.BESKRIVELSE, | ||
new FinnGrenseverdiUtenFordeling(), new Fastsatt()); | ||
|
||
// Fastsett avkortet BG | ||
Specification<BeregningsgrunnlagPeriode> fastsettAvkortet = rs.beregningsRegel( | ||
RegelFastsettAndelBGOver6GUtenFordeling.ID, | ||
RegelFastsettAndelBGOver6GUtenFordeling.BESKRIVELSE, | ||
new RegelFastsettAndelBGOver6GUtenFordeling(regelmodell).getSpecification(), | ||
fastsettGrenseverdi); | ||
|
||
// Fastsett uten avkorting | ||
Specification<BeregningsgrunnlagPeriode> fastsettUtenAvkorting = rs.beregningsRegel( | ||
"FP_BR_29.6_uten_fordeling", | ||
"Fastsett BG uten avkorting", | ||
new FastsettAndelLikBruttoBGUtenFordeling(), | ||
fastsettGrenseverdi); | ||
|
||
// FP_BR_29.4 4. Brutto beregnings-grunnlag totalt > 6G? | ||
Specification<BeregningsgrunnlagPeriode> beregnEventuellAvkorting = rs.beregningHvisRegel( | ||
new SjekkBeregningsgrunnlagStørreEnnGrenseverdi(), | ||
fastsettAvkortet, | ||
fastsettUtenAvkorting); | ||
|
||
return beregnEventuellAvkorting; | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
...nav/folketrygdloven/beregningsgrunnlag/grenseverdi/SkalFinneGrenseverdiUtenFordeling.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,40 @@ | ||
package no.nav.folketrygdloven.beregningsgrunnlag.grenseverdi; | ||
|
||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.fastsett.BeregningsgrunnlagPeriode; | ||
import no.nav.folketrygdloven.beregningsgrunnlag.regelmodell.ytelse.psb.PleiepengerGrunnlagFastsettGrenseverdi; | ||
import no.nav.fpsak.nare.doc.RuleDocumentation; | ||
import no.nav.fpsak.nare.evaluation.Evaluation; | ||
import no.nav.fpsak.nare.evaluation.node.SingleEvaluation; | ||
import no.nav.fpsak.nare.specification.LeafSpecification; | ||
|
||
@RuleDocumentation(SkalFinneGrenseverdiUtenFordeling.ID) | ||
public class SkalFinneGrenseverdiUtenFordeling extends LeafSpecification<BeregningsgrunnlagPeriode> { | ||
|
||
public static final String ID = "FP_BR_29.1"; | ||
public static final String BESKRIVELSE = "Skal finne grenseverdi uten å ta hensyn til fordeling?"; | ||
|
||
public SkalFinneGrenseverdiUtenFordeling() { | ||
super(ID, BESKRIVELSE); | ||
} | ||
|
||
@Override | ||
public Evaluation evaluate(BeregningsgrunnlagPeriode grunnlag) { | ||
|
||
if (!grunnlag.getBeregningsgrunnlag().getToggles().isEnabled("GRADERING_MOT_INNTEKT")) { | ||
return nei(); | ||
} | ||
|
||
var ytelsesSpesifiktGrunnlag = grunnlag.getBeregningsgrunnlag().getYtelsesSpesifiktGrunnlag(); | ||
|
||
if (ytelsesSpesifiktGrunnlag instanceof PleiepengerGrunnlagFastsettGrenseverdi pleiepengergrunnlag) { | ||
var startdatoNyeGraderingsregler = pleiepengergrunnlag.getStartdatoNyeGraderingsregler(); | ||
SingleEvaluation resultat = startdatoNyeGraderingsregler == null || grunnlag.getPeriodeFom().isBefore(startdatoNyeGraderingsregler) ? nei() : ja(); | ||
resultat.setEvaluationProperty("startdatoNyeGraderingsregler", startdatoNyeGraderingsregler); | ||
resultat.setEvaluationProperty("periodeFom", grunnlag.getPeriodeFom()); | ||
return resultat; | ||
} else { | ||
return nei(); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.