Skip to content

Commit

Permalink
Bruk mer forståelig funksjonsnavn
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerga committed Jan 10, 2025
1 parent 6abf3cc commit bf3ad3f
Show file tree
Hide file tree
Showing 35 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class HentArbeidsforholdRiver(
)
}

override fun HentArbeidsforholdMelding.skrivNoekkel(): KafkaKey? = svarKafkaKey
override fun HentArbeidsforholdMelding.bestemNoekkel(): KafkaKey? = svarKafkaKey

override fun HentArbeidsforholdMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val arbeidsforhold =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AltinnRiver(
)
}

override fun Melding.skrivNoekkel(): KafkaKey? = svarKafkaKey
override fun Melding.bestemNoekkel(): KafkaKey? = svarKafkaKey

override fun Melding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val rettigheterForenklet =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TilgangRiver(
)
}

override fun TilgangMelding.skrivNoekkel(): KafkaKey = KafkaKey(fnr)
override fun TilgangMelding.bestemNoekkel(): KafkaKey = KafkaKey(fnr)

override fun TilgangMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val harTilgang =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class HentEksternImRiver(
)
}

override fun HentEksternImMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun HentEksternImMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun HentEksternImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
logger.info("Henter ekstern inntektsmelding med ID '$spinnImId' fra Spinn.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class HentVirksomhetNavnRiver(
)
}

override fun HentVirksomhetMelding.skrivNoekkel(): KafkaKey? = svarKafkaKey
override fun HentVirksomhetMelding.bestemNoekkel(): KafkaKey? = svarKafkaKey

override fun HentVirksomhetMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val orgnrMedNavn =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class HentLagretImRiver(
)
}

override fun HentLagretImMelding.skrivNoekkel(): KafkaKey? = svarKafkaKey
override fun HentLagretImMelding.bestemNoekkel(): KafkaKey? = svarKafkaKey

override fun HentLagretImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class HentSelvbestemtImRiver(
)
}

override fun HentSelvbestemtImMelding.skrivNoekkel(): KafkaKey = KafkaKey(selvbestemtId)
override fun HentSelvbestemtImMelding.bestemNoekkel(): KafkaKey = KafkaKey(selvbestemtId)

override fun HentSelvbestemtImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
"Skal hente selvbestemt inntektsmelding.".also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LagreEksternImRiver(
)
}

override fun LagreEksternImMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun LagreEksternImMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun LagreEksternImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
imRepo.lagreEksternInntektsmelding(forespoerselId, eksternInntektsmelding)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LagreImRiver(
)
}

override fun LagreImMelding.skrivNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)
override fun LagreImMelding.bestemNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)

override fun LagreImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val inntektsmeldingGammeltFormat = inntektsmelding.convert()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class LagreImSkjemaRiver(
)
}

override fun LagreImSkjemaMelding.skrivNoekkel(): KafkaKey = KafkaKey(skjema.forespoerselId)
override fun LagreImSkjemaMelding.bestemNoekkel(): KafkaKey = KafkaKey(skjema.forespoerselId)

override fun LagreImSkjemaMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val sisteImSkjema = repository.hentNyesteInntektsmeldingSkjema(skjema.forespoerselId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LagreJournalpostIdRiver(
)
}

override fun LagreJournalpostIdMelding.skrivNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)
override fun LagreJournalpostIdMelding.bestemNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)

override fun LagreJournalpostIdMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
logger.info("Mottok melding.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class LagreSelvbestemtImRiver(
)
}

override fun LagreSelvbestemtImMelding.skrivNoekkel(): KafkaKey = KafkaKey(selvbestemtInntektsmelding.type.id)
override fun LagreSelvbestemtImMelding.bestemNoekkel(): KafkaKey = KafkaKey(selvbestemtInntektsmelding.type.id)

override fun LagreSelvbestemtImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
"Skal lagre selvbestemt inntektsmelding.".also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DistribusjonRiver(
)
}

override fun Melding.skrivNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)
override fun Melding.bestemNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)

override fun Melding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
"Forsøker å distribuere IM med journalpost-ID '$journalpostId'.".also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class FeilLytter(
)

// Riveren publiserer ikke via ObjectRiver, så denne nøkkelen blir ikke brukt
override fun Melding.skrivNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())
override fun Melding.bestemNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())

override fun Melding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
logger.info("Mottok feil.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import no.nav.helsearbeidsgiver.utils.log.sikkerLogger
* height = Key.HEIGHT.lesOrNull(Int.serializer(), json)
* )
*
* override fun LotrCharacter.skrivNoekkel(): KafkaKey = KafkaKey(name)
* override fun LotrCharacter.bestemNoekkel(): KafkaKey = KafkaKey(name)
*
* override fun LotrCharacter.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
* val favouriteFood = when (name) {
Expand Down Expand Up @@ -103,7 +103,7 @@ abstract class ObjectRiver<Melding : Any> {
* Nøkkel som utgående melding sendes sammen med.
* Meldinger sendt med samme nøkkel vil opprettholde rekkefølgen mellom dem (og konsumeres av samme pod).
*/
protected abstract fun Melding.skrivNoekkel(): KafkaKey?
protected abstract fun Melding.bestemNoekkel(): KafkaKey?

/**
* Riverens hovedfunksjon. Agerer på innkommende melding.
Expand Down Expand Up @@ -162,7 +162,7 @@ abstract class ObjectRiver<Melding : Any> {
} else {
val key =
runCatching {
innkommende.skrivNoekkel()
innkommende.bestemNoekkel()
}.getOrElse { e ->
"Klarte ikke lage Kafka-nøkkel.".also {
logger.error(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class PriObjectRiver<Melding : Any> {

protected abstract fun les(json: Map<Pri.Key, JsonElement>): Melding?

protected abstract fun Melding.skrivNoekkel(): KafkaKey?
protected abstract fun Melding.bestemNoekkel(): KafkaKey?

protected abstract fun Melding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement>?

Expand Down Expand Up @@ -62,7 +62,7 @@ abstract class PriObjectRiver<Melding : Any> {
} else {
val key =
runCatching {
innkommende.skrivNoekkel()
innkommende.bestemNoekkel()
}.getOrElse { e ->
"Klarte ikke lage Kafka-nøkkel.".also {
logger.error(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ sealed class ServiceRiver : ObjectRiver<ServiceMelding>() {
}

// Servicer publiserer ikke via ObjectRiver, så denne nøkkelen blir ikke brukt
final override fun ServiceMelding.skrivNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())
final override fun ServiceMelding.bestemNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())

final override fun ServiceMelding.haandterFeil(
json: Map<Key, JsonElement>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ForespoerselBesvartRiver : PriObjectRiver<BesvartMelding>() {
spinnInntektsmeldingId = Pri.Key.SPINN_INNTEKTSMELDING_ID.lesOrNull(UuidSerializer, json),
)

override fun BesvartMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun BesvartMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun BesvartMelding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok melding på pri-topic om ${Pri.NotisType.FORESPOERSEL_BESVART}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ForespoerselForkastetRiver : PriObjectRiver<ForkastetMelding>() {
forespoerselId = Pri.Key.FORESPOERSEL_ID.les(UuidSerializer, json),
)

override fun ForkastetMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun ForkastetMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun ForkastetMelding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok melding på pri-topic om ${Pri.NotisType.FORESPOERSEL_FORKASTET}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ForespoerselKastetTilInfotrygdRiver : PriObjectRiver<KastetTilInfotrygdMel
forespoerselId = Pri.Key.FORESPOERSEL_ID.les(UuidSerializer, json),
)

override fun KastetTilInfotrygdMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun KastetTilInfotrygdMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun KastetTilInfotrygdMelding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok melding på pri-topic om ${Pri.NotisType.FORESPOERSEL_KASTET_TIL_INFOTRYGD}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MarkerForespoerselBesvartRiver(
)
}

override fun Melding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun Melding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun Melding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
logger.info("Mottok melding om ${EventName.INNTEKTSMELDING_MOTTATT}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ForespoerselMottattRiver : PriObjectRiver<Melding>() {
skalHaPaaminnelse = Pri.Key.SKAL_HA_PAAMINNELSE.les(Boolean.serializer(), json),
)

override fun Melding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun Melding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun Melding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok melding på pri-topic om ${Pri.NotisType.FORESPØRSEL_MOTTATT}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ForespoerselSvarRiver : PriObjectRiver<ForespoerselSvarMelding>() {
)
}

override fun ForespoerselSvarMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselSvar.forespoerselId)
override fun ForespoerselSvarMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselSvar.forespoerselId)

override fun ForespoerselSvarMelding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok løsning på pri-topic om $behovType.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class HentForespoerslerForVedtaksperiodeIdListeRiver(
}

// Vi har ingen gode alternativer til Kafka-nøkkel, men det er heller ikke nøye her, så det holder med en tilfeldig verdi
override fun HentForespoerslerForVedtaksperiodeIdListeMelding.skrivNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())
override fun HentForespoerslerForVedtaksperiodeIdListeMelding.bestemNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())

override fun HentForespoerslerForVedtaksperiodeIdListeMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
priProducer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TrengerForespoerselRiver(
)
}

override fun TrengerForespoerselMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun TrengerForespoerselMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun TrengerForespoerselMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
priProducer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class VedtaksperiodeIdForespoerselSvarRiver : PriObjectRiver<VedtaksperiodeIdFor
}

// Vi har ingen gode alternativer til Kafka-nøkkel, men det er heller ikke nøye her, så det holder med en tilfeldig verdi
override fun VedtaksperiodeIdForespoerselSvarMelding.skrivNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())
override fun VedtaksperiodeIdForespoerselSvarMelding.bestemNoekkel(): KafkaKey = KafkaKey(UUID.randomUUID())

override fun VedtaksperiodeIdForespoerselSvarMelding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok løsning på pri-topic om $behovType.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class HentInntektRiver(
)
}

override fun Melding.skrivNoekkel(): KafkaKey? = svarKafkaKey
override fun Melding.bestemNoekkel(): KafkaKey? = svarKafkaKey

override fun Melding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val fom = inntektsdato.minusMaaneder(3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class JournalfoerImRiver(
}
}

override fun JournalfoerImMelding.skrivNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)
override fun JournalfoerImMelding.bestemNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)

override fun JournalfoerImMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
"Mottok melding med event '$eventName'.".also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class EndrePaaminnelseRiver(
)
}

override fun EndrePaaminnelseMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun EndrePaaminnelseMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun EndrePaaminnelseMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
endreOppgavePaaminnelser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FerdigstillForespoerselSakOgOppgaveRiver(
}
}

override fun FerdigstillForespoerselSakMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun FerdigstillForespoerselSakMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun FerdigstillForespoerselSakMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val lenke = NotifikasjonTekst.lenkeFerdigstiltForespoersel(linkUrl, forespoerselId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FjernPaaminnelseRiver(
)
}

override fun FjernPaaminnelseMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun FjernPaaminnelseMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun FjernPaaminnelseMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement>? {
if (paaminnelseToggle.oppgavePaaminnelseAktivert) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OpprettForespoerselSakOgOppgaveRiver(
)
}

override fun OpprettForespoerselSakOgOppgaveMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun OpprettForespoerselSakOgOppgaveMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun OpprettForespoerselSakOgOppgaveMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val lenke = NotifikasjonTekst.lenkeAktivForespoersel(lenkeBaseUrl, forespoerselId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class OpprettSelvbestemtSakRiver(
)
}

override fun OpprettSelvbestemtSakMelding.skrivNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)
override fun OpprettSelvbestemtSakMelding.bestemNoekkel(): KafkaKey = KafkaKey(inntektsmelding.type.id)

override fun OpprettSelvbestemtSakMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
val sakId =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class UtgaattForespoerselRiver(
}
}

override fun UtgaattForespoerselMelding.skrivNoekkel(): KafkaKey = KafkaKey(forespoerselId)
override fun UtgaattForespoerselMelding.bestemNoekkel(): KafkaKey = KafkaKey(forespoerselId)

override fun UtgaattForespoerselMelding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
logger.info("Mottok melding med event '$eventName'.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class HentPersonerRiver(
)
}

override fun Melding.skrivNoekkel(): KafkaKey? = svarKafkaKey
override fun Melding.bestemNoekkel(): KafkaKey? = svarKafkaKey

override fun Melding.haandter(json: Map<Key, JsonElement>): Map<Key, JsonElement> {
"Henter navn for ${fnrListe.size} personer.".also {
Expand Down

0 comments on commit bf3ad3f

Please sign in to comment.