-
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.
Omdøpt tilstander til henholdsvis BekreftelseTilstand og PaaVegneAvTi…
…lstand, skrevet om fra ansvar til bekreftelsePaaVegneAv gjennomgående, oppdatert tester til å reflektere navnendringene. Fikset feilende tester i IngenStarterBekreftelsePaaVegneAvTest
- Loading branch information
1 parent
79e6bc6
commit 8c8a5c2
Showing
23 changed files
with
252 additions
and
245 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
60 changes: 37 additions & 23 deletions
60
...e-tjeneste/src/main/kotlin/no/nav/paw/bekreftelsetjeneste/tilstand/BekreftelseTilstand.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 |
---|---|---|
@@ -1,29 +1,43 @@ | ||
package no.nav.paw.bekreftelsetjeneste.tilstand | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo | ||
import java.time.Instant | ||
import no.nav.paw.arbeidssokerregisteret.api.v1.Periode | ||
|
||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.PROPERTY, | ||
property = "type" | ||
) | ||
@JsonSubTypes( | ||
JsonSubTypes.Type(value = IkkeKlarForUtfylling::class, name = "IkkeKlarForUtfylling"), | ||
JsonSubTypes.Type(value = KlarForUtfylling::class, name = "KlarForUtfylling"), | ||
JsonSubTypes.Type(value = VenterSvar::class, name = "VenterSvar"), | ||
JsonSubTypes.Type(value = GracePeriodeUtloept::class, name = "GracePeriodeUtloept"), | ||
JsonSubTypes.Type(value = Levert::class, name = "Levert") | ||
const val MAKS_ANTALL_HISTRISKE_BEKREFTELSER = 20 | ||
|
||
@JvmRecord | ||
data class BekreftelseTilstand( | ||
val periode: PeriodeInfo, | ||
val bekreftelser: List<Bekreftelse> | ||
) | ||
sealed interface BekreftelseTilstand { | ||
val timestamp: Instant | ||
|
||
fun opprettBekreftelseTilstand( | ||
id: Long, | ||
key: Long, | ||
periode: Periode, | ||
): BekreftelseTilstand = | ||
BekreftelseTilstand( | ||
periode = PeriodeInfo( | ||
periodeId = periode.id, | ||
identitetsnummer = periode.identitetsnummer, | ||
arbeidsoekerId = id, | ||
recordKey = key, | ||
startet = periode.startet.tidspunkt, | ||
avsluttet = periode.avsluttet?.tidspunkt | ||
), | ||
bekreftelser = emptyList() | ||
) | ||
|
||
fun BekreftelseTilstand.oppdaterBekreftelse(ny: Bekreftelse): BekreftelseTilstand { | ||
val nyBekreftelser = bekreftelser.map { | ||
if (it.bekreftelseId == ny.bekreftelseId) ny else it | ||
} | ||
return copy(bekreftelser = nyBekreftelser) | ||
} | ||
|
||
fun BekreftelseTilstand.leggTilNyEllerOppdaterBekreftelse(ny: Bekreftelse): BekreftelseTilstand { | ||
val nyBekreftelser = bekreftelser | ||
.filter { it.bekreftelseId != ny.bekreftelseId } | ||
.plus(ny) | ||
return copy(bekreftelser = nyBekreftelser) | ||
} | ||
|
||
data class GracePeriodeUtloept(override val timestamp: Instant) : BekreftelseTilstand | ||
data class GracePeriodeVarselet(override val timestamp: Instant) : BekreftelseTilstand | ||
data class IkkeKlarForUtfylling(override val timestamp: Instant) : BekreftelseTilstand | ||
data class KlarForUtfylling(override val timestamp: Instant) : BekreftelseTilstand | ||
data class Levert(override val timestamp: Instant) : BekreftelseTilstand | ||
data class VenterSvar(override val timestamp: Instant) : BekreftelseTilstand | ||
data class InternBekreftelsePaaVegneAvStartet(override val timestamp: Instant) : BekreftelseTilstand |
29 changes: 29 additions & 0 deletions
29
...este/src/main/kotlin/no/nav/paw/bekreftelsetjeneste/tilstand/BekreftelseTilstandStatus.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,29 @@ | ||
package no.nav.paw.bekreftelsetjeneste.tilstand | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo | ||
import java.time.Instant | ||
|
||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.PROPERTY, | ||
property = "type" | ||
) | ||
@JsonSubTypes( | ||
JsonSubTypes.Type(value = IkkeKlarForUtfylling::class, name = "IkkeKlarForUtfylling"), | ||
JsonSubTypes.Type(value = KlarForUtfylling::class, name = "KlarForUtfylling"), | ||
JsonSubTypes.Type(value = VenterSvar::class, name = "VenterSvar"), | ||
JsonSubTypes.Type(value = GracePeriodeUtloept::class, name = "GracePeriodeUtloept"), | ||
JsonSubTypes.Type(value = Levert::class, name = "Levert"), | ||
) | ||
sealed interface BekreftelseTilstandStatus { | ||
val timestamp: Instant | ||
} | ||
|
||
data class GracePeriodeUtloept(override val timestamp: Instant) : BekreftelseTilstandStatus | ||
data class GracePeriodeVarselet(override val timestamp: Instant) : BekreftelseTilstandStatus | ||
data class IkkeKlarForUtfylling(override val timestamp: Instant) : BekreftelseTilstandStatus | ||
data class KlarForUtfylling(override val timestamp: Instant) : BekreftelseTilstandStatus | ||
data class Levert(override val timestamp: Instant) : BekreftelseTilstandStatus | ||
data class VenterSvar(override val timestamp: Instant) : BekreftelseTilstandStatus | ||
data class InternBekreftelsePaaVegneAvStartet(override val timestamp: Instant) : BekreftelseTilstandStatus |
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.