-
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.
Merge pull request #346 from statisticsnorway/bugfix_testperiode
Bugfix testperiode #3
- Loading branch information
Showing
26 changed files
with
517 additions
and
92 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
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
27 changes: 27 additions & 0 deletions
27
...roller/src/main/kotlin/no/ssb/kostra/validation/rule/barnevern/individrule/Flytting02c.kt
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,27 @@ | ||
package no.ssb.kostra.validation.rule.barnevern.individrule | ||
|
||
import no.ssb.kostra.barnevern.xsd.KostraIndividType | ||
import no.ssb.kostra.program.KotlinArguments | ||
import no.ssb.kostra.validation.report.Severity | ||
import no.ssb.kostra.validation.rule.AbstractRule | ||
import no.ssb.kostra.validation.rule.barnevern.IndividRuleId | ||
|
||
class Flytting02c : AbstractRule<KostraIndividType>( | ||
ruleName = IndividRuleId.FLYTTING_02C.title, | ||
severity = Severity.ERROR | ||
) { | ||
override fun validate(context: KostraIndividType, arguments: KotlinArguments) = context | ||
.takeIf { it.sluttDato != null } | ||
?.let { innerContext -> | ||
innerContext.flytting | ||
.filter { it.sluttDato.isAfter(context.sluttDato) } | ||
.map { flytting -> | ||
createValidationReportEntry( | ||
contextId = flytting.id, | ||
messageText = "Flytting (${flytting.id}). Sluttdato (${flytting.sluttDato}) er " + | ||
"etter individets sluttdato (${context.sluttDato})" | ||
) | ||
} | ||
.ifEmpty { null } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...roller/src/main/kotlin/no/ssb/kostra/validation/rule/barnevern/individrule/Flytting02f.kt
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,23 @@ | ||
package no.ssb.kostra.validation.rule.barnevern.individrule | ||
|
||
import no.ssb.kostra.barnevern.xsd.KostraIndividType | ||
import no.ssb.kostra.program.KotlinArguments | ||
import no.ssb.kostra.validation.report.Severity | ||
import no.ssb.kostra.validation.rule.AbstractRule | ||
import no.ssb.kostra.validation.rule.barnevern.IndividRuleId | ||
|
||
class Flytting02f : AbstractRule<KostraIndividType>( | ||
ruleName = IndividRuleId.FLYTTING_02F.title, | ||
severity = Severity.ERROR | ||
) { | ||
override fun validate(context: KostraIndividType, arguments: KotlinArguments) = context.flytting | ||
.filter { it.sluttDato.isBefore(context.startDato) } | ||
.map { flytting -> | ||
createValidationReportEntry( | ||
contextId = flytting.id, | ||
messageText = "Flytting (${flytting.id}). Sluttdato (${flytting.sluttDato}) er " + | ||
"før individets startdato (${context.startDato})" | ||
) | ||
} | ||
.ifEmpty { null } | ||
} |
45 changes: 45 additions & 0 deletions
45
kontroller/src/main/kotlin/no/ssb/kostra/validation/rule/barnevern/individrule/Tiltak24.kt
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,45 @@ | ||
package no.ssb.kostra.validation.rule.barnevern.individrule | ||
|
||
import no.ssb.kostra.barnevern.xsd.KostraIndividType | ||
import no.ssb.kostra.program.KotlinArguments | ||
import no.ssb.kostra.validation.report.Severity | ||
import no.ssb.kostra.validation.rule.AbstractRule | ||
import no.ssb.kostra.validation.rule.barnevern.IndividRuleId | ||
import no.ssb.kostra.validation.rule.barnevern.SharedValidationConstants.BVL1992 | ||
import no.ssb.kostra.validation.rule.barnevern.SharedValidationConstants.BVL2021 | ||
import java.time.LocalDate | ||
|
||
class Tiltak24 : AbstractRule<KostraIndividType>( | ||
ruleName = IndividRuleId.TILTAK_24.title, | ||
severity = Severity.ERROR | ||
) { | ||
override fun validate(context: KostraIndividType, arguments: KotlinArguments) = context.tiltak | ||
.mapNotNull { tiltak -> | ||
val bvlThresholdDate: LocalDate = LocalDate.of(2022, 12, 31) | ||
|
||
when { | ||
tiltak.startDato.isBefore(bvlThresholdDate.plusDays(1)) | ||
&& (tiltak.lovhjemmel.lov != BVL1992 || tiltak.jmfrLovhjemmel.any { it.lov != BVL1992 }) -> | ||
createValidationReportEntry( | ||
contextId = tiltak.id, | ||
messageText = "Tiltak (${tiltak.id}). " + | ||
"Tiltak opprettet før 01.01.2023 krever lov = '$BVL1992'" | ||
) | ||
|
||
tiltak.startDato.isAfter(bvlThresholdDate) | ||
&& ( | ||
tiltak.lovhjemmel.lov !in listOf(BVL1992, BVL2021) | ||
|| tiltak.jmfrLovhjemmel.all { it.lov !in listOf(BVL1992, BVL2021) } | ||
) -> | ||
createValidationReportEntry( | ||
contextId = tiltak.id, | ||
messageText = "Tiltak (${tiltak.id}). " + | ||
"Tiltak opprettet 01.01.2023 eller etter, krever lov = '$BVL1992' eller '$BVL2021'" | ||
|
||
) | ||
|
||
else -> null | ||
} | ||
} | ||
.ifEmpty { null } | ||
} |
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
Oops, something went wrong.