From 54414bbcc2029c1133c0ad438677ab72e589d04e Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Tue, 6 Feb 2024 15:00:09 +0100 Subject: [PATCH 01/19] Refactor Sivilstatus to Sivilstand in TenorRequest --- .../nav/testnav/apps/tenorsearchservice/domain/Lookups.java | 2 +- .../testnav/apps/tenorsearchservice/domain/TenorRequest.java | 4 ++-- .../apps/tenorsearchservice/service/TenorSearchService.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/Lookups.java b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/Lookups.java index 9f16415d68a..4f5d9e8fd3e 100644 --- a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/Lookups.java +++ b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/Lookups.java @@ -24,7 +24,7 @@ public enum Lookups { Relasjon(TenorRequest.Relasjon.class), Roller(TenorRequest.Rolle.class), SaerskiltSkatteplikt(TenorRequest.SaerskiltSkatteplikt.class), - Sivilstatus(TenorRequest.Sivilstatus.class), + Sivilstatus(TenorRequest.Sivilstand.class), Skattemeldingstype(TenorRequest.Skattemeldingstype.class), Skattepliktstype(TenorRequest.Skattepliktstype.class), Spesifiseringstype(no.nav.testnav.apps.tenorsearchservice.domain.Spesifiseringstype.class), diff --git a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/TenorRequest.java b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/TenorRequest.java index d21055d75a5..0415704b80a 100644 --- a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/TenorRequest.java +++ b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/domain/TenorRequest.java @@ -24,7 +24,7 @@ public enum Rolle {DagligLeder} public enum Personstatus {Bosatt, Doed, Forsvunnet, Foedselsregistrert, IkkeBosatt, Inaktiv, Midlertidig, Opphoert, Utflyttet} - public enum Sivilstatus {EnkeEllerEnkemann, Gift, GjenlevendePartner, RegistrertPartner, Separert, SeparertPartner, Skilt, SkiltPartner, Ugift, Uoppgitt} + public enum Sivilstand {EnkeEllerEnkemann, Gift, GjenlevendePartner, RegistrertPartner, Separert, SeparertPartner, Skilt, SkiltPartner, Ugift, Uoppgitt} public enum UtenlandskPersonIdentifikasjon {UtenlandskIdentifikasjonsnummer, TaxIdentificationNumber, SocialSecurityNumber, UtlendingsmyndighetenesIdentifikasjonsnummer} @@ -83,7 +83,7 @@ public enum Stadietype {Utkast, Fastsatt, Oppgjoer} private DatoIntervall doedsdato; private Kjoenn kjoenn; private Personstatus personstatus; - private Sivilstatus sivilstatus; + private Sivilstand sivilstand; private List utenlandskPersonIdentifikasjon; private IdentitetsgrunnlagStatus identitetsgrunnlagStatus; private Adressebeskyttelse adressebeskyttelse; diff --git a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/service/TenorSearchService.java b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/service/TenorSearchService.java index 389a0d17c53..e4dad541063 100644 --- a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/service/TenorSearchService.java +++ b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/service/TenorSearchService.java @@ -54,7 +54,7 @@ private String getQuery(TenorRequest searchData) { .append(convertEnum("identifikatorType", searchData.getIdentifikatorType())) .append(convertEnum("kjoenn", searchData.getKjoenn())) .append(convertEnum("personstatus", searchData.getPersonstatus())) - .append(convertEnum("sivilstatus", searchData.getSivilstatus())) + .append(convertEnum("sivilstand", searchData.getSivilstand())) .append(getUtenlandskPersonidentifikasjon(searchData.getUtenlandskPersonIdentifikasjon())) .append(convertEnum("identitetsgrunnlagStatus", searchData.getIdentitetsgrunnlagStatus())) .append(convertEnum("adresseBeskyttelse", searchData.getAdressebeskyttelse())) From 901ab6b3d41586fd8d647a7aa4b5a6b295229b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristen=20H=C3=A6rum?= Date: Tue, 6 Feb 2024 15:10:29 +0100 Subject: [PATCH 02/19] =?UTF-8?q?Refactor=20Inntektsmelding=20generation?= =?UTF-8?q?=20code=20#deploy-inntektsmelding-gene=E2=80=A6=20(#3409)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Oppdatering, refaktorert generering av XML, lagt til mere logging --- .../InntektsmeldingConsumer.java | 4 +- .../domain/InntektsmeldingRequest.java | 91 ++------ .../validation/XML201809Validator.java | 4 +- .../util/XmlConverter.java | 20 ++ .../util/XmlInntektsmelding201809.java | 214 +++++++++++------- .../util/XmlInntektsmelding201812.java | 213 +++++++++-------- .../InntektsmeldingApplicationStarter.java | 2 +- .../controller/InntektsmeldingController.java | 3 +- .../v1/RsInntektsmeldingRequest.java | 23 +- .../v1/rs/RsArbeidsforhold.java | 15 -- .../v1/rs/RsDelvisFravaer.java | 9 - .../v1/rs/RsEndringIRefusjon.java | 9 - .../v1/rs/RsGraderingIForeldrepenger.java | 10 - .../v1/rs/RsInntekt.java | 10 - .../v1/rs/RsInntektsmelding.java | 25 -- .../v1/rs/RsNaturalytelseDetaljer.java | 13 -- .../v1/rs/RsOmsorgspenger.java | 5 - .../v1/rs/RsPeriode.java | 9 - .../v1/rs/RsRefusjon.java | 9 - .../rs/RsSykepengerIArbeidsgiverperioden.java | 13 -- .../v1/rs/RsUtsettelseAvForeldrepenger.java | 10 - .../v1/requests/InntektsmeldingRequest.java | 8 +- 22 files changed, 309 insertions(+), 410 deletions(-) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java index abd53c9f4b8..d37d985ffaa 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java @@ -1,5 +1,6 @@ package no.nav.dolly.bestilling.inntektsmelding; +import io.swagger.v3.core.util.Json; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.ConsumerStatus; import no.nav.dolly.bestilling.inntektsmelding.command.OpprettInntektsmeldingCommand; @@ -42,7 +43,8 @@ public InntektsmeldingConsumer( public Flux postInntektsmelding(InntektsmeldingRequest inntekstsmelding) { var callId = getNavCallId(); - log.info("Inntektsmelding med callId {} sendt", callId); + log.info("Inntektsmelding med ident {} callId {} sendt {}", inntekstsmelding.getArbeidstakerFnr(), callId, + Json.pretty(inntekstsmelding)); return tokenService.exchange(serverProperties) .flatMapMany(token -> new OpprettInntektsmeldingCommand(webClient, diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/InntektsmeldingRequest.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/InntektsmeldingRequest.java index 1c86c049473..c13537d0b0e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/InntektsmeldingRequest.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/InntektsmeldingRequest.java @@ -1,11 +1,9 @@ package no.nav.dolly.bestilling.inntektsmelding.domain; -import com.fasterxml.jackson.annotation.JsonInclude; import lombok.AllArgsConstructor; import lombok.Builder; -import lombok.Getter; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Setter; import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakTilInnsendingType; import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakTilUtsettelseType; import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakVedEndringType; @@ -16,12 +14,10 @@ import java.time.LocalDateTime; import java.util.List; +@Data @Builder -@Getter -@Setter @NoArgsConstructor @AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_NULL) public class InntektsmeldingRequest { public enum Avsendertype {ORGNR, FNR} @@ -31,11 +27,8 @@ public enum Avsendertype {ORGNR, FNR} private List inntekter; private JoarkMetadata joarkMetadata; - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class JoarkMetadata { private Avsendertype avsenderMottakerIdType; @@ -53,11 +46,8 @@ public static class JoarkMetadata { private String variantformatOriginal; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Inntektsmelding { private AarsakTilInnsendingType aarsakTilInnsending; @@ -76,11 +66,8 @@ public static class Inntektsmelding { private String ytelse; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class SykepengerIArbeidsgiverperioden { private List arbeidsgiverperiodeListe; @@ -88,11 +75,8 @@ public static class SykepengerIArbeidsgiverperioden { private Double bruttoUtbetalt; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Refusjon { private List endringIRefusjonListe; @@ -100,22 +84,16 @@ public static class Refusjon { private LocalDate refusjonsopphoersdato; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class EndringIRefusjon { private LocalDate endringsdato; private Double refusjonsbeloepPrMnd; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class NaturalYtelseDetaljer { private Double beloepPrMnd; @@ -123,11 +101,8 @@ public static class NaturalYtelseDetaljer { private NaturalytelseType naturalytelseType; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Omsorgspenger { private List delvisFravaersListe; @@ -135,23 +110,18 @@ public static class Omsorgspenger { private Boolean harUtbetaltPliktigeDager; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class DelvisFravaer { private LocalDate dato; private Double timer; } - @Getter - @Setter + @Data @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Avsendersystem { private LocalDateTime innsendingstidspunkt; @@ -159,45 +129,34 @@ public static class Avsendersystem { private String systemversjon; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Arbeidsgiver { private Kontaktinformasjon kontaktinformasjon; private String virksomhetsnummer; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class ArbeidsgiverPrivat { private Kontaktinformasjon kontaktinformasjon; private String arbeidsgiverFnr; } - @Getter - @Setter + @Data @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Kontaktinformasjon { private String kontaktinformasjonNavn; private String telefonnummer; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Arbeidsforhold { private String arbeidsforholdId; @@ -208,43 +167,31 @@ public static class Arbeidsforhold { private List utsettelseAvForeldrepengerListe; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class UtsettelseAvForeldrepenger { private AarsakTilUtsettelseType aarsakTilUtsettelse; private Periode periode; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class GraderingIForeldrepenger { private Integer arbeidstidprosent; private Periode periode; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class AltinnInntekt { private AarsakVedEndringType aarsakVedEndring; private Double beloep; } - @Getter - @Setter + @Data @NoArgsConstructor - @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Periode { private LocalDate fom; diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/provider/validation/XML201809Validator.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/provider/validation/XML201809Validator.java index 48b2e981f12..3be1a186ccc 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/provider/validation/XML201809Validator.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/provider/validation/XML201809Validator.java @@ -7,6 +7,8 @@ import java.util.List; import java.util.Map; +import static java.util.Objects.isNull; + @Component public class XML201809Validator { @@ -18,7 +20,7 @@ public static void validate(RsInntektsmelding inntektsmelding) throws Validation Map rules = new HashMap<>(); - rules.put("Må ha en arbeidsgiver.", inntektsmelding.getArbeidsgiver().isEmpty()); + rules.put("Må ha en arbeidsgiver.", isNull(inntektsmelding.getArbeidsgiver())); List errors = rules.entrySet().stream() .filter(s -> s.getValue().equals(true)) diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java index 846177ed279..da1e0c21542 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.registre.inntektsmeldinggeneratorservice.exception.JaxbToXmlException; +import org.apache.commons.text.CaseUtils; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; @@ -10,6 +11,10 @@ import javax.xml.bind.Unmarshaller; import java.io.StringReader; import java.io.StringWriter; +import java.math.BigDecimal; +import java.math.BigInteger; + +import static java.util.Objects.nonNull; @Slf4j public class XmlConverter { @@ -62,4 +67,19 @@ private static T toObject(String xml, Class clazz) { throw new JaxbToXmlException("klarte ikke å konvertere Jaxb element til Objekt", e); } } + + public static BigDecimal toBigDecimal(Double value) { + + return nonNull(value) ? BigDecimal.valueOf(value) : null; + } + + public static BigInteger toBigInteger(Integer value) { + + return nonNull(value) ? BigInteger.valueOf(value) : null; + } + + public static String toCamelCase(String value) { + + return nonNull(value) ? CaseUtils.toCamelCase(value, true, '_') : null; + } } diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java index 0f03d4cceae..1bf55d14da7 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java @@ -1,5 +1,19 @@ package no.nav.registre.inntektsmeldinggeneratorservice.util; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsforhold; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsgiver; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsAvsendersystem; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsDelvisFravaer; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsEndringIRefusjon; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsGraderingIForeldrepenger; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntekt; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntektsmelding; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsNaturalytelseDetaljer; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsOmsorgspenger; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsPeriode; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsRefusjon; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsSykepengerIArbeidsgiverperioden; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsUtsettelseAvForeldrepenger; import no.seres.xsd.nav.inntektsmelding_m._20180924.XMLArbeidsforhold; import no.seres.xsd.nav.inntektsmelding_m._20180924.XMLArbeidsgiver; import no.seres.xsd.nav.inntektsmelding_m._20180924.XMLArbeidsgiverperiodeListe; @@ -37,23 +51,11 @@ import java.time.LocalDateTime; import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsforhold; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsgiver; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsAvsendersystem; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsDelvisFravaer; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsEndringIRefusjon; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsGraderingIForeldrepenger; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntekt; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntektsmelding; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsNaturalytelseDetaljer; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsOmsorgspenger; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsPeriode; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsRefusjon; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsSykepengerIArbeidsgiverperioden; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsUtsettelseAvForeldrepenger; +import static java.util.Objects.isNull; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigDecimal; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigInteger; public class XmlInntektsmelding201809 { @@ -66,7 +68,7 @@ public static XMLInntektsmeldingM createInntektsmelding(RsInntektsmelding meldin return new XMLInntektsmeldingM(new XMLSkjemainnhold( melding.getYtelse(), melding.getAarsakTilInnsending(), - createArbeidsgiver(melding.getArbeidsgiver().orElse(null)), + createArbeidsgiver(melding.getArbeidsgiver()), melding.getArbeidstakerFnr(), melding.isNaerRelasjon(), new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforhold"), @@ -74,12 +76,12 @@ public static XMLInntektsmeldingM createInntektsmelding(RsInntektsmelding meldin createArbeidsforhold(melding.getArbeidsforhold())), new JAXBElement<>(new QName(NAMESPACE_URI, "refusjon"), XMLRefusjon.class, - createRefusjon(melding.getRefusjon().orElse(null))), + createRefusjon(melding.getRefusjon())), new JAXBElement<>(new QName(NAMESPACE_URI, "sykepengerIArbeidsgiverPerioden"), XMLSykepengerIArbeidsgiverperioden.class, - createSykepengerIArbeidsgiverperioden(melding.getSykepengerIArbeidsgiverPerioden().orElse(null))), + createSykepengerIArbeidsgiverperioden(melding.getSykepengerIArbeidsgiverperioden())), new JAXBElement<>(new QName(NAMESPACE_URI, "startdatoForeldrepengerperiode"), - LocalDate.class, melding.getStartdatoForeldrepengeperiode().orElse(null)), + LocalDate.class, melding.getStartdatoForeldrepengeperiode()), new JAXBElement<>(new QName(NAMESPACE_URI, "opphoerAvNaturalyrelseListe"), XMLOpphoerAvNaturalytelseListe.class, createOpphoerAvNaturalytelseListe(melding.getOpphoerAvNaturalytelseListe())), @@ -92,14 +94,17 @@ public static XMLInntektsmeldingM createInntektsmelding(RsInntektsmelding meldin createPleiepengerPeriodeListe(melding.getPleiepengerPerioder())), new JAXBElement<>(new QName(NAMESPACE_URI, "omsorgspenger"), XMLOmsorgspenger.class, - createOmsorgspenger(melding.getOmsorgspenger().orElse(null)))), + createOmsorgspenger(melding.getOmsorgspenger()))), Collections.emptyMap()); } private static XMLOmsorgspenger createOmsorgspenger(RsOmsorgspenger omsorgspenger) { - if (Objects.isNull(omsorgspenger)) { return null; } + + if (isNull(omsorgspenger)) { + return null; + } return new XMLOmsorgspenger( - new JAXBElement<>(new QName(NAMESPACE_URI, "harUtbetaltPliktigeDager"), Boolean.class, omsorgspenger.getHarUtbetaltPliktigeDager().orElse(null)), + new JAXBElement<>(new QName(NAMESPACE_URI, "harUtbetaltPliktigeDager"), Boolean.class, omsorgspenger.getHarUtbetaltPliktigeDager()), new JAXBElement<>(new QName(NAMESPACE_URI, "fravaersPerioder"), XMLFravaersPeriodeListe.class, createFravaersPeriodeListe(omsorgspenger.getFravaersPerioder())), new JAXBElement<>(new QName(NAMESPACE_URI, "delvisFravaersListe"), @@ -107,31 +112,43 @@ XMLFravaersPeriodeListe.class, createFravaersPeriodeListe(omsorgspenger.getFrava } private static XMLFravaersPeriodeListe createFravaersPeriodeListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { return null; } + + if (isNull(perioder) || perioder.isEmpty()) { + return null; + } return new XMLFravaersPeriodeListe( perioder.stream().map(XmlInntektsmelding201809::createPeriode).collect(Collectors.toList())); } private static XMLDelvisFravaersListe createDelvisFravaerListe(List delvisFravaerListe) { - if (Objects.isNull(delvisFravaerListe) || delvisFravaerListe.isEmpty()) { return null; } + + if (isNull(delvisFravaerListe) || delvisFravaerListe.isEmpty()) { + return null; + } return new XMLDelvisFravaersListe( delvisFravaerListe.stream().map(XmlInntektsmelding201809::createDelvisFravaer).collect(Collectors.toList())); } private static XMLDelvisFravaer createDelvisFravaer(RsDelvisFravaer delvisFravaer) { - BigDecimal timer = delvisFravaer.getTimer().map(BigDecimal::valueOf).orElse(null); + return new XMLDelvisFravaer( - new JAXBElement<>(new QName(NAMESPACE_URI, "dato"), LocalDate.class, delvisFravaer.getDato().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "timer"), BigDecimal.class, timer)); + new JAXBElement<>(new QName(NAMESPACE_URI, "dato"), LocalDate.class, delvisFravaer.getDato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "timer"), BigDecimal.class, toBigDecimal(delvisFravaer.getTimer())) + ); } private static XMLPleiepengerPeriodeListe createPleiepengerPeriodeListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { return null; } + + if (isNull(perioder) || perioder.isEmpty()) { + return null; + } + return new XMLPleiepengerPeriodeListe( perioder.stream().map(XmlInntektsmelding201809::createPeriode).collect(Collectors.toList())); } private static XMLAvsendersystem createAvsendersystem(RsAvsendersystem system) { + return new XMLAvsendersystem(system.getSystemnavn(), system.getSystemversjon(), new JAXBElement<>(new QName(NAMESPACE_URI, "innsendingstidspunkt"), LocalDateTime.class, @@ -139,51 +156,70 @@ private static XMLAvsendersystem createAvsendersystem(RsAvsendersystem system) { } private static XMLGjenopptakelseNaturalytelseListe createGjenopptakelseNaturalytelseListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { return null; } + + if (isNull(liste) || liste.isEmpty()) { + return null; + } + return new XMLGjenopptakelseNaturalytelseListe( liste.stream().map(XmlInntektsmelding201809::createNaturalytelse).collect(Collectors.toList())); } private static XMLOpphoerAvNaturalytelseListe createOpphoerAvNaturalytelseListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { return null; } + + if (isNull(liste) || liste.isEmpty()) { + return null; + } + return new XMLOpphoerAvNaturalytelseListe( liste.stream().map(XmlInntektsmelding201809::createNaturalytelse).collect(Collectors.toList())); } private static XMLNaturalytelseDetaljer createNaturalytelse(RsNaturalytelseDetaljer detaljer) { - BigDecimal beloep = detaljer.getBeloepPrMnd().map(BigDecimal::valueOf).orElse(null); + return new XMLNaturalytelseDetaljer( - new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, detaljer.getNaturaytelseType().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, detaljer.getFom().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "beloepPrMnd"), BigDecimal.class, beloep)); + new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, detaljer.getNaturaytelseType()), + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, detaljer.getFom()), + new JAXBElement<>(new QName(NAMESPACE_URI, "beloepPrMnd"), BigDecimal.class, toBigDecimal(detaljer.getBeloepPrMnd()))); } private static XMLSykepengerIArbeidsgiverperioden createSykepengerIArbeidsgiverperioden(RsSykepengerIArbeidsgiverperioden sykepenger) { - if (Objects.isNull(sykepenger)) { return null; } - BigDecimal bruttoUtbetalt = sykepenger.getBruttoUtbetalt().map(BigDecimal::valueOf).orElse(null); + + if (isNull(sykepenger)) { + return null; + } + return new XMLSykepengerIArbeidsgiverperioden( new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsgiverPeriodeListe"), XMLArbeidsgiverperiodeListe.class, - createArbeidsgiverperiodeListe(sykepenger.getArbeidsgiverperiodeListe().orElse(null))), - new JAXBElement<>(new QName(NAMESPACE_URI, "bruttoUtbetalt"), BigDecimal.class, bruttoUtbetalt), + createArbeidsgiverperiodeListe(sykepenger.getArbeidsgiverperiodeListe())), + new JAXBElement<>(new QName(NAMESPACE_URI, "bruttoUtbetalt"), BigDecimal.class, + toBigDecimal(sykepenger.getBruttoUtbetalt())), new JAXBElement<>(new QName(NAMESPACE_URI, "begrunnelseForReduksjonEllerIkkeUtbetalt"), String.class, - sykepenger.getBegrunnelseForReduksjonEllerIkkeUtbetalt().orElse(null))); + sykepenger.getBegrunnelseForReduksjonEllerIkkeUtbetalt())); } private static XMLArbeidsgiverperiodeListe createArbeidsgiverperiodeListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { return null; } + + if (isNull(perioder) || perioder.isEmpty()) { + return null; + } + return new XMLArbeidsgiverperiodeListe( - perioder.stream().map(XmlInntektsmelding201809::createPeriode).collect(Collectors.toList())); + perioder.stream().map(XmlInntektsmelding201809::createPeriode).toList()); } private static XMLRefusjon createRefusjon(RsRefusjon refusjon) { - if (Objects.isNull(refusjon)) { return null; } - BigDecimal belop = refusjon.getRefusjonsbeloepPrMnd().map(BigDecimal::valueOf).orElse(null); - LocalDate opphoersdato = refusjon.getRefusjonsopphoersdato().orElse(null); + + if (isNull(refusjon)) { + return null; + } + return new XMLRefusjon( - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, belop), - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, opphoersdato), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, + toBigDecimal(refusjon.getRefusjonsbeloepPrMnd())), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, refusjon.getRefusjonsopphoersdato()), new JAXBElement<>( new QName(NAMESPACE_URI, "endringIRefusjonListe"), XMLEndringIRefusjonsListe.class, @@ -191,25 +227,31 @@ private static XMLRefusjon createRefusjon(RsRefusjon refusjon) { } private static XMLEndringIRefusjonsListe createEndringIRefusjonsListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { return null; } - return new XMLEndringIRefusjonsListe(liste.stream().map(XmlInntektsmelding201809::createEndringIRefusjon).collect(Collectors.toList())); + + if (isNull(liste) || liste.isEmpty()) { + return null; + } + return new XMLEndringIRefusjonsListe(liste.stream().map(XmlInntektsmelding201809::createEndringIRefusjon).toList()); } private static XMLEndringIRefusjon createEndringIRefusjon(RsEndringIRefusjon endring) { - if (Objects.isNull(endring)) { return null; } - LocalDate endringsdato = endring.getEndringsdato().orElse(null); - BigDecimal refusjonsbeloep = endring.getRefusjonsbeloepPrMnd().map(BigDecimal::valueOf).orElse(null); + + if (isNull(endring)) { + return null; + } + return new XMLEndringIRefusjon( - new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, endringsdato), - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, refusjonsbeloep)); + new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, endring.getEndringsdato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, toBigDecimal(endring.getRefusjonsbeloepPrMnd())) + ); } - private static XMLArbeidsforhold createArbeidsforhold(RsArbeidsforhold arbeidsforhold) { + return new XMLArbeidsforhold( - new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforholdId"), String.class, arbeidsforhold.getArbeidsforholdId().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, arbeidsforhold.getFoersteFravaersdag().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "beregnetInntekt"), XMLInntekt.class, createInntekt(arbeidsforhold.getBeregnetInntekt().orElse(null))), + new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforholdId"), String.class, arbeidsforhold.getArbeidsforholdId()), + new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, arbeidsforhold.getFoersteFravaersdag()), + new JAXBElement<>(new QName(NAMESPACE_URI, "beregnetInntekt"), XMLInntekt.class, createInntekt(arbeidsforhold.getBeregnetInntekt())), new JAXBElement<>(new QName(NAMESPACE_URI, "avtaltFerieListe"), XMLAvtaltFerieListe.class, createAvtaltFerieListe(arbeidsforhold.getAvtaltFerieListe())), new JAXBElement<>( new QName(NAMESPACE_URI, "utsettelseAvForeldrepengerListe"), @@ -222,58 +264,72 @@ private static XMLArbeidsforhold createArbeidsforhold(RsArbeidsforhold arbeidsfo } private static XMLGraderingIForeldrepengerListe createGraderingIForeldrepengerListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { return null; } - return new XMLGraderingIForeldrepengerListe(liste.stream().map(XmlInntektsmelding201809::createGraderingIForeldrepenger).collect(Collectors.toList())); + + if (isNull(liste) || liste.isEmpty()) { + return null; + } + + return new XMLGraderingIForeldrepengerListe(liste.stream().map(XmlInntektsmelding201809::createGraderingIForeldrepenger).toList()); } private static XMLGraderingIForeldrepenger createGraderingIForeldrepenger(RsGraderingIForeldrepenger gradering) { - BigInteger arbeidstidprosent = gradering.getArbeidstidprosent().map(BigInteger::valueOf).orElse(null); + return new XMLGraderingIForeldrepenger( - new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(gradering.getPeriode().orElse(null))), - new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidstidprosent"), BigInteger.class, arbeidstidprosent)); + new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(gradering.getPeriode())), + new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidstidprosent"), BigInteger.class, toBigInteger(gradering.getArbeidstidprosent()))); } private static XMLUtsettelseAvForeldrepengerListe createUtsettelseAvForeldrepengerListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { return null; } + if (isNull(liste) || liste.isEmpty()) { + return null; + } return new XMLUtsettelseAvForeldrepengerListe(liste.stream().map(XmlInntektsmelding201809::createUtsettelseAvForeldrepenger).collect(Collectors.toList())); } private static XMLUtsettelseAvForeldrepenger createUtsettelseAvForeldrepenger(RsUtsettelseAvForeldrepenger utsettelse) { return new XMLUtsettelseAvForeldrepenger( - new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(utsettelse.getPeriode().orElse(null))), - new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakTilUtsettelse"), String.class, utsettelse.getAarsakTilUtsettelse().orElse(null))); + new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(utsettelse.getPeriode())), + new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakTilUtsettelse"), String.class, utsettelse.getAarsakTilUtsettelse())); } private static XMLAvtaltFerieListe createAvtaltFerieListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { return null; } + if (isNull(perioder) || perioder.isEmpty()) { + return null; + } return new XMLAvtaltFerieListe(perioder.stream().map(XmlInntektsmelding201809::createPeriode).collect(Collectors.toList())); } private static XMLPeriode createPeriode(RsPeriode periode) { - if (Objects.isNull(periode)) { return null; } + + if (isNull(periode)) { + return null; + } return new XMLPeriode( - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, periode.getFom().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, periode.getTom().orElse(null))); + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, periode.getFom()), + new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, periode.getTom()) + ); } private static XMLInntekt createInntekt(RsInntekt inntekt) { - if (Objects.isNull(inntekt)) { return null; } - BigDecimal beloep = inntekt.getBeloep().map(BigDecimal::valueOf).orElse(null); + if (isNull(inntekt)) { + return null; + } + return new XMLInntekt( - new JAXBElement<>(new QName(NAMESPACE_URI, "beloep"), BigDecimal.class, beloep), - new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakVedEndring"), String.class, inntekt.getAarsakVedEndring().orElse(null)) + new JAXBElement<>(new QName(NAMESPACE_URI, "beloep"), BigDecimal.class, toBigDecimal(inntekt.getBeloep())), + new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakVedEndring"), String.class, inntekt.getAarsakVedEndring()) ); } private static XMLArbeidsgiver createArbeidsgiver(RsArbeidsgiver arbeidsgiver) { - if (Objects.isNull(arbeidsgiver)) { + if (isNull(arbeidsgiver)) { throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Den forespurte meldingen har ingen arbeidsgiver."); } return new XMLArbeidsgiver( - arbeidsgiver.getVirksomhetsnummer(), - new XMLKontaktinformasjon( - arbeidsgiver.getKontaktinformasjon().getKontaktinformasjonNavn(), - arbeidsgiver.getKontaktinformasjon().getTelefonnummer())); + arbeidsgiver.getVirksomhetsnummer(), + new XMLKontaktinformasjon( + arbeidsgiver.getKontaktinformasjon().getKontaktinformasjonNavn(), + arbeidsgiver.getKontaktinformasjon().getTelefonnummer())); } -} +} \ No newline at end of file diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java index e96e197aaae..5c8c29881e9 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java @@ -53,10 +53,12 @@ import java.time.LocalDateTime; import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; -import static org.apache.commons.text.CaseUtils.toCamelCase; +import static java.util.Objects.isNull; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigDecimal; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigInteger; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toCamelCase; @Slf4j public class XmlInntektsmelding201812 { @@ -65,17 +67,16 @@ public class XmlInntektsmelding201812 { private XmlInntektsmelding201812() { } - public static Melding createInntektsmelding(RsInntektsmelding melding) { Melding inntektsMelding = new Melding(new XMLSkjemainnhold( melding.getYtelse(), melding.getAarsakTilInnsending(), new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsgiver"), XMLArbeidsgiver.class, - createArbeidsgiver(melding.getArbeidsgiver().orElse(null))), + createArbeidsgiver(melding.getArbeidsgiver())), new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsgiverPrivat"), XMLArbeidsgiverPrivat.class, - createArbeidsgiverPrivat(melding.getArbeidsgiverPrivat().orElse(null))), + createArbeidsgiverPrivat(melding.getArbeidsgiverPrivat())), melding.getArbeidstakerFnr(), melding.isNaerRelasjon(), new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforhold"), @@ -83,12 +84,12 @@ public static Melding createInntektsmelding(RsInntektsmelding melding) { createArbeidsforhold(melding.getArbeidsforhold())), new JAXBElement<>(new QName(NAMESPACE_URI, "refusjon"), XMLRefusjon.class, - createRefusjon(melding.getRefusjon().orElse(null))), + createRefusjon(melding.getRefusjon())), new JAXBElement<>(new QName(NAMESPACE_URI, "sykepengerIArbeidsgiverPerioden"), XMLSykepengerIArbeidsgiverperioden.class, - createSykepengerIArbeidsgiverperioden(melding.getSykepengerIArbeidsgiverPerioden().orElse(null))), + createSykepengerIArbeidsgiverperioden(melding.getSykepengerIArbeidsgiverperioden())), new JAXBElement<>(new QName(NAMESPACE_URI, "startdatoForeldrepengerperiode"), - LocalDate.class, melding.getStartdatoForeldrepengeperiode().orElse(null)), + LocalDate.class, melding.getStartdatoForeldrepengeperiode()), new JAXBElement<>(new QName(NAMESPACE_URI, "opphoerAvNaturalyrelseListe"), XMLOpphoerAvNaturalytelseListe.class, createOpphoerAvNaturalytelseListe(melding.getOpphoerAvNaturalytelseListe())), @@ -101,26 +102,27 @@ public static Melding createInntektsmelding(RsInntektsmelding melding) { createPleiepengerPeriodeListe(melding.getPleiepengerPerioder())), new JAXBElement<>(new QName(NAMESPACE_URI, "omsorgspenger"), XMLOmsorgspenger.class, - createOmsorgspenger(melding.getOmsorgspenger().orElse(null)))), + createOmsorgspenger(melding.getOmsorgspenger()))), Collections.emptyMap()); log.info("Opprettet inntektsmelding med verdier: {}", Json.pretty(inntektsMelding)); return inntektsMelding; } private static XMLOmsorgspenger createOmsorgspenger(RsOmsorgspenger omsorgspenger) { - if (Objects.isNull(omsorgspenger)) { - return null; - } - return new XMLOmsorgspenger( - new JAXBElement<>(new QName(NAMESPACE_URI, "harUtbetaltPliktigeDager"), Boolean.class, omsorgspenger.getHarUtbetaltPliktigeDager().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "fravaersPerioder"), - XMLFravaersPeriodeListe.class, createFravaersPeriodeListe(omsorgspenger.getFravaersPerioder())), - new JAXBElement<>(new QName(NAMESPACE_URI, "delvisFravaersListe"), - XMLDelvisFravaersListe.class, createDelvisFravaerListe(omsorgspenger.getDelvisFravaersListe()))); + + return isNull(omsorgspenger) ? null : + new XMLOmsorgspenger( + new JAXBElement<>(new QName(NAMESPACE_URI, "harUtbetaltPliktigeDager"), Boolean.class, + omsorgspenger.getHarUtbetaltPliktigeDager()), + new JAXBElement<>(new QName(NAMESPACE_URI, "fravaersPerioder"), + XMLFravaersPeriodeListe.class, createFravaersPeriodeListe(omsorgspenger.getFravaersPerioder())), + new JAXBElement<>(new QName(NAMESPACE_URI, "delvisFravaersListe"), + XMLDelvisFravaersListe.class, createDelvisFravaerListe(omsorgspenger.getDelvisFravaersListe()))); } private static XMLFravaersPeriodeListe createFravaersPeriodeListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { + + if (isNull(perioder) || perioder.isEmpty()) { return null; } return new XMLFravaersPeriodeListe( @@ -128,7 +130,8 @@ private static XMLFravaersPeriodeListe createFravaersPeriodeListe(List delvisFravaerListe) { - if (Objects.isNull(delvisFravaerListe) || delvisFravaerListe.isEmpty()) { + + if (isNull(delvisFravaerListe) || delvisFravaerListe.isEmpty()) { return null; } return new XMLDelvisFravaersListe( @@ -136,14 +139,16 @@ private static XMLDelvisFravaersListe createDelvisFravaerListe(List(new QName(NAMESPACE_URI, "dato"), LocalDate.class, delvisFravaer.getDato().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "timer"), BigDecimal.class, timer)); + new JAXBElement<>(new QName(NAMESPACE_URI, "dato"), LocalDate.class, delvisFravaer.getDato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "timer"), BigDecimal.class, toBigDecimal(delvisFravaer.getTimer())) + ); } private static XMLPleiepengerPeriodeListe createPleiepengerPeriodeListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { + + if (isNull(perioder) || perioder.isEmpty()) { return null; } return new XMLPleiepengerPeriodeListe( @@ -151,6 +156,7 @@ private static XMLPleiepengerPeriodeListe createPleiepengerPeriodeListe(List(new QName(NAMESPACE_URI, "innsendingstidspunkt"), LocalDateTime.class, @@ -158,7 +164,8 @@ private static XMLAvsendersystem createAvsendersystem(RsAvsendersystem system) { } private static XMLGjenopptakelseNaturalytelseListe createGjenopptakelseNaturalytelseListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { + + if (isNull(liste) || liste.isEmpty()) { return null; } return new XMLGjenopptakelseNaturalytelseListe( @@ -166,7 +173,8 @@ private static XMLGjenopptakelseNaturalytelseListe createGjenopptakelseNaturalyt } private static XMLOpphoerAvNaturalytelseListe createOpphoerAvNaturalytelseListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { + + if (isNull(liste) || liste.isEmpty()) { return null; } return new XMLOpphoerAvNaturalytelseListe( @@ -174,81 +182,76 @@ private static XMLOpphoerAvNaturalytelseListe createOpphoerAvNaturalytelseListe( } private static XMLNaturalytelseDetaljer createNaturalytelse(RsNaturalytelseDetaljer detaljer) { - BigDecimal beloep = detaljer.getBeloepPrMnd().map(BigDecimal::valueOf).orElse(null); + return new XMLNaturalytelseDetaljer( - new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, detaljer.getNaturaytelseType() - .map(value -> value.contains("_") ? toCamelCase(value, true, '_') : value) - .orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, detaljer.getFom().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "beloepPrMnd"), BigDecimal.class, beloep)); + new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, + toCamelCase(detaljer.getNaturaytelseType())), + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, detaljer.getFom()), + new JAXBElement<>(new QName(NAMESPACE_URI, "beloepPrMnd"), BigDecimal.class, toBigDecimal(detaljer.getBeloepPrMnd())) + ); } private static XMLSykepengerIArbeidsgiverperioden createSykepengerIArbeidsgiverperioden(RsSykepengerIArbeidsgiverperioden sykepenger) { - if (Objects.isNull(sykepenger)) { - return null; - } - BigDecimal bruttoUtbetalt = sykepenger.getBruttoUtbetalt().map(BigDecimal::valueOf).orElse(null); - return new XMLSykepengerIArbeidsgiverperioden( - new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsgiverPeriodeListe"), - XMLArbeidsgiverperiodeListe.class, - createArbeidsgiverperiodeListe(sykepenger.getArbeidsgiverperiodeListe().orElse(null))), - new JAXBElement<>(new QName(NAMESPACE_URI, "bruttoUtbetalt"), BigDecimal.class, bruttoUtbetalt), - new JAXBElement<>(new QName(NAMESPACE_URI, "begrunnelseForReduksjonEllerIkkeUtbetalt"), - String.class, - sykepenger.getBegrunnelseForReduksjonEllerIkkeUtbetalt() - .map(value -> value.contains("_") ? toCamelCase(value, true, '_') : value) - .orElse(null))); + + return isNull(sykepenger) ? null : + new XMLSykepengerIArbeidsgiverperioden( + new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsgiverPeriodeListe"), + XMLArbeidsgiverperiodeListe.class, + createArbeidsgiverperiodeListe(sykepenger.getArbeidsgiverperiodeListe())), + new JAXBElement<>(new QName(NAMESPACE_URI, "bruttoUtbetalt"), BigDecimal.class, toBigDecimal(sykepenger.getBruttoUtbetalt())), + new JAXBElement<>(new QName(NAMESPACE_URI, "begrunnelseForReduksjonEllerIkkeUtbetalt"), + String.class, + toCamelCase(sykepenger.getBegrunnelseForReduksjonEllerIkkeUtbetalt())) + ); } private static XMLArbeidsgiverperiodeListe createArbeidsgiverperiodeListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { + + if (isNull(perioder) || perioder.isEmpty()) { return null; } return new XMLArbeidsgiverperiodeListe( - perioder.stream().map(XmlInntektsmelding201812::createPeriode).collect(Collectors.toList())); + perioder.stream().map(XmlInntektsmelding201812::createPeriode).toList()); } private static XMLRefusjon createRefusjon(RsRefusjon refusjon) { - if (Objects.isNull(refusjon)) { - return null; - } - BigDecimal belop = refusjon.getRefusjonsbeloepPrMnd().map(BigDecimal::valueOf).orElse(null); - LocalDate opphoersdato = refusjon.getRefusjonsopphoersdato().orElse(null); - return new XMLRefusjon( - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, belop), - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, opphoersdato), - new JAXBElement<>( - new QName(NAMESPACE_URI, "endringIRefusjonListe"), - XMLEndringIRefusjonsListe.class, - createEndringIRefusjonsListe(refusjon.getEndringIRefusjonListe()))); + + return isNull(refusjon) ? null : + new XMLRefusjon( + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, toBigDecimal(refusjon.getRefusjonsbeloepPrMnd())), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, refusjon.getRefusjonsopphoersdato()), + new JAXBElement<>( + new QName(NAMESPACE_URI, "endringIRefusjonListe"), + XMLEndringIRefusjonsListe.class, + createEndringIRefusjonsListe(refusjon.getEndringIRefusjonListe()))); } private static XMLEndringIRefusjonsListe createEndringIRefusjonsListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { + + if (isNull(liste) || liste.isEmpty()) { return null; } - return new XMLEndringIRefusjonsListe(liste.stream().map(XmlInntektsmelding201812::createEndringIRefusjon).collect(Collectors.toList())); + + return new XMLEndringIRefusjonsListe(liste.stream().map(XmlInntektsmelding201812::createEndringIRefusjon).toList()); } private static XMLEndringIRefusjon createEndringIRefusjon(RsEndringIRefusjon endring) { - if (Objects.isNull(endring)) { - return null; - } - LocalDate endringsdato = endring.getEndringsdato().orElse(null); - BigDecimal refusjonsbeloep = endring.getRefusjonsbeloepPrMnd().map(BigDecimal::valueOf).orElse(null); - return new XMLEndringIRefusjon( - new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, endringsdato), - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, refusjonsbeloep)); + + return isNull(endring) ? null : + new XMLEndringIRefusjon( + new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, endring.getEndringsdato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, + toBigDecimal(endring.getRefusjonsbeloepPrMnd()))); } private static XMLArbeidsforhold createArbeidsforhold(RsArbeidsforhold arbeidsforhold) { + return new XMLArbeidsforhold( - new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforholdId"), String.class, arbeidsforhold.getArbeidsforholdId() - .map(value -> value.contains("_") ? toCamelCase(value, true, '_') : value) - .orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, arbeidsforhold.getFoersteFravaersdag().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "beregnetInntekt"), XMLInntekt.class, createInntekt(arbeidsforhold.getBeregnetInntekt().orElse(null))), + new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforholdId"), String.class, + toCamelCase(arbeidsforhold.getArbeidsforholdId())), + new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, arbeidsforhold.getFoersteFravaersdag()), + new JAXBElement<>(new QName(NAMESPACE_URI, "beregnetInntekt"), XMLInntekt.class, createInntekt(arbeidsforhold.getBeregnetInntekt())), new JAXBElement<>(new QName(NAMESPACE_URI, "avtaltFerieListe"), XMLAvtaltFerieListe.class, createAvtaltFerieListe(arbeidsforhold.getAvtaltFerieListe())), new JAXBElement<>( new QName(NAMESPACE_URI, "utsettelseAvForeldrepengerListe"), @@ -261,66 +264,77 @@ private static XMLArbeidsforhold createArbeidsforhold(RsArbeidsforhold arbeidsfo } private static XMLGraderingIForeldrepengerListe createGraderingIForeldrepengerListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { + + if (isNull(liste) || liste.isEmpty()) { return null; } - return new XMLGraderingIForeldrepengerListe(liste.stream().map(XmlInntektsmelding201812::createGraderingIForeldrepenger).collect(Collectors.toList())); + + return new XMLGraderingIForeldrepengerListe(liste.stream().map(XmlInntektsmelding201812::createGraderingIForeldrepenger).toList()); } private static XMLGraderingIForeldrepenger createGraderingIForeldrepenger(RsGraderingIForeldrepenger gradering) { - BigInteger arbeidstidprosent = gradering.getArbeidstidprosent().map(BigInteger::valueOf).orElse(null); + return new XMLGraderingIForeldrepenger( - new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(gradering.getPeriode().orElse(null))), - new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidstidprosent"), BigInteger.class, arbeidstidprosent)); + new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(gradering.getPeriode())), + new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidstidprosent"), BigInteger.class, + toBigInteger(gradering.getArbeidstidprosent()))); } private static XMLUtsettelseAvForeldrepengerListe createUtsettelseAvForeldrepengerListe(List liste) { - if (Objects.isNull(liste) || liste.isEmpty()) { + + if (isNull(liste) || liste.isEmpty()) { return null; } - return new XMLUtsettelseAvForeldrepengerListe(liste.stream().map(XmlInntektsmelding201812::createUtsettelseAvForeldrepenger).collect(Collectors.toList())); + + return new XMLUtsettelseAvForeldrepengerListe(liste.stream().map(XmlInntektsmelding201812::createUtsettelseAvForeldrepenger).toList()); } private static XMLUtsettelseAvForeldrepenger createUtsettelseAvForeldrepenger(RsUtsettelseAvForeldrepenger utsettelse) { + return new XMLUtsettelseAvForeldrepenger( - new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(utsettelse.getPeriode().orElse(null))), - new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakTilUtsettelse"), String.class, utsettelse.getAarsakTilUtsettelse() - .map(value -> value.contains("_") ? toCamelCase(value, true, '_') : value) - .orElse(null))); + new JAXBElement<>(new QName(NAMESPACE_URI, "periode"), XMLPeriode.class, createPeriode(utsettelse.getPeriode())), + new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakTilUtsettelse"), String.class, + toCamelCase(utsettelse.getAarsakTilUtsettelse())) + ); } private static XMLAvtaltFerieListe createAvtaltFerieListe(List perioder) { - if (Objects.isNull(perioder) || perioder.isEmpty()) { + + if (isNull(perioder) || perioder.isEmpty()) { return null; } - return new XMLAvtaltFerieListe(perioder.stream().map(XmlInntektsmelding201812::createPeriode).collect(Collectors.toList())); + + return new XMLAvtaltFerieListe(perioder.stream().map(XmlInntektsmelding201812::createPeriode).toList()); } private static XMLPeriode createPeriode(RsPeriode periode) { - if (Objects.isNull(periode)) { + + if (isNull(periode)) { return null; } + return new XMLPeriode( - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, periode.getFom().orElse(null)), - new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, periode.getTom().orElse(null))); + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, periode.getFom()), + new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, periode.getTom())); } private static XMLInntekt createInntekt(RsInntekt inntekt) { - if (Objects.isNull(inntekt)) { + + if (isNull(inntekt)) { return null; } - BigDecimal beloep = inntekt.getBeloep().map(BigDecimal::valueOf).orElse(null); return new XMLInntekt( - new JAXBElement<>(new QName(NAMESPACE_URI, "beloep"), BigDecimal.class, beloep), - new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakVedEndring"), String.class, inntekt.getAarsakVedEndring() - .map(value -> value.contains("_") ? toCamelCase(value, true, '_') : value) - .orElse(null)) + new JAXBElement<>(new QName(NAMESPACE_URI, "beloep"), BigDecimal.class, + toBigDecimal(inntekt.getBeloep())), + new JAXBElement<>(new QName(NAMESPACE_URI, "aarsakVedEndring"), String.class, + toCamelCase(inntekt.getAarsakVedEndring())) ); } private static XMLArbeidsgiverPrivat createArbeidsgiverPrivat(RsArbeidsgiverPrivat arbeidsgiver) { - return Objects.isNull(arbeidsgiver) ? null : + + return isNull(arbeidsgiver) ? null : new XMLArbeidsgiverPrivat( arbeidsgiver.getArbeidsgiverFnr(), new XMLKontaktinformasjon( @@ -329,7 +343,8 @@ private static XMLArbeidsgiverPrivat createArbeidsgiverPrivat(RsArbeidsgiverPriv } private static XMLArbeidsgiver createArbeidsgiver(RsArbeidsgiver arbeidsgiver) { - return Objects.isNull(arbeidsgiver) ? null : + + return isNull(arbeidsgiver) ? null : new XMLArbeidsgiver( arbeidsgiver.getVirksomhetsnummer(), new XMLKontaktinformasjon( diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java index efea22e6623..45b5896d1f5 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java @@ -11,4 +11,4 @@ public class InntektsmeldingApplicationStarter { public static void main(String[] args) { SpringApplication.run(InntektsmeldingApplicationStarter.class, args); } -} +} \ No newline at end of file diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/controller/InntektsmeldingController.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/controller/InntektsmeldingController.java index b77774865e8..9f56782b870 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/controller/InntektsmeldingController.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/controller/InntektsmeldingController.java @@ -1,5 +1,6 @@ package no.nav.registre.testnav.inntektsmeldingservice.controller; +import io.swagger.v3.core.util.Json; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.registre.testnav.inntektsmeldingservice.service.InntektsmeldingService; @@ -35,7 +36,7 @@ public InntektsmeldingResponse genererMeldingForIdent( @RequestHeader("Nav-Call-Id") String navCallId, @RequestBody InntektsmeldingRequest request ) { - log.info("Oppretter inntektsmelding for {} i {}.", request.getArbeidstakerFnr(), request.getMiljoe()); + log.info("Oppretter inntektsmelding for {} i {} melding {}.", request.getArbeidstakerFnr(), request.getMiljoe(), Json.pretty(request)); validerInntektsmelding(request); diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java index edeb76c2c6b..edc1b8e3d95 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java @@ -3,28 +3,27 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; - -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.YtelseKodeListe; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakInnsendingKodeListe; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.YtelseKodeListe; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsforhold; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsgiver; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsgiverPrivat; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsAvsendersystem; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsNaturalytelseDetaljer; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsOmsorgspenger; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsPeriode; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsRefusjon; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsSykepengerIArbeidsgiverperioden; -import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsNaturalytelseDetaljer; + +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; +import java.util.Objects; -@Value +@Data @Builder @AllArgsConstructor @NoArgsConstructor(force = true) @@ -72,10 +71,6 @@ public class RsInntektsmeldingRequest { @JsonProperty private List pleiepengerPerioder; - public RsAvsendersystem getAvsendersystem() { - return Objects.requireNonNullElse(avsendersystem, new RsAvsendersystem()); - } - public List getOpphoerAvNaturalytelseListe() { return Objects.requireNonNullElse(opphoerAvNaturalytelseListe, Collections.emptyList()); } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java index 7e6e4675eba..e568fb2cce0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java @@ -8,7 +8,6 @@ import java.util.Collections; import java.util.List; import java.util.Objects; -import java.util.Optional; @Data @NoArgsConstructor @@ -27,18 +26,6 @@ public class RsArbeidsforhold { @JsonProperty private List graderingIForeldrepengerListe; - public Optional getArbeidsforholdId() { - return Optional.ofNullable(arbeidsforholdId); - } - - public Optional getFoersteFravaersdag() { - return Optional.ofNullable(foersteFravaersdag); - } - - public Optional getBeregnetInntekt() { - return Optional.ofNullable(beregnetInntekt); - } - public List getAvtaltFerieListe() { return Objects.requireNonNullElse(avtaltFerieListe, Collections.emptyList()); } @@ -50,6 +37,4 @@ public List getUtsettelseAvForeldrepengerListe() { public List getGraderingIForeldrepengerListe() { return Objects.requireNonNullElse(graderingIForeldrepengerListe, Collections.emptyList()); } - - } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java index bfb4a5e3830..f4dffcfdea0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import java.time.LocalDate; -import java.util.Optional; @Data @NoArgsConstructor @@ -15,12 +14,4 @@ public class RsDelvisFravaer { private LocalDate dato; @JsonProperty private Double timer; - - public Optional getDato() { - return Optional.ofNullable(dato); - } - - public Optional getTimer() { - return Optional.ofNullable(timer); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java index 508243c5ac5..68ccb26f3dd 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java @@ -6,7 +6,6 @@ import lombok.NoArgsConstructor; import java.time.LocalDate; -import java.util.Optional; @Data @NoArgsConstructor @@ -17,12 +16,4 @@ public class RsEndringIRefusjon { private LocalDate endringsdato; @JsonProperty private Double refusjonsbeloepPrMnd; - - public Optional getEndringsdato() { - return Optional.ofNullable(endringsdato); - } - - public Optional getRefusjonsbeloepPrMnd() { - return Optional.ofNullable(refusjonsbeloepPrMnd); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java index e9eaec8d6d6..77bcca3591a 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java @@ -4,8 +4,6 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.util.Optional; - @Data @NoArgsConstructor public class RsGraderingIForeldrepenger { @@ -14,12 +12,4 @@ public class RsGraderingIForeldrepenger { private RsPeriode periode; @JsonProperty private Integer arbeidstidprosent; - - public Optional getPeriode() { - return Optional.ofNullable(periode); - } - - public Optional getArbeidstidprosent() { - return Optional.ofNullable(arbeidstidprosent); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java index db24570e3a2..62ff87c2f8b 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java @@ -4,8 +4,6 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.util.Optional; - @Data @NoArgsConstructor public class RsInntekt { @@ -14,12 +12,4 @@ public class RsInntekt { private Double beloep; @JsonProperty private String aarsakVedEndring; - - public Optional getBeloep() { - return Optional.ofNullable(beloep); - } - - public Optional getAarsakVedEndring() { - return Optional.ofNullable(aarsakVedEndring); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java index ab64034dcb5..ff61dc2f0fb 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java @@ -11,7 +11,6 @@ import java.util.Collections; import java.util.List; import java.util.Objects; -import java.util.Optional; @Data @Builder @@ -54,22 +53,6 @@ public class RsInntektsmelding { @JsonProperty private List pleiepengerPerioder; - public Optional getArbeidsgiver() { - return Optional.ofNullable(arbeidsgiver); - } - - public Optional getArbeidsgiverPrivat() { - return Optional.ofNullable(arbeidsgiverPrivat); - } - - public Optional getRefusjon() { - return Optional.ofNullable(refusjon); - } - - public Optional getOmsorgspenger() { - return Optional.ofNullable(omsorgspenger); - } - public RsAvsendersystem getAvsendersystem() { return Objects.requireNonNullElse(avsendersystem, new RsAvsendersystem()); } @@ -85,12 +68,4 @@ public List getGjenopptakelseNaturalytelseListe() { public List getPleiepengerPerioder() { return Objects.requireNonNullElse(pleiepengerPerioder, Collections.emptyList()); } - - public Optional getSykepengerIArbeidsgiverPerioden() { - return Optional.ofNullable(sykepengerIArbeidsgiverperioden); - } - - public Optional getStartdatoForeldrepengeperiode() { - return Optional.ofNullable(startdatoForeldrepengeperiode); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java index 77f93e60434..2f19bf7a5ae 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import java.time.LocalDate; -import java.util.Optional; @Data @NoArgsConstructor @@ -17,16 +16,4 @@ public class RsNaturalytelseDetaljer { private LocalDate fom; @JsonProperty private Double beloepPrMnd; - - public Optional getNaturaytelseType() { - return Optional.ofNullable(naturaytelseType); - } - - public Optional getFom() { - return Optional.ofNullable(fom); - } - - public Optional getBeloepPrMnd() { - return Optional.ofNullable(beloepPrMnd); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java index 6676794d02a..cd60b0a56d0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java @@ -7,7 +7,6 @@ import java.util.Collections; import java.util.List; import java.util.Objects; -import java.util.Optional; @Data @NoArgsConstructor @@ -20,10 +19,6 @@ public class RsOmsorgspenger { @JsonProperty private List delvisFravaersListe; - public Optional getHarUtbetaltPliktigeDager() { - return Optional.ofNullable(harUtbetaltPliktigeDager); - } - public List getFravaersPerioder() { return Objects.requireNonNullElse(fravaersPerioder, Collections.emptyList()); } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java index b656f42682d..26174ac15ea 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import java.time.LocalDate; -import java.util.Optional; @Data @NoArgsConstructor @@ -15,12 +14,4 @@ public class RsPeriode { private LocalDate fom; @JsonProperty private LocalDate tom; - - public Optional getFom() { - return Optional.ofNullable(fom); - } - - public Optional getTom() { - return Optional.ofNullable(tom); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java index 0a610165916..ec1a8caede6 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java @@ -8,7 +8,6 @@ import java.util.Collections; import java.util.List; import java.util.Objects; -import java.util.Optional; @Data @NoArgsConstructor @@ -21,14 +20,6 @@ public class RsRefusjon { @JsonProperty private List endringIRefusjonListe; - public Optional getRefusjonsbeloepPrMnd() { - return Optional.ofNullable(refusjonsbeloepPrMnd); - } - - public Optional getRefusjonsopphoersdato() { - return Optional.ofNullable(refusjonsopphoersdato); - } - public List getEndringIRefusjonListe() { return Objects.requireNonNullElse(endringIRefusjonListe, Collections.emptyList()); } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java index 3ee560b4655..60d68908424 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import java.util.List; -import java.util.Optional; @Data @NoArgsConstructor @@ -17,16 +16,4 @@ public class RsSykepengerIArbeidsgiverperioden { private Double bruttoUtbetalt; @JsonProperty private String begrunnelseForReduksjonEllerIkkeUtbetalt; - - public Optional> getArbeidsgiverperiodeListe() { - return Optional.ofNullable(arbeidsgiverperiodeListe); - } - - public Optional getBruttoUtbetalt() { - return Optional.ofNullable(bruttoUtbetalt); - } - - public Optional getBegrunnelseForReduksjonEllerIkkeUtbetalt() { - return Optional.ofNullable(begrunnelseForReduksjonEllerIkkeUtbetalt); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java index b475c22d41e..c537a441eea 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java @@ -4,8 +4,6 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.util.Optional; - @Data @NoArgsConstructor public class RsUtsettelseAvForeldrepenger { @@ -14,12 +12,4 @@ public class RsUtsettelseAvForeldrepenger { private RsPeriode periode; @JsonProperty private String aarsakTilUtsettelse; - - public Optional getPeriode() { - return Optional.ofNullable(periode); - } - - public Optional getAarsakTilUtsettelse() { - return Optional.ofNullable(aarsakTilUtsettelse); - } } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java index 70f4e578dd2..fe24f3b4360 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java @@ -2,16 +2,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.List; - import no.nav.testnav.libs.dto.dokarkiv.v1.RsJoarkMetadata; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.RsInntektsmeldingRequest; +import java.util.List; -@Value +@Data @AllArgsConstructor @NoArgsConstructor(force = true) public class InntektsmeldingRequest { From b21b66e6e551c590b2ca2a86994d42163bc35f0e Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Wed, 7 Feb 2024 08:27:51 +0100 Subject: [PATCH 03/19] Remove annotations and change model classes to use @Data --- .../config/JsonMapperConfig.java | 5 +---- .../v1/RsInntektsmeldingRequest.java | 15 --------------- .../v1/response/RsXml201812Response.java | 9 +++------ .../v1/rs/RsArbeidsforhold.java | 7 ------- .../v1/rs/RsArbeidsgiver.java | 4 ---- .../v1/rs/RsArbeidsgiverPrivat.java | 4 ---- .../v1/rs/RsAvsendersystem.java | 6 ------ .../v1/rs/RsDelvisFravaer.java | 3 --- .../v1/rs/RsEndringIRefusjon.java | 3 --- .../v1/rs/RsGraderingIForeldrepenger.java | 3 --- .../v1/rs/RsInntekt.java | 3 --- .../v1/rs/RsInntektsmelding.java | 16 ---------------- .../v1/rs/RsKontaktinformasjon.java | 4 ---- .../v1/rs/RsNaturalytelseDetaljer.java | 4 ---- .../v1/rs/RsOmsorgspenger.java | 4 ---- .../v1/rs/RsPeriode.java | 3 --- .../v1/rs/RsRefusjon.java | 4 ---- .../rs/RsSykepengerIArbeidsgiverperioden.java | 4 ---- .../v1/rs/RsUtsettelseAvForeldrepenger.java | 3 --- .../requests/GenererAltinnInntektRequest.java | 13 ++----------- .../v1/requests/InntektsmeldingRequest.java | 10 ++-------- .../v1/requests/SyntetiseringsRequest.java | 12 ++---------- .../v1/response/InntektDokumentResponse.java | 17 +++++++---------- .../v1/response/InntektsmeldingResponse.java | 18 +++++++++--------- 24 files changed, 26 insertions(+), 148 deletions(-) diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java index c9609d8bd0c..179a63866d2 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.module.SimpleModule; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.YearMonthSerializer; @@ -52,9 +51,7 @@ public ObjectMapper objectMapper() { .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS) .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) .build() - .registerModule(simpleModule) - .registerModule(new Jdk8Module()); - + .registerModule(simpleModule); } private static class DollyYearMonthDeserializer extends JsonDeserializer { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java index edc1b8e3d95..65c8a441eb1 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -29,46 +28,32 @@ @NoArgsConstructor(force = true) public class RsInntektsmeldingRequest { - @JsonProperty private YtelseKodeListe ytelse; - @JsonProperty private AarsakInnsendingKodeListe aarsakTilInnsending; - @JsonProperty private boolean naerRelasjon; - @JsonProperty private RsAvsendersystem avsendersystem; - @JsonProperty private RsArbeidsgiver arbeidsgiver; - @JsonProperty private RsArbeidsgiverPrivat arbeidsgiverPrivat; - @JsonProperty private RsArbeidsforhold arbeidsforhold; - @JsonProperty private RsRefusjon refusjon; - @JsonProperty private RsOmsorgspenger omsorgspenger; - @JsonProperty private RsSykepengerIArbeidsgiverperioden sykepengerIArbeidsgiverperioden; - @JsonProperty private LocalDate startdatoForeldrepengeperiode; - @JsonProperty private List opphoerAvNaturalytelseListe; - @JsonProperty private List gjenopptakelseNaturalytelseListe; - @JsonProperty private List pleiepengerPerioder; public List getOpphoerAvNaturalytelseListe() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/response/RsXml201812Response.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/response/RsXml201812Response.java index 995fd8be91c..dd62b506bf6 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/response/RsXml201812Response.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/response/RsXml201812Response.java @@ -1,17 +1,14 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.response; -import lombok.AllArgsConstructor; -import lombok.Getter; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Setter; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLInntektsmeldingM; import java.util.List; -@Getter -@Setter +@Data @NoArgsConstructor -@AllArgsConstructor public class RsXml201812Response { + private List meldinger; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java index e568fb2cce0..645a80c7eca 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -13,17 +12,11 @@ @NoArgsConstructor public class RsArbeidsforhold { - @JsonProperty private String arbeidsforholdId; - @JsonProperty private LocalDate foersteFravaersdag; - @JsonProperty private RsInntekt beregnetInntekt; - @JsonProperty private List avtaltFerieListe; - @JsonProperty private List utsettelseAvForeldrepengerListe; - @JsonProperty private List graderingIForeldrepengerListe; public List getAvtaltFerieListe() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java index 5b0887a6657..c7522dd1368 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.NoArgsConstructor; @@ -9,10 +8,7 @@ @NoArgsConstructor public class RsArbeidsgiver { - @JsonProperty @Size(min = 9, max = 9) private String virksomhetsnummer; - @JsonProperty private RsKontaktinformasjon kontaktinformasjon; - } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java index 4f4055587b4..8f03f6a169a 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.NoArgsConstructor; @@ -9,10 +8,7 @@ @NoArgsConstructor public class RsArbeidsgiverPrivat { - @JsonProperty @Size(min = 11, max = 11) private String arbeidsgiverFnr; - @JsonProperty private RsKontaktinformasjon kontaktinformasjon; - } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java index 1e722b03346..2e39479d546 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -14,14 +13,10 @@ public class RsAvsendersystem { private static final String DEFAULT_SYSTEMNAVN = "ORKESTRATOREN"; private static final String DEFAULT_SYSTEMVERSJON = "1"; - @JsonProperty private String systemnavn; - @JsonProperty private String systemversjon; - @JsonProperty private LocalDateTime innsendingstidspunkt; - public String getSystemnavn() { return Objects.requireNonNullElse(systemnavn, DEFAULT_SYSTEMNAVN); } @@ -33,5 +28,4 @@ public String getSystemversjon() { public LocalDateTime getInnsendingstidspunkt() { return Objects.requireNonNullElse(innsendingstidspunkt, LocalDateTime.now()); } - } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java index f4dffcfdea0..972bae42669 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -10,8 +9,6 @@ @NoArgsConstructor public class RsDelvisFravaer { - @JsonProperty private LocalDate dato; - @JsonProperty private Double timer; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java index 68ccb26f3dd..44494128e03 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -12,8 +11,6 @@ @AllArgsConstructor public class RsEndringIRefusjon { - @JsonProperty private LocalDate endringsdato; - @JsonProperty private Double refusjonsbeloepPrMnd; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java index 77bcca3591a..6e08b95da8f 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -8,8 +7,6 @@ @NoArgsConstructor public class RsGraderingIForeldrepenger { - @JsonProperty private RsPeriode periode; - @JsonProperty private Integer arbeidstidprosent; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java index 62ff87c2f8b..9be226297df 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntekt.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -8,8 +7,6 @@ @NoArgsConstructor public class RsInntekt { - @JsonProperty private Double beloep; - @JsonProperty private String aarsakVedEndring; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java index ff61dc2f0fb..2793aaaaaf0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; @@ -18,39 +17,24 @@ @NoArgsConstructor public class RsInntektsmelding { - @JsonProperty private String ytelse; - @JsonProperty private String aarsakTilInnsending; - @JsonProperty @Size(min = 11, max = 11) private String arbeidstakerFnr; - @JsonProperty private boolean naerRelasjon; - @JsonProperty private RsAvsendersystem avsendersystem; - @JsonProperty private RsArbeidsgiver arbeidsgiver; - @JsonProperty private RsArbeidsgiverPrivat arbeidsgiverPrivat; - @JsonProperty private RsArbeidsforhold arbeidsforhold; - @JsonProperty private RsRefusjon refusjon; - @JsonProperty private RsOmsorgspenger omsorgspenger; - @JsonProperty private RsSykepengerIArbeidsgiverperioden sykepengerIArbeidsgiverperioden; - @JsonProperty private LocalDate startdatoForeldrepengeperiode; - @JsonProperty private List opphoerAvNaturalytelseListe; - @JsonProperty private List gjenopptakelseNaturalytelseListe; - @JsonProperty private List pleiepengerPerioder; public RsAvsendersystem getAvsendersystem() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java index 0a22d1dfdcc..8fbbbd507f9 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.NoArgsConstructor; @@ -9,10 +8,7 @@ @NoArgsConstructor public class RsKontaktinformasjon { - @JsonProperty private String kontaktinformasjonNavn; - @JsonProperty @Size(min = 8, max = 8) private String telefonnummer; - } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java index 2f19bf7a5ae..c26537d49a1 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -10,10 +9,7 @@ @NoArgsConstructor public class RsNaturalytelseDetaljer { - @JsonProperty private String naturaytelseType; - @JsonProperty private LocalDate fom; - @JsonProperty private Double beloepPrMnd; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java index cd60b0a56d0..e78d2811317 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -12,11 +11,8 @@ @NoArgsConstructor public class RsOmsorgspenger { - @JsonProperty private Boolean harUtbetaltPliktigeDager; - @JsonProperty private List fravaersPerioder; - @JsonProperty private List delvisFravaersListe; public List getFravaersPerioder() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java index 26174ac15ea..2db350965d2 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -10,8 +9,6 @@ @NoArgsConstructor public class RsPeriode { - @JsonProperty private LocalDate fom; - @JsonProperty private LocalDate tom; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java index ec1a8caede6..9ebb9cad983 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -13,11 +12,8 @@ @NoArgsConstructor public class RsRefusjon { - @JsonProperty private Double refusjonsbeloepPrMnd; - @JsonProperty private LocalDate refusjonsopphoersdato; - @JsonProperty private List endringIRefusjonListe; public List getEndringIRefusjonListe() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java index 60d68908424..441a670f3fd 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsSykepengerIArbeidsgiverperioden.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -10,10 +9,7 @@ @NoArgsConstructor public class RsSykepengerIArbeidsgiverperioden { - @JsonProperty private List arbeidsgiverperiodeListe; - @JsonProperty private Double bruttoUtbetalt; - @JsonProperty private String begrunnelseForReduksjonEllerIkkeUtbetalt; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java index c537a441eea..be1d052c1ee 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java @@ -1,6 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -8,8 +7,6 @@ @NoArgsConstructor public class RsUtsettelseAvForeldrepenger { - @JsonProperty private RsPeriode periode; - @JsonProperty private String aarsakTilUtsettelse; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/GenererAltinnInntektRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/GenererAltinnInntektRequest.java index 4414e749416..92deb343221 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/GenererAltinnInntektRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/GenererAltinnInntektRequest.java @@ -1,26 +1,17 @@ package no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter +@Data @NoArgsConstructor -@AllArgsConstructor public class GenererAltinnInntektRequest { - @JsonProperty("avspillergruppeId") private Long avspillergruppeId; - @JsonProperty("miljoe") private String miljoe; - @JsonProperty("antallIdenter") private Integer antallIdenter; - @JsonProperty("prosentSomStemmerMedInntektskomponenten") private Integer prosentSomStemmerMedInntektskomponenten; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java index fe24f3b4360..c15f663862c 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java @@ -1,7 +1,5 @@ package no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import no.nav.testnav.libs.dto.dokarkiv.v1.RsJoarkMetadata; @@ -10,15 +8,11 @@ import java.util.List; @Data -@AllArgsConstructor -@NoArgsConstructor(force = true) +@NoArgsConstructor public class InntektsmeldingRequest { - @JsonProperty + private String miljoe; - @JsonProperty private String arbeidstakerFnr; // TODO: ident! (i v2) - @JsonProperty private RsJoarkMetadata joarkMetadata; - @JsonProperty private List inntekter; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/SyntetiseringsRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/SyntetiseringsRequest.java index 0d65c609de2..e7c6277b506 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/SyntetiseringsRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/SyntetiseringsRequest.java @@ -1,20 +1,12 @@ package no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter +@Data @NoArgsConstructor -@AllArgsConstructor public class SyntetiseringsRequest { - @JsonProperty("avspillergruppeId") private Long avspillergruppeId; - - @JsonProperty("miljoe") private String miljoe; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektDokumentResponse.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektDokumentResponse.java index 1411c64465d..39080cb09d0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektDokumentResponse.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektDokumentResponse.java @@ -1,18 +1,15 @@ package no.nav.testnav.libs.dto.inntektsmeldingservice.v1.response; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.RequiredArgsConstructor; -import lombok.Value; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; -@Value -@RequiredArgsConstructor -@JsonInclude(JsonInclude.Include.NON_NULL) +@Data +@NoArgsConstructor +@AllArgsConstructor public class InntektDokumentResponse { - @JsonProperty + String journalpostId; - @JsonProperty String dokumentInfoId; - @JsonProperty String xml; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektsmeldingResponse.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektsmeldingResponse.java index ceda8fd2f82..2b6f032ec4f 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektsmeldingResponse.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/response/InntektsmeldingResponse.java @@ -1,16 +1,16 @@ package no.nav.testnav.libs.dto.inntektsmeldingservice.v1.response; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.RequiredArgsConstructor; -import lombok.Value; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import java.util.List; -@Value -@RequiredArgsConstructor +@Data +@NoArgsConstructor +@AllArgsConstructor public class InntektsmeldingResponse { - @JsonProperty - private final String fnr; - @JsonProperty - private final List dokumenter; + + private String fnr; + private List dokumenter; } From 01cd626d98fe6107e1756f2b0db7cb8228b9a9fd Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Wed, 7 Feb 2024 08:49:44 +0100 Subject: [PATCH 04/19] Remove Vault config from bootstrap.yml and refactor code --- apps/inntektsmelding-service/build.gradle | 3 --- .../inntektsmeldingservice/config/JsonMapperConfig.java | 7 ++++--- .../src/main/resources/application.yml | 3 +++ .../src/main/resources/bootstrap.yml | 4 ---- 4 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 apps/inntektsmelding-service/src/main/resources/bootstrap.yml diff --git a/apps/inntektsmelding-service/build.gradle b/apps/inntektsmelding-service/build.gradle index eeb487abecd..76d2c2e1224 100644 --- a/apps/inntektsmelding-service/build.gradle +++ b/apps/inntektsmelding-service/build.gradle @@ -47,7 +47,6 @@ dependencies { implementation 'no.nav.testnav.libs:servlet-security' implementation 'org.springframework.cloud:spring-cloud-vault-config-databases' - implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' @@ -55,7 +54,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.20' @@ -81,7 +79,6 @@ dependencies { implementation 'org.postgresql:postgresql' testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' implementation 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java index 179a63866d2..e1d0f3f2e0d 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/JsonMapperConfig.java @@ -52,6 +52,7 @@ public ObjectMapper objectMapper() { .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) .build() .registerModule(simpleModule); + } private static class DollyYearMonthDeserializer extends JsonDeserializer { @@ -86,7 +87,7 @@ public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deser if (isBlank(node.asText())) { return null; } - String dateTime = node.asText().length() > 10 ? node.asText().substring(0, 10) : node.asText(); + var dateTime = node.asText().length() > 10 ? node.asText().substring(0, 10) : node.asText(); return LocalDate.parse(dateTime); } } @@ -99,8 +100,8 @@ public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext d if (isBlank(node.asText())) { return null; } - String dateTime = node.asText().length() > 19 ? node.asText().substring(0, 19) : node.asText(); + var dateTime = node.asText().length() > 19 ? node.asText().substring(0, 19) : node.asText(); return dateTime.length() > 10 ? LocalDateTime.parse(dateTime) : LocalDate.parse(dateTime).atStartOfDay(); } } -} \ No newline at end of file +} diff --git a/apps/inntektsmelding-service/src/main/resources/application.yml b/apps/inntektsmelding-service/src/main/resources/application.yml index 5cfc38a0853..b6a30e24333 100644 --- a/apps/inntektsmelding-service/src/main/resources/application.yml +++ b/apps/inntektsmelding-service/src/main/resources/application.yml @@ -10,6 +10,9 @@ spring: application: name: testnav-inntektsmelding-service description: Tjeneste for sende inntektsmelding til dokarkiv. + cloud: + vault: + enabled: false security: oauth2: resourceserver: diff --git a/apps/inntektsmelding-service/src/main/resources/bootstrap.yml b/apps/inntektsmelding-service/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/apps/inntektsmelding-service/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file From 4be7d064e1f6a3ea205f6b555cc5096d783f4ec5 Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Wed, 7 Feb 2024 10:37:05 +0100 Subject: [PATCH 05/19] Oppdatert til bruk av inntektsmeldingRequest fra bibliotek --- .../InntektsmeldingClient.java | 6 ++-- .../InntektsmeldingConsumer.java | 2 +- .../OpprettInntektsmeldingCommand.java | 2 +- .../domain/TransaksjonMappingDTO.java | 1 + .../InntektsmeldingMappingStrategy.java | 32 +++++++++---------- .../libs/dto/dokarkiv/v1/RsJoarkMetadata.java | 8 ++--- .../v1/rs/RsAvsendersystem.java | 4 +++ .../v1/rs/RsKontaktinformasjon.java | 4 +++ .../v1/requests/InntektsmeldingRequest.java | 15 +++++++++ 9 files changed, 46 insertions(+), 28 deletions(-) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingClient.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingClient.java index 9165045c22f..da2b4b3360b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingClient.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingClient.java @@ -7,7 +7,6 @@ import ma.glasnost.orika.MapperFacade; import no.nav.dolly.bestilling.ClientFuture; import no.nav.dolly.bestilling.ClientRegister; -import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest; import no.nav.dolly.bestilling.inntektsmelding.domain.TransaksjonMappingDTO; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.jpa.TransaksjonMapping; @@ -17,6 +16,7 @@ import no.nav.dolly.mapper.MappingContextUtils; import no.nav.dolly.service.TransaksjonMappingService; import no.nav.dolly.util.TransactionHelperService; +import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import reactor.core.publisher.Flux; @@ -53,12 +53,10 @@ public Flux gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly var context = MappingContextUtils.getMappingContext(); context.setProperty("ident", dollyPerson.getIdent()); - var inntektsmeldingRequest = mapperFacade.map(bestilling.getInntektsmelding(), InntektsmeldingRequest.class, context); - return Flux.from( Flux.fromIterable(bestilling.getEnvironments()) .flatMap(environment -> { - var request = mapperFacade.map(inntektsmeldingRequest, InntektsmeldingRequest.class); + var request = mapperFacade.map(bestilling.getInntektsmelding(), InntektsmeldingRequest.class, context); request.setMiljoe(environment); return postInntektsmelding(isOpprettEndre || !transaksjonMappingService.existAlready(INNTKMELD, dollyPerson.getIdent(), environment, bestilling.getId()), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java index d37d985ffaa..1ca4ab6ea2b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java @@ -4,10 +4,10 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.ConsumerStatus; import no.nav.dolly.bestilling.inntektsmelding.command.OpprettInntektsmeldingCommand; -import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest; import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingResponse; import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; +import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Service; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java index b122259a8ff..9b7006042e8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java @@ -1,8 +1,8 @@ package no.nav.dolly.bestilling.inntektsmelding.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest; import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingResponse; +import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/TransaksjonMappingDTO.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/TransaksjonMappingDTO.java index 2e12bcf1f38..ace08d6fe44 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/TransaksjonMappingDTO.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/domain/TransaksjonMappingDTO.java @@ -4,6 +4,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; @Data @Builder diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java index a444e9a55c1..de3fd9f129c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java @@ -3,29 +3,29 @@ import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MapperFactory; import ma.glasnost.orika.MappingContext; -import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest; -import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakTilInnsendingType; import no.nav.dolly.domain.resultset.inntektsmeldingstub.RsInntektsmelding; import no.nav.dolly.mapper.MappingStrategy; +import no.nav.testnav.libs.dto.dokarkiv.v1.RsJoarkMetadata; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.RsInntektsmeldingRequest; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakInnsendingKodeListe; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsAvsendersystem; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsKontaktinformasjon; +import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; import org.springframework.stereotype.Component; import java.time.LocalDateTime; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; -import static no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest.Avsendersystem; import static no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest.Avsendertype; -import static no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest.Inntektsmelding; -import static no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest.JoarkMetadata; -import static no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest.Kontaktinformasjon; import static no.nav.dolly.util.NullcheckUtil.nullcheckSetDefaultValue; @Component public class InntektsmeldingMappingStrategy implements MappingStrategy { - private static Kontaktinformasjon getFiktivKontaktinformasjon() { + private static RsKontaktinformasjon getFiktivKontaktinformasjon() { - return Kontaktinformasjon.builder() + return RsKontaktinformasjon.builder() .kontaktinformasjonNavn("Dolly Dollesen") .telefonnummer("99999999") .build(); @@ -41,12 +41,12 @@ public void mapAtoB(RsInntektsmelding rsInntektsmelding, InntektsmeldingRequest inntektsmelding, MappingContext context) { if (isNull(rsInntektsmelding.getJoarkMetadata())) { - inntektsmelding.setJoarkMetadata(new JoarkMetadata()); + inntektsmelding.setJoarkMetadata(new RsJoarkMetadata()); } inntektsmelding.getJoarkMetadata().setAvsenderMottakerIdType( - !inntektsmelding.getInntekter().isEmpty() && - nonNull(inntektsmelding.getInntekter().get(0).getArbeidsgiver()) ? - Avsendertype.ORGNR : Avsendertype.FNR + (!inntektsmelding.getInntekter().isEmpty() && + nonNull(inntektsmelding.getInntekter().getFirst().getArbeidsgiver()) ? + Avsendertype.ORGNR : Avsendertype.FNR).name() ); inntektsmelding.setArbeidstakerFnr((String) context.getProperty("ident")); } @@ -54,14 +54,14 @@ public void mapAtoB(RsInntektsmelding rsInntektsmelding, .byDefault() .register(); - factory.classMap(RsInntektsmelding.Inntektsmelding.class, Inntektsmelding.class) + factory.classMap(RsInntektsmelding.Inntektsmelding.class, RsInntektsmeldingRequest.class) .customize(new CustomMapper<>() { @Override public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding, - Inntektsmelding inntektsmelding, MappingContext context) { + RsInntektsmeldingRequest inntektsmelding, MappingContext context) { inntektsmelding.setAarsakTilInnsending( - nullcheckSetDefaultValue(rsInntektsmelding.getAarsakTilInnsending(), AarsakTilInnsendingType.NY)); + nullcheckSetDefaultValue(inntektsmelding.getAarsakTilInnsending(), AarsakInnsendingKodeListe.NY)); if (nonNull(inntektsmelding.getArbeidsgiver()) && isNull(inntektsmelding.getArbeidsgiver().getKontaktinformasjon())) { @@ -74,7 +74,7 @@ public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding, getFiktivKontaktinformasjon()); } if (isNull(inntektsmelding.getAvsendersystem())) { - inntektsmelding.setAvsendersystem(Avsendersystem.builder() + inntektsmelding.setAvsendersystem(RsAvsendersystem.builder() .innsendingstidspunkt(LocalDateTime.now()) .build()); } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java index 141d46bf853..9b460fedd16 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java @@ -1,14 +1,10 @@ package no.nav.testnav.libs.dto.dokarkiv.v1; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; +import lombok.Data; import lombok.NoArgsConstructor; -@Builder -@Getter +@Data @NoArgsConstructor -@AllArgsConstructor public class RsJoarkMetadata { private String journalpostType; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java index 2e39479d546..d6affa98654 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsAvsendersystem.java @@ -1,5 +1,7 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @@ -7,7 +9,9 @@ import java.util.Objects; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsAvsendersystem { private static final String DEFAULT_SYSTEMNAVN = "ORKESTRATOREN"; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java index 8fbbbd507f9..9a5be0a0187 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsKontaktinformasjon.java @@ -1,10 +1,14 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data +@Builder +@AllArgsConstructor @NoArgsConstructor public class RsKontaktinformasjon { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java index c15f663862c..693f25d7ba6 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldingservice/v1/requests/InntektsmeldingRequest.java @@ -1,18 +1,33 @@ package no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import no.nav.testnav.libs.dto.dokarkiv.v1.RsJoarkMetadata; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.RsInntektsmeldingRequest; +import java.util.ArrayList; import java.util.List; +import static java.util.Objects.isNull; + @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class InntektsmeldingRequest { private String miljoe; private String arbeidstakerFnr; // TODO: ident! (i v2) private RsJoarkMetadata joarkMetadata; private List inntekter; + + public List getInntekter() { + + if (isNull(inntekter)) { + inntekter = new ArrayList<>(); + } + return inntekter; + } } From 252614b91bb902bc7d99512ae672310980c69d30 Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Wed, 7 Feb 2024 11:10:21 +0100 Subject: [PATCH 06/19] Oppdatert inntektsmeldingRequest --- .../no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java index 9b460fedd16..51300613201 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dokarkiv/v1/RsJoarkMetadata.java @@ -1,10 +1,14 @@ package no.nav.testnav.libs.dto.dokarkiv.v1; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsJoarkMetadata { private String journalpostType; From c4d919e6d728190b1a374fd77d9c5ec0cf50264c Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Wed, 7 Feb 2024 13:08:34 +0100 Subject: [PATCH 07/19] Bygg og deploy --- .../main/java/no/nav/dolly/DollyBackendApplicationStarter.java | 2 +- .../InntektsmeldingGeneratorApplicationStarter.java | 2 +- .../InntektsmeldingApplicationStarter.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java b/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java index f0ef428e58d..6af8668f777 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java @@ -10,4 +10,4 @@ public static void main(String[] args) { SpringApplication.run(DollyBackendApplicationStarter.class, args); } -} +} \ No newline at end of file diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/InntektsmeldingGeneratorApplicationStarter.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/InntektsmeldingGeneratorApplicationStarter.java index b5df997b68b..5f642d44188 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/InntektsmeldingGeneratorApplicationStarter.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/InntektsmeldingGeneratorApplicationStarter.java @@ -11,4 +11,4 @@ public class InntektsmeldingGeneratorApplicationStarter { public static void main(String[] args) { SpringApplication.run(InntektsmeldingGeneratorApplicationStarter.class, args); } -} +} \ No newline at end of file diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java index 45b5896d1f5..efea22e6623 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java @@ -11,4 +11,4 @@ public class InntektsmeldingApplicationStarter { public static void main(String[] args) { SpringApplication.run(InntektsmeldingApplicationStarter.class, args); } -} \ No newline at end of file +} From 6de0163bab2db379ed7b51af3c6ac94338b5f840 Mon Sep 17 00:00:00 2001 From: Cato Olsen Date: Thu, 8 Feb 2024 12:12:16 +0100 Subject: [PATCH 08/19] feature/forbedring_workflows (#3405) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Optimalisert workflows (apps, proxies, libs) for vår bruk. - Overgang til tokenless deploy for alle workflows. --- .github/workflows/alert-dolly.yml | 8 +- .github/workflows/all.workflows.yml | 42 ++----- .github/workflows/app.adresse-service.yml | 6 +- .github/workflows/app.amelding-service.yml | 6 +- .../app.app-tilgang-analyse-service.yml | 6 +- .../workflows/app.arbeidsforhold-service.yml | 6 +- .../app.batch-bestilling-service.yml | 6 +- .github/workflows/app.brreg-stub.yml | 6 +- .github/workflows/app.bruker-service.yml | 6 +- .github/workflows/app.budpro-service.yml | 6 +- .github/workflows/app.dolly-backend.yml | 6 +- .github/workflows/app.dolly-frontend.yml | 7 +- .github/workflows/app.dollystatus.yml | 7 +- .../app.endringsmelding-frontend.yml | 7 +- .../workflows/app.endringsmelding-service.yml | 6 +- .../app.ereg-batch-status-service.yml | 6 +- .github/workflows/app.faste-data-frontend.yml | 7 +- ...erer-arbeidsforhold-populasjon-service.yml | 6 +- .../workflows/app.generer-navn-service.yml | 6 +- ...enerer-organisasjon-populasjon-service.yml | 6 +- .../app.generer-synt-amelding-service.yml | 6 +- .../app.geografiske-kodeverk-service.yml | 6 +- .../workflows/app.helsepersonell-service.yml | 6 +- .../app.inntektsmelding-generator-service.yml | 6 +- .../workflows/app.inntektsmelding-service.yml | 6 +- .../app.jenkins-batch-status-service.yml | 6 +- .../workflows/app.joark-dokument-service.yml | 6 +- .github/workflows/app.miljoer-service.yml | 6 +- .../app.oppsummeringsdokument-service.yml | 6 +- .../app.organisasjon-bestilling-service.yml | 6 +- .../app.organisasjon-faste-data-service.yml | 6 +- .../workflows/app.organisasjon-forvalter.yml | 6 +- .../app.organisasjon-mottak-service.yml | 6 +- .../workflows/app.organisasjon-service.yml | 6 +- .../app.organisasjon-tilgang-frontend.yml | 7 +- .../app.organisasjon-tilgang-service.yml | 6 +- .github/workflows/app.orgnummer-service.yml | 6 +- .github/workflows/app.oversikt-frontend.yml | 7 +- .github/workflows/app.pdl-forvalter.yml | 6 +- .../app.person-faste-data-service.yml | 6 +- ...pp.person-organisasjon-tilgang-service.yml | 6 +- .../workflows/app.person-search-service.yml | 6 +- .github/workflows/app.person-service.yml | 6 +- .github/workflows/app.profil-api.yml | 6 +- .github/workflows/app.sykemelding-api.yml | 6 +- .../workflows/app.synt-sykemelding-api.yml | 6 +- .../app.synt-vedtakshistorikk-service.yml | 6 +- .../workflows/app.tenor-search-service.yml | 6 +- .github/workflows/app.testnav-ident-pool.yml | 6 +- .../app.testnorge-statisk-data-forvalter.yml | 6 +- .github/workflows/app.tilbakemelding-api.yml | 6 +- .../workflows/app.tps-messaging-service.yml | 6 +- .github/workflows/app.udi-stub.yml | 6 +- .github/workflows/app.varslinger-service.yml | 6 +- .github/workflows/build.yml | 6 +- .github/workflows/common.cypress.yml | 2 +- .github/workflows/common.integration-test.yml | 4 +- .github/workflows/common.java-build.yml | 32 ------ .github/workflows/common.js.build.yml | 34 ------ .github/workflows/common.js.publish.yml | 38 ------- .github/workflows/common.scan.sonar.yml | 36 ------ .github/workflows/common.workflow.backend.yml | 73 ++++++------ .../workflows/common.workflow.frontend.yml | 107 ++++++++---------- .../common.workflow.libs.backend.yml | 63 +++++++++++ .../common.workflow.libs.frontend.yml | 55 +++++++++ .github/workflows/idporten.yml | 10 +- .github/workflows/kafka-topics.yml | 8 +- .github/workflows/lib.commands.yml | 20 +--- .github/workflows/lib.csv-converter.yml | 20 +--- .../workflows/lib.data-transfer-objects.yml | 20 +--- .github/workflows/lib.domain.yml | 20 +--- .../workflows/lib.frontend.dolly-assets.yml | 19 +--- .../lib.frontend.dolly-komponenter.yml | 23 +--- .github/workflows/lib.frontend.dolly-lib.yml | 19 +--- .github/workflows/lib.integration-test.yml | 20 +--- .github/workflows/lib.kafka-config.yml | 20 +--- .github/workflows/lib.kafka-producers.yml | 20 +--- .github/workflows/lib.reactive-core.yml | 20 +--- .github/workflows/lib.reactive-frontend.yml | 20 +--- .github/workflows/lib.reactive-proxy.yml | 20 +--- .github/workflows/lib.reactive-security.yml | 20 +--- .../lib.reactive-session-security.yml | 20 +--- .github/workflows/lib.security-core.yml | 20 +--- .../workflows/lib.security-token-service.yml | 20 +--- .github/workflows/lib.servlet-core.yml | 20 +--- .../lib.servlet-insecure-security.yml | 20 +--- .github/workflows/lib.servlet-security.yml | 20 +--- .github/workflows/lib.slack.yml | 24 ---- .github/workflows/lib.testing.yml | 20 +--- .github/workflows/maskinporten.yml | 10 +- .github/workflows/opensearch.yml | 8 +- .github/workflows/proxy.aareg-proxy.yml | 6 +- .../proxy.aareg-synt-services-proxy.yml | 6 +- .../proxy.arbeidsplassencv-proxy.yml | 6 +- .../proxy.arena-forvalteren-proxy.yml | 6 +- .github/workflows/proxy.batch-adeo-proxy.yml | 6 +- .github/workflows/proxy.brregstub-proxy.yml | 6 +- .github/workflows/proxy.dokarkiv-proxy.yml | 6 +- .github/workflows/proxy.ereg-proxy.yml | 6 +- .github/workflows/proxy.histark-proxy.yml | 6 +- .github/workflows/proxy.inntektstub-proxy.yml | 6 +- .github/workflows/proxy.inst-proxy.yml | 6 +- .../proxy.kontoregister-person-proxy.yml | 6 +- .github/workflows/proxy.krrstub-proxy.yml | 6 +- .github/workflows/proxy.medl-proxy.yml | 6 +- .github/workflows/proxy.norg2-proxy.yml | 6 +- .github/workflows/proxy.pdl-proxy.yml | 6 +- .../proxy.pensjon-testdata-facade-proxy.yml | 6 +- .github/workflows/proxy.saf-proxy.yml | 6 +- .github/workflows/proxy.sigrunstub-proxy.yml | 6 +- .../proxy.skjermingsregister-proxy.yml | 6 +- .../proxy.synthdata-meldekort-proxy.yml | 6 +- .../workflows/proxy.tps-forvalteren-proxy.yml | 6 +- .github/workflows/proxy.udistub-proxy.yml | 6 +- .github/workflows/redis-dev.yml | 8 +- .github/workflows/redis.yml | 8 +- .github/workflows/release.yml | 4 +- .github/workflows/tests.yml | 3 +- 118 files changed, 428 insertions(+), 1032 deletions(-) delete mode 100644 .github/workflows/common.java-build.yml delete mode 100644 .github/workflows/common.js.build.yml delete mode 100644 .github/workflows/common.js.publish.yml delete mode 100644 .github/workflows/common.scan.sonar.yml create mode 100644 .github/workflows/common.workflow.libs.backend.yml create mode 100644 .github/workflows/common.workflow.libs.frontend.yml delete mode 100644 .github/workflows/lib.slack.yml diff --git a/.github/workflows/alert-dolly.yml b/.github/workflows/alert-dolly.yml index f137b6c5faf..c10a4f3fdc3 100644 --- a/.github/workflows/alert-dolly.yml +++ b/.github/workflows/alert-dolly.yml @@ -8,12 +8,14 @@ jobs: apply-alerts: name: Apply alerts to cluster runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: deploy to dev - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: dev-gcp RESOURCE: .nais/alerting-dolly.yml \ No newline at end of file diff --git a/.github/workflows/all.workflows.yml b/.github/workflows/all.workflows.yml index 84f13aa5f02..38fd815bb4c 100644 --- a/.github/workflows/all.workflows.yml +++ b/.github/workflows/all.workflows.yml @@ -9,7 +9,7 @@ on: - "frontend" type: type: choice - description: "App or proxy. Used to resolve the working directory together with name, as /." + description: "Apps or proxies. Used to resolve the working directory together with name, as /." options: - "apps" - "proxies" @@ -28,14 +28,14 @@ on: type: boolean description: "Deploy? Make sure the effective working directory contains a NAIS manifest as named below! Note: For dolly-frontend, this will also deploy with config.idporten.yml." default: false - nais-manifest: - type: string - description: "Custom NAIS manifest filename." - default: "config.yml" force-deploy-test: type: boolean description: "Deploy to test? Make sure the effective working directory contains a config.test.yml! Note: For dolly-frontend, this will also deploy with config.unstable.yml." default: false + sonar-enabled: + type: boolean + description: "Run Sonar scan?" + default: true permissions: contents: read @@ -43,16 +43,7 @@ permissions: jobs: - start: - runs-on: ubuntu-latest - steps: - - name: "Log inputs" - run: | - echo "branch: ${{ github.ref_name }}" - echo "inputs: ${{ toJSON(inputs) }}" - backend: - needs: start if: inputs.workflow == 'backend' uses: ./.github/workflows/common.workflow.backend.yml with: @@ -62,17 +53,10 @@ jobs: deploy-tag: "" force-deploy: ${{ inputs.force-deploy }} force-deploy-test: ${{ inputs.force-deploy-test }} - permissions: - contents: read - id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + sonar-enabled: ${{ inputs.sonar-enabled }} + secrets: inherit frontend: - needs: start if: inputs.workflow == 'frontend' uses: ./.github/workflows/common.workflow.frontend.yml with: @@ -80,17 +64,9 @@ jobs: working-directory: "${{ inputs.type }}/${{ inputs.name }}" image-suffix: ${{ inputs.name }} deploy-tag: "" - nais-manifest: ${{ inputs.nais-manifest }} force-deploy: ${{ inputs.force-deploy }} force-deploy-test: ${{ inputs.force-deploy-test }} force-deploy-idporten: ${{ inputs.name == 'dolly-frontend' && inputs.force-deploy }} force-deploy-unstable: ${{ inputs.name == 'dolly-frontend' && inputs.force-deploy-test }} - permissions: - contents: read - id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + sonar-enabled: ${{ inputs.sonar-enabled }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/app.adresse-service.yml b/.github/workflows/app.adresse-service.yml index 8acaea880af..1d9e5a693fd 100644 --- a/.github/workflows/app.adresse-service.yml +++ b/.github/workflows/app.adresse-service.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/app.amelding-service.yml b/.github/workflows/app.amelding-service.yml index 77017ca6d9f..4ca6ecf0943 100644 --- a/.github/workflows/app.amelding-service.yml +++ b/.github/workflows/app.amelding-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.app-tilgang-analyse-service.yml b/.github/workflows/app.app-tilgang-analyse-service.yml index 3c5f17f27fa..3193c80d81f 100644 --- a/.github/workflows/app.app-tilgang-analyse-service.yml +++ b/.github/workflows/app.app-tilgang-analyse-service.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.arbeidsforhold-service.yml b/.github/workflows/app.arbeidsforhold-service.yml index 339f7da9e05..fd352934840 100644 --- a/.github/workflows/app.arbeidsforhold-service.yml +++ b/.github/workflows/app.arbeidsforhold-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.batch-bestilling-service.yml b/.github/workflows/app.batch-bestilling-service.yml index acc02fe8548..d2fd49c3391 100644 --- a/.github/workflows/app.batch-bestilling-service.yml +++ b/.github/workflows/app.batch-bestilling-service.yml @@ -22,8 +22,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.brreg-stub.yml b/.github/workflows/app.brreg-stub.yml index 7d4a1591b6a..f486b493200 100644 --- a/.github/workflows/app.brreg-stub.yml +++ b/.github/workflows/app.brreg-stub.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.bruker-service.yml b/.github/workflows/app.bruker-service.yml index 8de7a0b70ad..fb9dd8ff020 100644 --- a/.github/workflows/app.bruker-service.yml +++ b/.github/workflows/app.bruker-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.budpro-service.yml b/.github/workflows/app.budpro-service.yml index a3311297486..489c3c21fee 100644 --- a/.github/workflows/app.budpro-service.yml +++ b/.github/workflows/app.budpro-service.yml @@ -22,8 +22,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.dolly-backend.yml b/.github/workflows/app.dolly-backend.yml index e8299e69245..91a4c83fa95 100644 --- a/.github/workflows/app.dolly-backend.yml +++ b/.github/workflows/app.dolly-backend.yml @@ -23,8 +23,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/app.dolly-frontend.yml b/.github/workflows/app.dolly-frontend.yml index e39c0e746e1..b8938892174 100644 --- a/.github/workflows/app.dolly-frontend.yml +++ b/.github/workflows/app.dolly-frontend.yml @@ -35,9 +35,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.dollystatus.yml b/.github/workflows/app.dollystatus.yml index 730f43e2f30..d4d4d53546c 100644 --- a/.github/workflows/app.dollystatus.yml +++ b/.github/workflows/app.dollystatus.yml @@ -15,9 +15,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.endringsmelding-frontend.yml b/.github/workflows/app.endringsmelding-frontend.yml index a05e180e445..0e2feae5349 100644 --- a/.github/workflows/app.endringsmelding-frontend.yml +++ b/.github/workflows/app.endringsmelding-frontend.yml @@ -19,9 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.endringsmelding-service.yml b/.github/workflows/app.endringsmelding-service.yml index e6ecb801a90..cc1ff61cc1d 100644 --- a/.github/workflows/app.endringsmelding-service.yml +++ b/.github/workflows/app.endringsmelding-service.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.ereg-batch-status-service.yml b/.github/workflows/app.ereg-batch-status-service.yml index a85fa1addd1..f9f8e2ac8fd 100644 --- a/.github/workflows/app.ereg-batch-status-service.yml +++ b/.github/workflows/app.ereg-batch-status-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.faste-data-frontend.yml b/.github/workflows/app.faste-data-frontend.yml index 7587b562734..9b70f555e74 100644 --- a/.github/workflows/app.faste-data-frontend.yml +++ b/.github/workflows/app.faste-data-frontend.yml @@ -19,9 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.generer-arbeidsforhold-populasjon-service.yml b/.github/workflows/app.generer-arbeidsforhold-populasjon-service.yml index ff7aef85a87..b3c6e0ae6ae 100644 --- a/.github/workflows/app.generer-arbeidsforhold-populasjon-service.yml +++ b/.github/workflows/app.generer-arbeidsforhold-populasjon-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.generer-navn-service.yml b/.github/workflows/app.generer-navn-service.yml index 6053e0beffd..49c9f19449d 100644 --- a/.github/workflows/app.generer-navn-service.yml +++ b/.github/workflows/app.generer-navn-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.generer-organisasjon-populasjon-service.yml b/.github/workflows/app.generer-organisasjon-populasjon-service.yml index 0ef92eaaa2c..9f8acf25d08 100644 --- a/.github/workflows/app.generer-organisasjon-populasjon-service.yml +++ b/.github/workflows/app.generer-organisasjon-populasjon-service.yml @@ -25,8 +25,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.generer-synt-amelding-service.yml b/.github/workflows/app.generer-synt-amelding-service.yml index 6f9b0273a65..07a4959b9f4 100644 --- a/.github/workflows/app.generer-synt-amelding-service.yml +++ b/.github/workflows/app.generer-synt-amelding-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.geografiske-kodeverk-service.yml b/.github/workflows/app.geografiske-kodeverk-service.yml index 0dcc356b185..4defc06331c 100644 --- a/.github/workflows/app.geografiske-kodeverk-service.yml +++ b/.github/workflows/app.geografiske-kodeverk-service.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.helsepersonell-service.yml b/.github/workflows/app.helsepersonell-service.yml index 4f90de43a9b..0d6ef0d170d 100644 --- a/.github/workflows/app.helsepersonell-service.yml +++ b/.github/workflows/app.helsepersonell-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.inntektsmelding-generator-service.yml b/.github/workflows/app.inntektsmelding-generator-service.yml index c78500e6eb4..e635b582b95 100644 --- a/.github/workflows/app.inntektsmelding-generator-service.yml +++ b/.github/workflows/app.inntektsmelding-generator-service.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.inntektsmelding-service.yml b/.github/workflows/app.inntektsmelding-service.yml index 837f9221c41..5055dd43a71 100644 --- a/.github/workflows/app.inntektsmelding-service.yml +++ b/.github/workflows/app.inntektsmelding-service.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.jenkins-batch-status-service.yml b/.github/workflows/app.jenkins-batch-status-service.yml index 9987827a628..abfdf4f8402 100644 --- a/.github/workflows/app.jenkins-batch-status-service.yml +++ b/.github/workflows/app.jenkins-batch-status-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.joark-dokument-service.yml b/.github/workflows/app.joark-dokument-service.yml index f64331dd625..8cee3172ca2 100644 --- a/.github/workflows/app.joark-dokument-service.yml +++ b/.github/workflows/app.joark-dokument-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.miljoer-service.yml b/.github/workflows/app.miljoer-service.yml index bdd7c42dd71..3f74924820b 100644 --- a/.github/workflows/app.miljoer-service.yml +++ b/.github/workflows/app.miljoer-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.oppsummeringsdokument-service.yml b/.github/workflows/app.oppsummeringsdokument-service.yml index 85cca7f8edf..1a6f227bfb8 100644 --- a/.github/workflows/app.oppsummeringsdokument-service.yml +++ b/.github/workflows/app.oppsummeringsdokument-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.organisasjon-bestilling-service.yml b/.github/workflows/app.organisasjon-bestilling-service.yml index 5d8e2ce8f35..903d696dda7 100644 --- a/.github/workflows/app.organisasjon-bestilling-service.yml +++ b/.github/workflows/app.organisasjon-bestilling-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.organisasjon-faste-data-service.yml b/.github/workflows/app.organisasjon-faste-data-service.yml index f0e03bf4f8f..fdfa1bc0257 100644 --- a/.github/workflows/app.organisasjon-faste-data-service.yml +++ b/.github/workflows/app.organisasjon-faste-data-service.yml @@ -25,8 +25,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.organisasjon-forvalter.yml b/.github/workflows/app.organisasjon-forvalter.yml index 72b5f6861c9..fc9acfc26ff 100644 --- a/.github/workflows/app.organisasjon-forvalter.yml +++ b/.github/workflows/app.organisasjon-forvalter.yml @@ -25,8 +25,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.organisasjon-mottak-service.yml b/.github/workflows/app.organisasjon-mottak-service.yml index 67dca1c75e7..00ade707220 100644 --- a/.github/workflows/app.organisasjon-mottak-service.yml +++ b/.github/workflows/app.organisasjon-mottak-service.yml @@ -24,8 +24,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.organisasjon-service.yml b/.github/workflows/app.organisasjon-service.yml index 6ccf1c20ea5..98e04c2185f 100644 --- a/.github/workflows/app.organisasjon-service.yml +++ b/.github/workflows/app.organisasjon-service.yml @@ -22,8 +22,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.organisasjon-tilgang-frontend.yml b/.github/workflows/app.organisasjon-tilgang-frontend.yml index 2b415a11c87..f9361c46812 100644 --- a/.github/workflows/app.organisasjon-tilgang-frontend.yml +++ b/.github/workflows/app.organisasjon-tilgang-frontend.yml @@ -19,9 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/app.organisasjon-tilgang-service.yml b/.github/workflows/app.organisasjon-tilgang-service.yml index fabd9193dce..2057885c7ff 100644 --- a/.github/workflows/app.organisasjon-tilgang-service.yml +++ b/.github/workflows/app.organisasjon-tilgang-service.yml @@ -17,8 +17,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.orgnummer-service.yml b/.github/workflows/app.orgnummer-service.yml index 591148ded99..d0b77ea9709 100644 --- a/.github/workflows/app.orgnummer-service.yml +++ b/.github/workflows/app.orgnummer-service.yml @@ -22,8 +22,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.oversikt-frontend.yml b/.github/workflows/app.oversikt-frontend.yml index 6ebf48e69fc..7523948aa0c 100644 --- a/.github/workflows/app.oversikt-frontend.yml +++ b/.github/workflows/app.oversikt-frontend.yml @@ -19,9 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - READER_TOKEN: ${{ secrets.READER_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.pdl-forvalter.yml b/.github/workflows/app.pdl-forvalter.yml index 98a372deb3f..351872df7a3 100644 --- a/.github/workflows/app.pdl-forvalter.yml +++ b/.github/workflows/app.pdl-forvalter.yml @@ -22,8 +22,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.person-faste-data-service.yml b/.github/workflows/app.person-faste-data-service.yml index 99c4dc32e8a..27a4f546098 100644 --- a/.github/workflows/app.person-faste-data-service.yml +++ b/.github/workflows/app.person-faste-data-service.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.person-organisasjon-tilgang-service.yml b/.github/workflows/app.person-organisasjon-tilgang-service.yml index 4d2730bf7c1..e5976bee414 100644 --- a/.github/workflows/app.person-organisasjon-tilgang-service.yml +++ b/.github/workflows/app.person-organisasjon-tilgang-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.person-search-service.yml b/.github/workflows/app.person-search-service.yml index 991727895cb..f62702c4f0d 100644 --- a/.github/workflows/app.person-search-service.yml +++ b/.github/workflows/app.person-search-service.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.person-service.yml b/.github/workflows/app.person-service.yml index de812278908..5ca03046837 100644 --- a/.github/workflows/app.person-service.yml +++ b/.github/workflows/app.person-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.profil-api.yml b/.github/workflows/app.profil-api.yml index 80d2adf4334..52be5e8d0f2 100644 --- a/.github/workflows/app.profil-api.yml +++ b/.github/workflows/app.profil-api.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.sykemelding-api.yml b/.github/workflows/app.sykemelding-api.yml index 4d72174bee7..e0c753fa319 100644 --- a/.github/workflows/app.sykemelding-api.yml +++ b/.github/workflows/app.sykemelding-api.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.synt-sykemelding-api.yml b/.github/workflows/app.synt-sykemelding-api.yml index 6d8c1fc2098..02c11f0cf9c 100644 --- a/.github/workflows/app.synt-sykemelding-api.yml +++ b/.github/workflows/app.synt-sykemelding-api.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.synt-vedtakshistorikk-service.yml b/.github/workflows/app.synt-vedtakshistorikk-service.yml index 6b5bbb48c6b..6859c17f98f 100644 --- a/.github/workflows/app.synt-vedtakshistorikk-service.yml +++ b/.github/workflows/app.synt-vedtakshistorikk-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.tenor-search-service.yml b/.github/workflows/app.tenor-search-service.yml index e7c256f6a16..0daf67eb2f2 100644 --- a/.github/workflows/app.tenor-search-service.yml +++ b/.github/workflows/app.tenor-search-service.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.testnav-ident-pool.yml b/.github/workflows/app.testnav-ident-pool.yml index 91eeb585370..dbe8b61277d 100644 --- a/.github/workflows/app.testnav-ident-pool.yml +++ b/.github/workflows/app.testnav-ident-pool.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.testnorge-statisk-data-forvalter.yml b/.github/workflows/app.testnorge-statisk-data-forvalter.yml index 4e9a952dfda..aa71a077e87 100644 --- a/.github/workflows/app.testnorge-statisk-data-forvalter.yml +++ b/.github/workflows/app.testnorge-statisk-data-forvalter.yml @@ -27,8 +27,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.tilbakemelding-api.yml b/.github/workflows/app.tilbakemelding-api.yml index e7bfacd165b..3797097f960 100644 --- a/.github/workflows/app.tilbakemelding-api.yml +++ b/.github/workflows/app.tilbakemelding-api.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.tps-messaging-service.yml b/.github/workflows/app.tps-messaging-service.yml index be914c409c6..73ab0d76054 100644 --- a/.github/workflows/app.tps-messaging-service.yml +++ b/.github/workflows/app.tps-messaging-service.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.udi-stub.yml b/.github/workflows/app.udi-stub.yml index 63dfc1eaf31..c88b7a6f023 100644 --- a/.github/workflows/app.udi-stub.yml +++ b/.github/workflows/app.udi-stub.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/app.varslinger-service.yml b/.github/workflows/app.varslinger-service.yml index f31627c2694..f4a5ce1f473 100644 --- a/.github/workflows/app.varslinger-service.yml +++ b/.github/workflows/app.varslinger-service.yml @@ -21,8 +21,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d74c6f544af..b0da88e14e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,11 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Git" run: git fetch --unshallow - name: "Java" - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 @@ -28,7 +28,7 @@ jobs: env: NAV_TOKEN: ${{ secrets.NAV_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }} + GITHUB_USERNAME: token uses: gradle/gradle-build-action@v2 with: arguments: build --scan diff --git a/.github/workflows/common.cypress.yml b/.github/workflows/common.cypress.yml index 39fc13f0cb4..17df8f8ab7c 100644 --- a/.github/workflows/common.cypress.yml +++ b/.github/workflows/common.cypress.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Setup" uses: actions/setup-node@v3 with: diff --git a/.github/workflows/common.integration-test.yml b/.github/workflows/common.integration-test.yml index 24fecafed3b..4f79adf29ae 100644 --- a/.github/workflows/common.integration-test.yml +++ b/.github/workflows/common.integration-test.yml @@ -17,11 +17,11 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Git" run: git fetch --unshallow - name: "Java" - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 21 distribution: 'temurin' diff --git a/.github/workflows/common.java-build.yml b/.github/workflows/common.java-build.yml deleted file mode 100644 index 4e55631a90c..00000000000 --- a/.github/workflows/common.java-build.yml +++ /dev/null @@ -1,32 +0,0 @@ -on: - workflow_call: - inputs: - working-directory: - type: string - required: true - secrets: - NAV_TOKEN: - required: false - -jobs: - build: - name: Build Backend - runs-on: ubuntu-latest - if: ${{ github.actor != 'dependabot[bot]' }} - steps: - - name: "Checkout" - uses: actions/checkout@v3 - - name: "Java" - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 21 - - name: "Gradle" - env: - GITHUB_USERNAME: token - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - uses: gradle/gradle-build-action@v2 - with: - build-root-directory: ${{ inputs.working-directory }} - arguments: build --scan - cache-read-only: false diff --git a/.github/workflows/common.js.build.yml b/.github/workflows/common.js.build.yml deleted file mode 100644 index 270cde5244a..00000000000 --- a/.github/workflows/common.js.build.yml +++ /dev/null @@ -1,34 +0,0 @@ -on: - workflow_call: - secrets: - READER_TOKEN: - required: false - inputs: - working-directory: - type: string - required: true - - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - packages: write - steps: - - uses: actions/checkout@v3 - - name: 'Setup Node' - uses: actions/setup-node@v3 - with: - node-version: 20.x - registry-url: https://npm.pkg.github.com/ - scope: "@navikt" - - - name: Npm install - env: - NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} - working-directory: ${{ inputs.working-directory }} - run: npm install - - name: Build code - run: npm run build - working-directory: ${{ inputs.working-directory }} diff --git a/.github/workflows/common.js.publish.yml b/.github/workflows/common.js.publish.yml deleted file mode 100644 index 50e98346790..00000000000 --- a/.github/workflows/common.js.publish.yml +++ /dev/null @@ -1,38 +0,0 @@ -on: - workflow_call: - secrets: - READER_TOKEN: - required: false - inputs: - working-directory: - type: string - required: true - -jobs: - build: - permissions: - contents: write - packages: write - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[skip ci]')" - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '20.x' - registry-url: 'https://npm.pkg.github.com' - scope: '@navikt' - - - name: Install - run: npm ci - working-directory: ${{ inputs.working-directory }} - env: - NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} - - name: Build - run: npm run build - working-directory: ${{ inputs.working-directory }} - - name: Deploy to GPR - run: npm publish - working-directory: ${{ inputs.working-directory }} - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/common.scan.sonar.yml b/.github/workflows/common.scan.sonar.yml deleted file mode 100644 index 8730135526a..00000000000 --- a/.github/workflows/common.scan.sonar.yml +++ /dev/null @@ -1,36 +0,0 @@ -on: - workflow_call: - inputs: - working-directory: - type: string - required: true - secrets: - SONAR_TOKEN: - required: true - NAV_TOKEN: - required: false - -jobs: - sonar: - runs-on: ubuntu-latest - if: ${{ github.actor != 'dependabot[bot]' }} - steps: - - name: "Checkout" - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: "Java" - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 21 - - name: "Gradle" - env: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@v2 - with: - build-root-directory: ${{ inputs.working-directory }} - arguments: test jacocoTestReport sonar --scan - cache-read-only: false diff --git a/.github/workflows/common.workflow.backend.yml b/.github/workflows/common.workflow.backend.yml index bed676cceb0..ec73d478b6a 100644 --- a/.github/workflows/common.workflow.backend.yml +++ b/.github/workflows/common.workflow.backend.yml @@ -44,8 +44,6 @@ on: required: false default: true secrets: - NAIS_DOLLY_DEPLOY_API_KEY: - required: true NAIS_WORKLOAD_IDENTITY_PROVIDER: required: true NAV_TOKEN: @@ -53,10 +51,6 @@ on: SONAR_TOKEN: required: true -env: - do-deploy-test: ${{ inputs.force-deploy-test || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag-test != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-test))) }} - do-deploy: ${{ inputs.force-deploy || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag))) }} - jobs: start: @@ -68,46 +62,47 @@ jobs: echo "inputs: ${{ toJSON(inputs) }}" echo "env: ${{ toJSON(env) }}" echo "commit: ${{ github.event.head.commit_message }}" - - sonar: - needs: start - if: inputs.sonar-enabled - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - uses: ./.github/workflows/common.scan.sonar.yml - with: - working-directory: ${{ inputs.working-directory }} + outputs: + do-deploy-test: ${{ inputs.force-deploy-test || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag-test != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-test))) }} + do-deploy: ${{ inputs.force-deploy || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag))) }} + artifact: ${{ github.run_id }}-failure build: needs: start if: github.actor != 'dependabot[bot]' runs-on: ubuntu-latest - permissions: - contents: read - id-token: write steps: - name: "Checkout" - uses: actions/checkout@v3 - - name: "Java" - uses: actions/setup-java@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Setup" + uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 - name: "Gradle" - env: - GITHUB_USERNAME: token - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - uses: gradle/gradle-build-action@v2 + id: gradle + uses: gradle/gradle-build-action@v3 with: build-root-directory: ${{ inputs.working-directory }} - arguments: build --scan + arguments: build ${{ inputs.sonar-enabled && 'jacocoTestReport sonar -Dsonar.gradle.skipCompile=true' || ''}} --scan cache-read-only: false + env: + NAV_TOKEN: ${{ secrets.NAV_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: "Reporting" + if: failure() && steps.gradle.outcome == 'failure' + uses: actions/upload-artifact@v4 + with: + name: ${{ needs.start.outputs.artifact}} + path: ${{ inputs.working-directory }}/build/reports + retention-days: 7 - name: "Docker" id: docker-build-push if: | - env.do-deploy-test == 'true' || - env.do-deploy == 'true' + needs.start.outputs.do-deploy == 'true' || + needs.start.outputs.do-deploy-test == 'true' uses: nais/docker-build-push@v0 with: team: dolly @@ -118,37 +113,33 @@ jobs: image_suffix: ${{ inputs.image-suffix }} outputs: image: ${{ steps.docker-build-push.outputs.image }} - do-deploy-test: ${{ env.do-deploy-test }} - do-deploy: ${{ env.do-deploy }} deploy: - needs: build - if: needs.build.outputs.do-deploy == 'true' + needs: [start, build] + if: needs.start.outputs.do-deploy == 'true' concurrency: ${{ inputs.image-suffix }} runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Deploy" - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: ${{ inputs.cluster }} RESOURCE: ${{ inputs.working-directory }}/${{ inputs.nais-manifest }} VAR: image=${{ needs.build.outputs.image }} deploy-test: - needs: build - if: needs.build.outputs.do-deploy-test == 'true' + needs: [start, build] + if: needs.start.outputs.do-deploy-test == 'true' concurrency: ${{ inputs.image-suffix }}-test runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Deploy (test)" - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: ${{ inputs.cluster }} RESOURCE: ${{ inputs.working-directory }}/config.test.yml VAR: image=${{ needs.build.outputs.image }} \ No newline at end of file diff --git a/.github/workflows/common.workflow.frontend.yml b/.github/workflows/common.workflow.frontend.yml index e62ce024c0d..6b5396592a2 100644 --- a/.github/workflows/common.workflow.frontend.yml +++ b/.github/workflows/common.workflow.frontend.yml @@ -15,11 +15,6 @@ on: description: "The Docker image suffix used for this particular workflow, e.g. dolly-frontend. Defaults to the workflow name." required: false default: ${{ github.workflow }} - nais-manifest: - type: string - description: "The NAIS manifest file. Make sure it exists in the working-directory. Defaults to config.yml." - required: false - default: "config.yml" deploy-tag: type: string description: "The commit message tag that will trigger a deployment on a commit to a non-master branch, e.g. #deploy-frontend. Make sure it is not a substring of other deploy tags." @@ -62,8 +57,6 @@ on: required: false default: true secrets: - NAIS_DOLLY_DEPLOY_API_KEY: - required: true NAIS_WORKLOAD_IDENTITY_PROVIDER: required: true NAV_TOKEN: @@ -73,12 +66,6 @@ on: SONAR_TOKEN: required: true -env: - do-deploy: ${{ inputs.force-deploy || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag))) }} - do-deploy-test: ${{ inputs.force-deploy-test || (!contains(github.event.head_commit.message, '#nodeploy') && inputs.deploy-tag-test != '' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-test))) }} - do-deploy-idporten: ${{ inputs.force-deploy-idporten || (!contains(github.event.head_commit.message, '#nodeploy') && inputs.deploy-tag-idporten != '' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-idporten))) }} - do-deploy-unstable: ${{ inputs.force-deploy-unstable || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag-unstable != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-unstable))) }} - jobs: start: @@ -90,16 +77,12 @@ jobs: echo "inputs: ${{ toJSON(inputs) }}" echo "env: ${{ toJSON(env) }}" echo "commit: ${{ github.event.head.commit_message }}" - - sonar: - needs: start - if: inputs.sonar-enabled - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - uses: ./.github/workflows/common.scan.sonar.yml - with: - working-directory: ${{ inputs.working-directory }} + outputs: + do-deploy: ${{ inputs.force-deploy || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag))) }} + do-deploy-test: ${{ inputs.force-deploy-test || (!contains(github.event.head_commit.message, '#nodeploy') && inputs.deploy-tag-test != '' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-test))) }} + do-deploy-idporten: ${{ inputs.force-deploy-idporten || (!contains(github.event.head_commit.message, '#nodeploy') && inputs.deploy-tag-idporten != '' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-idporten))) }} + do-deploy-unstable: ${{ inputs.force-deploy-unstable || (!contains(github.event.head_commit.message, '#nodeploy') && (inputs.deploy-tag-unstable != '') && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, inputs.deploy-tag-unstable))) }} + artifact: ${{ github.run_id }}-failure build: needs: start @@ -107,18 +90,18 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Setup (Node)" - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '20.x' registry-url: 'https://npm.pkg.github.com' scope: '@navikt' - name: "Install (Node)" - env: - NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} working-directory: ${{ inputs.working-directory }}/src/main/js run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} - name: "Build (Node)" working-directory: ${{ inputs.working-directory }}/src/main/js run: npm run build @@ -126,26 +109,34 @@ jobs: working-directory: ${{ inputs.working-directory }}/src/main/js run: mv build ../resources/static - name: "Java" - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 - name: "Gradle" - env: - GITHUB_USERNAME: token - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - uses: gradle/gradle-build-action@v2 + id: gradle + uses: gradle/gradle-build-action@v3 with: build-root-directory: ${{ inputs.working-directory }} - arguments: build --scan + arguments: build ${{ inputs.sonar-enabled && 'jacocoTestReport sonar -Dsonar.gradle.skipCompile=true' || '' }} --scan cache-read-only: false + env: + NAV_TOKEN: ${{ secrets.NAV_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: "Reporting" + if: failure() && steps.gradle.outcome == 'failure' + uses: actions/upload-artifact@v4 + with: + name: ${{ needs.start.outputs.artifact}} + path: ${{ inputs.working-directory }}/build/reports + retention-days: 7 - name: "Docker" id: docker-build-push if: | - env.do-deploy-unstable == 'true' || - env.do-deploy-idporten == 'true' || - env.do-deploy-test == 'true' || - env.do-deploy == 'true' + needs.start.outputs.do-deploy-unstable == 'true' || + needs.start.outputs.do-deploy-idporten == 'true' || + needs.start.outputs.do-deploy-test == 'true' || + needs.start.outputs.do-deploy == 'true' uses: nais/docker-build-push@v0 with: team: dolly @@ -156,73 +147,65 @@ jobs: image_suffix: ${{ inputs.image-suffix }} outputs: image: ${{ steps.docker-build-push.outputs.image }} - do-deploy-unstable: ${{ env.do-deploy-unstable }} - do-deploy-idporten: ${{ env.do-deploy-idporten }} - do-deploy-test: ${{ env.do-deploy-test }} - do-deploy: ${{ env.do-deploy }} deploy: - needs: build - if: needs.build.outputs.do-deploy == 'true' + needs: [start, build] + if: needs.start.outputs.do-deploy == 'true' concurrency: ${{ inputs.image-suffix }} runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Deploy" - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: ${{ inputs.cluster }} - RESOURCE: ${{ inputs.working-directory }}/${{ inputs.nais-manifest }} + RESOURCE: ${{ inputs.working-directory }}/config.yml VAR: image=${{ needs.build.outputs.image }} deploy-test: - needs: build - if: needs.build.outputs.do-deploy-test == 'true' + needs: [start, build] + if: needs.start.outputs.do-deploy-test == 'true' concurrency: ${{ inputs.image-suffix }}-test runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Deploy (test)" - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: ${{ inputs.cluster }} RESOURCE: ${{ inputs.working-directory }}/config.test.yml VAR: image=${{ needs.build.outputs.image }} # Only used by dolly-frontend. deploy-idporten: - needs: build - if: needs.build.outputs.do-deploy-idporten == 'true' + needs: [start, build] + if: needs.start.outputs.do-deploy-idporten == 'true' concurrency: ${{ inputs.image-suffix }}-idporten runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Deploy (idporten)" - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: ${{ inputs.cluster }} RESOURCE: ${{ inputs.working-directory }}/config.idporten.yml VAR: image=${{ needs.build.outputs.image }} # Only used by dolly-frontend. deploy-unstable: - needs: build - if: needs.build.outputs.do-deploy-unstable == 'true' + needs: [start, build] + if: needs.start.outputs.do-deploy-unstable == 'true' concurrency: ${{ inputs.image-suffix }}-unstable runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Deploy (unstable)" - uses: nais/deploy/actions/deploy@v1 + uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: ${{ inputs.cluster }} RESOURCE: ${{ inputs.working-directory }}/config.unstable.yml VAR: image=${{ needs.build.outputs.image }} \ No newline at end of file diff --git a/.github/workflows/common.workflow.libs.backend.yml b/.github/workflows/common.workflow.libs.backend.yml new file mode 100644 index 00000000000..56e6d190f51 --- /dev/null +++ b/.github/workflows/common.workflow.libs.backend.yml @@ -0,0 +1,63 @@ +on: + workflow_call: + inputs: + sonar-enabled: + type: boolean + description: "Whether to run SonarQube analysis or not." + required: false + default: true + working-directory: + type: string + description: "The working directory for the job, e.g. libs/commands (without leading/trailing slash)." + required: true + secrets: + NAV_TOKEN: + required: true + SONAR_TOKEN: + required: true + +jobs: + + start: + runs-on: ubuntu-latest + steps: + - name: "Logging" + run: | + echo "branch: ${{ github.ref }}" + echo "inputs: ${{ toJSON(inputs) }}" + echo "env: ${{ toJSON(env) }}" + echo "commit: ${{ github.event.head.commit_message }}" + outputs: + artifact: ${{ github.run_id }}-failure + + build: + needs: start + if: ${{ github.actor != 'dependabot[bot]' }} + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Setup" + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + - name: "Gradle" + id: gradle + uses: gradle/gradle-build-action@v3 + with: + build-root-directory: ${{ inputs.working-directory }} + arguments: build ${{ inputs.sonar-enabled && 'jacocoTestReport sonar -Dsonar.gradle.skipCompile=true' || '' }} --scan + cache-read-only: false + env: + NAV_TOKEN: ${{ secrets.NAV_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: "Reporting" + if: failure() && steps.gradle.outcome == 'failure' + uses: actions/upload-artifact@v4 + with: + name: ${{ needs.start.outputs.artifact}} + path: ${{ inputs.working-directory }}/build/reports + retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/common.workflow.libs.frontend.yml b/.github/workflows/common.workflow.libs.frontend.yml new file mode 100644 index 00000000000..2045a21a9e5 --- /dev/null +++ b/.github/workflows/common.workflow.libs.frontend.yml @@ -0,0 +1,55 @@ +on: + workflow_call: + inputs: + working-directory: + type: string + description: "The working directory for the job, e.g. libs/commands (without leading/trailing slash)." + required: true + secrets: + READER_TOKEN: + required: true + +jobs: + + start: + runs-on: ubuntu-latest + steps: + - name: "Logging" + run: | + echo "branch: ${{ github.ref }}" + echo "inputs: ${{ toJSON(inputs) }}" + echo "env: ${{ toJSON(env) }}" + echo "commit: ${{ github.event.head.commit_message }}" + + build: + needs: start + if: ${{ github.actor != 'dependabot[bot]' }} + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Setup" + uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: https://npm.pkg.github.com/ + scope: "@navikt" + - name: "Install" + run: npm install + working-directory: ${{ inputs.working-directory }} + env: + NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} + - name: "Build" + run: npm run build + working-directory: ${{ inputs.working-directory }} + - name: "Publish" + if: | + (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '#publish-libs')) && + (!contains(github.event.head_commit.message, '[skip ci]')) + run: npm publish + working-directory: ${{ inputs.working-directory }} + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + \ No newline at end of file diff --git a/.github/workflows/idporten.yml b/.github/workflows/idporten.yml index 92aec749c09..f7f74d0b59e 100644 --- a/.github/workflows/idporten.yml +++ b/.github/workflows/idporten.yml @@ -11,12 +11,12 @@ jobs: deploy-idporten: name: Deploy idporten runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@v3 - - uses: nais/deploy/actions/deploy@v1 - with: - team: dolly + - uses: actions/checkout@v4 + - uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: prod-gcp RESOURCE: .nais/idporten.yml diff --git a/.github/workflows/kafka-topics.yml b/.github/workflows/kafka-topics.yml index 7235d59a96e..cbeeeb676d3 100644 --- a/.github/workflows/kafka-topics.yml +++ b/.github/workflows/kafka-topics.yml @@ -13,11 +13,13 @@ jobs: deploy-kafka-topics-dev: name: Deploy to Aiven Dev runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@v3 - - uses: nais/deploy/actions/deploy@v1 + - uses: actions/checkout@v4 + - uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: dev-gcp VAR: kafka-pool=nav-dev RESOURCE: .nais/topics.yml \ No newline at end of file diff --git a/.github/workflows/lib.commands.yml b/.github/workflows/lib.commands.yml index 5423653c03d..024386b48f7 100644 --- a/.github/workflows/lib.commands.yml +++ b/.github/workflows/lib.commands.yml @@ -1,4 +1,4 @@ -name: Lib commands +name: commands on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.commands.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/commands/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/commands/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/commands' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.csv-converter.yml b/.github/workflows/lib.csv-converter.yml index ee256830fbf..cd135c78b2e 100644 --- a/.github/workflows/lib.csv-converter.yml +++ b/.github/workflows/lib.csv-converter.yml @@ -1,4 +1,4 @@ -name: Lib csv-converter +name: csv-converter on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.csv-converter.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/csv-converter/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/csv-converter/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/csv-converter' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.data-transfer-objects.yml b/.github/workflows/lib.data-transfer-objects.yml index beaf28cc0f6..34cb149eca6 100644 --- a/.github/workflows/lib.data-transfer-objects.yml +++ b/.github/workflows/lib.data-transfer-objects.yml @@ -1,4 +1,4 @@ -name: Lib data-transfer-objects +name: data-transfer-objects on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.data-transfer-objects.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/data-transfer-objects/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/data-transfer-objects/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/data-transfer-objects' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.domain.yml b/.github/workflows/lib.domain.yml index 2f5f100fa90..c0accda3d06 100644 --- a/.github/workflows/lib.domain.yml +++ b/.github/workflows/lib.domain.yml @@ -1,4 +1,4 @@ -name: Lib domain +name: domain on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.domain.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/domain/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/domain/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/domain' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.frontend.dolly-assets.yml b/.github/workflows/lib.frontend.dolly-assets.yml index 49a865fe465..d918815ada6 100644 --- a/.github/workflows/lib.frontend.dolly-assets.yml +++ b/.github/workflows/lib.frontend.dolly-assets.yml @@ -1,4 +1,4 @@ -name: Frontend lib dolly-assets +name: dolly-assets on: push: @@ -7,20 +7,11 @@ on: - .github/workflows/lib.frontend.dolly-assets.yml jobs: - build: - name: Build - permissions: - contents: write - packages: write - uses: ./.github/workflows/common.js.build.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.frontend.yml with: - working-directory: 'navikt/dolly-assets/' - publish: - name: Publish + working-directory: 'navikt/dolly-assets' permissions: contents: write packages: write - uses: ./.github/workflows/common.js.publish.yml - if: ${{ github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '#publish-libs') }} - with: - working-directory: 'navikt/dolly-assets/' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.frontend.dolly-komponenter.yml b/.github/workflows/lib.frontend.dolly-komponenter.yml index 4129a9a047f..4ada60ac058 100644 --- a/.github/workflows/lib.frontend.dolly-komponenter.yml +++ b/.github/workflows/lib.frontend.dolly-komponenter.yml @@ -1,4 +1,4 @@ -name: Frontend lib dolly-komponenter +name: dolly-komponenter on: push: @@ -7,24 +7,11 @@ on: - .github/workflows/lib.frontend.dolly-komponenter.yml jobs: - build: - name: Build - permissions: - contents: write - packages: write - uses: ./.github/workflows/common.js.build.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.frontend.yml with: - working-directory: 'navikt/dolly-komponenter/' - secrets: - READER_TOKEN: ${{ secrets.READER_TOKEN }} - publish: - name: Publish + working-directory: 'navikt/dolly-komponenter' permissions: contents: write packages: write - uses: ./.github/workflows/common.js.publish.yml - if: ${{ github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '#publish-libs') }} - with: - working-directory: 'navikt/dolly-komponenter/' - secrets: - READER_TOKEN: ${{ secrets.READER_TOKEN }} + secrets: inherit diff --git a/.github/workflows/lib.frontend.dolly-lib.yml b/.github/workflows/lib.frontend.dolly-lib.yml index beafc7d0fa1..674fb2d881c 100644 --- a/.github/workflows/lib.frontend.dolly-lib.yml +++ b/.github/workflows/lib.frontend.dolly-lib.yml @@ -1,4 +1,4 @@ -name: Frontend lib dolly-lib +name: dolly-lib on: push: @@ -7,20 +7,11 @@ on: - .github/workflows/lib.frontend.dolly-lib.yml jobs: - build: - name: Build - permissions: - contents: write - packages: write - uses: ./.github/workflows/common.js.build.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.frontend.yml with: - working-directory: 'navikt/dolly-lib/' - publish: - name: Publish + working-directory: 'navikt/dolly-lib' permissions: contents: write packages: write - uses: ./.github/workflows/common.js.publish.yml - if: ${{ github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '#publish-libs') }} - with: - working-directory: 'navikt/dolly-lib/' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.integration-test.yml b/.github/workflows/lib.integration-test.yml index 2f980bbc402..04074566673 100644 --- a/.github/workflows/lib.integration-test.yml +++ b/.github/workflows/lib.integration-test.yml @@ -1,4 +1,4 @@ -name: Lib integration-test +name: integration-test on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.reactive-core.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/integration-test/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/integration-test/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/integration-test' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.kafka-config.yml b/.github/workflows/lib.kafka-config.yml index 3de776a97ca..542bb5ece3b 100644 --- a/.github/workflows/lib.kafka-config.yml +++ b/.github/workflows/lib.kafka-config.yml @@ -1,4 +1,4 @@ -name: Lib kafka-config +name: kafka-config on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.kafka-config.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/kafka-config/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/kafka-config/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/kafka-config' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.kafka-producers.yml b/.github/workflows/lib.kafka-producers.yml index db8390fc400..cc8ccb27a49 100644 --- a/.github/workflows/lib.kafka-producers.yml +++ b/.github/workflows/lib.kafka-producers.yml @@ -1,4 +1,4 @@ -name: Lib kafka-producers +name: kafka-producers on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.kafka-producers.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/kafka-producers/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/kafka-producers/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/kafka-producers' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.reactive-core.yml b/.github/workflows/lib.reactive-core.yml index 0c1fb160faf..b9a701d1e43 100644 --- a/.github/workflows/lib.reactive-core.yml +++ b/.github/workflows/lib.reactive-core.yml @@ -1,4 +1,4 @@ -name: Lib reactive-core +name: reactive-core on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.reactive-core.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/reactive-core/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/reactive-core/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/reactive-core' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.reactive-frontend.yml b/.github/workflows/lib.reactive-frontend.yml index 06b412ac11b..4f92ae87e1b 100644 --- a/.github/workflows/lib.reactive-frontend.yml +++ b/.github/workflows/lib.reactive-frontend.yml @@ -1,4 +1,4 @@ -name: Lib reactive-frontend +name: reactive-frontend on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.reactive-frontend.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/reactive-frontend/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/reactive-frontend/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/reactive-frontend' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.reactive-proxy.yml b/.github/workflows/lib.reactive-proxy.yml index ce4bdcedf71..e01b695b0fc 100644 --- a/.github/workflows/lib.reactive-proxy.yml +++ b/.github/workflows/lib.reactive-proxy.yml @@ -1,4 +1,4 @@ -name: Lib reactive-proxy +name: reactive-proxy on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.reactive-proxy.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/reactive-proxy/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/reactive-proxy/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} + working-directory: 'libs/reactive-proxy' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.reactive-security.yml b/.github/workflows/lib.reactive-security.yml index b0aff0b2130..3c287c5ad0a 100644 --- a/.github/workflows/lib.reactive-security.yml +++ b/.github/workflows/lib.reactive-security.yml @@ -1,4 +1,4 @@ -name: Lib reactive-security +name: reactive-security on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.reactive-security.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/reactive-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/reactive-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/reactive-security' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.reactive-session-security.yml b/.github/workflows/lib.reactive-session-security.yml index 949dcc08c3d..f9a633266bb 100644 --- a/.github/workflows/lib.reactive-session-security.yml +++ b/.github/workflows/lib.reactive-session-security.yml @@ -1,4 +1,4 @@ -name: Lib reactive-session-security +name: reactive-session-security on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.reactive-session-security.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/reactive-session-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/reactive-session-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/reactive-session-security' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.security-core.yml b/.github/workflows/lib.security-core.yml index 664974f7004..7a5faa7cb11 100644 --- a/.github/workflows/lib.security-core.yml +++ b/.github/workflows/lib.security-core.yml @@ -1,4 +1,4 @@ -name: Lib security-core +name: security-core on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.security-core.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/security-core/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/security-core/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/security-core' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.security-token-service.yml b/.github/workflows/lib.security-token-service.yml index 4fb2ae974fd..ed95e46fb93 100644 --- a/.github/workflows/lib.security-token-service.yml +++ b/.github/workflows/lib.security-token-service.yml @@ -1,4 +1,4 @@ -name: Lib security-token-service +name: security-token-service on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.security-token-service.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/security-token-service/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/security-token-service/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/security-token-service' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.servlet-core.yml b/.github/workflows/lib.servlet-core.yml index b8eea07a532..ec24d7bc64c 100644 --- a/.github/workflows/lib.servlet-core.yml +++ b/.github/workflows/lib.servlet-core.yml @@ -1,4 +1,4 @@ -name: Lib servlet-core +name: servlet-core on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.servlet-core.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/servlet-core/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/servlet-core/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} + working-directory: 'libs/servlet-core' + secrets: inherit diff --git a/.github/workflows/lib.servlet-insecure-security.yml b/.github/workflows/lib.servlet-insecure-security.yml index f9358cba54c..a1f69cfa306 100644 --- a/.github/workflows/lib.servlet-insecure-security.yml +++ b/.github/workflows/lib.servlet-insecure-security.yml @@ -1,4 +1,4 @@ -name: Lib servlet-insecure-security +name: servlet-insecure-security on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.servlet-insecure-security.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/servlet-insecure-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/servlet-insecure-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/servlet-insecure-security' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.servlet-security.yml b/.github/workflows/lib.servlet-security.yml index 763a82cba9d..534b8bd2364 100644 --- a/.github/workflows/lib.servlet-security.yml +++ b/.github/workflows/lib.servlet-security.yml @@ -1,4 +1,4 @@ -name: Lib servlet-security +name: servlet-security on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.commanservlet-securityds.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/servlet-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/servlet-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/servlet-security' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/lib.slack.yml b/.github/workflows/lib.slack.yml deleted file mode 100644 index 07cdc9a7898..00000000000 --- a/.github/workflows/lib.slack.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Lib servlet-security - -on: - push: - paths: - - libs/servlet-security/** - - .github/workflows/lib.servlet-security.yml - -jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml - with: - working-directory: 'libs/servlet-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/servlet-security/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/lib.testing.yml b/.github/workflows/lib.testing.yml index 16212e5742d..14f45d07c62 100644 --- a/.github/workflows/lib.testing.yml +++ b/.github/workflows/lib.testing.yml @@ -1,4 +1,4 @@ -name: Lib testing +name: testing on: push: @@ -7,18 +7,8 @@ on: - .github/workflows/lib.testing.yml jobs: - scan: - name: Scan - uses: ./.github/workflows/common.scan.sonar.yml + workflow: + uses: ./.github/workflows/common.workflow.libs.backend.yml with: - working-directory: 'libs/testing/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - name: Build - uses: ./.github/workflows/common.java-build.yml - with: - working-directory: 'libs/testing/' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + working-directory: 'libs/testing' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/maskinporten.yml b/.github/workflows/maskinporten.yml index 5aeecc39997..d17fe4bfaf5 100644 --- a/.github/workflows/maskinporten.yml +++ b/.github/workflows/maskinporten.yml @@ -11,12 +11,12 @@ jobs: deploy-maskinporten: name: Deploy maskinporten runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@v3 - - uses: nais/deploy/actions/deploy@v1 - with: - team: dolly + - uses: actions/checkout@v4 + - uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: prod-gcp RESOURCE: .nais/maskinporten.yml diff --git a/.github/workflows/opensearch.yml b/.github/workflows/opensearch.yml index 5d5db84f73c..0a0a7fad174 100644 --- a/.github/workflows/opensearch.yml +++ b/.github/workflows/opensearch.yml @@ -13,10 +13,12 @@ jobs: deploy-opensearch: name: Deploy opensearch runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@v3 - - uses: nais/deploy/actions/deploy@v1 + - uses: actions/checkout@v4 + - uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: dev-gcp RESOURCE: .nais/opensearch.yml \ No newline at end of file diff --git a/.github/workflows/proxy.aareg-proxy.yml b/.github/workflows/proxy.aareg-proxy.yml index 28d7ddc113a..632e76c7e4a 100644 --- a/.github/workflows/proxy.aareg-proxy.yml +++ b/.github/workflows/proxy.aareg-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.aareg-synt-services-proxy.yml b/.github/workflows/proxy.aareg-synt-services-proxy.yml index 244813526fc..0e22fc20172 100644 --- a/.github/workflows/proxy.aareg-synt-services-proxy.yml +++ b/.github/workflows/proxy.aareg-synt-services-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.arbeidsplassencv-proxy.yml b/.github/workflows/proxy.arbeidsplassencv-proxy.yml index 404f0a8c062..8f0f7971e44 100644 --- a/.github/workflows/proxy.arbeidsplassencv-proxy.yml +++ b/.github/workflows/proxy.arbeidsplassencv-proxy.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.arena-forvalteren-proxy.yml b/.github/workflows/proxy.arena-forvalteren-proxy.yml index be18f3e63fa..4331b3f2b5f 100644 --- a/.github/workflows/proxy.arena-forvalteren-proxy.yml +++ b/.github/workflows/proxy.arena-forvalteren-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.batch-adeo-proxy.yml b/.github/workflows/proxy.batch-adeo-proxy.yml index 5baf1f00748..9d791c38e8c 100644 --- a/.github/workflows/proxy.batch-adeo-proxy.yml +++ b/.github/workflows/proxy.batch-adeo-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.brregstub-proxy.yml b/.github/workflows/proxy.brregstub-proxy.yml index 5e6995ee696..ab04f705939 100644 --- a/.github/workflows/proxy.brregstub-proxy.yml +++ b/.github/workflows/proxy.brregstub-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.dokarkiv-proxy.yml b/.github/workflows/proxy.dokarkiv-proxy.yml index 4d16fb4ff2a..a6b575f9806 100644 --- a/.github/workflows/proxy.dokarkiv-proxy.yml +++ b/.github/workflows/proxy.dokarkiv-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.ereg-proxy.yml b/.github/workflows/proxy.ereg-proxy.yml index 8ecffe0130e..a197a017fe1 100644 --- a/.github/workflows/proxy.ereg-proxy.yml +++ b/.github/workflows/proxy.ereg-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.histark-proxy.yml b/.github/workflows/proxy.histark-proxy.yml index cd477338e80..046bc8be64e 100644 --- a/.github/workflows/proxy.histark-proxy.yml +++ b/.github/workflows/proxy.histark-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.inntektstub-proxy.yml b/.github/workflows/proxy.inntektstub-proxy.yml index 0d0ff4f0b24..e73bfc8e7c9 100644 --- a/.github/workflows/proxy.inntektstub-proxy.yml +++ b/.github/workflows/proxy.inntektstub-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.inst-proxy.yml b/.github/workflows/proxy.inst-proxy.yml index efcf944cc00..9c0ef661478 100644 --- a/.github/workflows/proxy.inst-proxy.yml +++ b/.github/workflows/proxy.inst-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.kontoregister-person-proxy.yml b/.github/workflows/proxy.kontoregister-person-proxy.yml index 2618e3be7d7..d2290ff5e0f 100644 --- a/.github/workflows/proxy.kontoregister-person-proxy.yml +++ b/.github/workflows/proxy.kontoregister-person-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.krrstub-proxy.yml b/.github/workflows/proxy.krrstub-proxy.yml index 83f126d1f55..3ede6c3da23 100644 --- a/.github/workflows/proxy.krrstub-proxy.yml +++ b/.github/workflows/proxy.krrstub-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.medl-proxy.yml b/.github/workflows/proxy.medl-proxy.yml index 816b6fa3ad9..43ec423a15e 100644 --- a/.github/workflows/proxy.medl-proxy.yml +++ b/.github/workflows/proxy.medl-proxy.yml @@ -22,8 +22,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.norg2-proxy.yml b/.github/workflows/proxy.norg2-proxy.yml index eeeab46890a..8e2af7ab410 100644 --- a/.github/workflows/proxy.norg2-proxy.yml +++ b/.github/workflows/proxy.norg2-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.pdl-proxy.yml b/.github/workflows/proxy.pdl-proxy.yml index f9070b8401a..6e62a33f63d 100644 --- a/.github/workflows/proxy.pdl-proxy.yml +++ b/.github/workflows/proxy.pdl-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.pensjon-testdata-facade-proxy.yml b/.github/workflows/proxy.pensjon-testdata-facade-proxy.yml index cecc122f40a..9b4fbacd883 100644 --- a/.github/workflows/proxy.pensjon-testdata-facade-proxy.yml +++ b/.github/workflows/proxy.pensjon-testdata-facade-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.saf-proxy.yml b/.github/workflows/proxy.saf-proxy.yml index 8ad13efbf17..1b391d20770 100644 --- a/.github/workflows/proxy.saf-proxy.yml +++ b/.github/workflows/proxy.saf-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.sigrunstub-proxy.yml b/.github/workflows/proxy.sigrunstub-proxy.yml index 5ce006a6a9c..bf1c3192427 100644 --- a/.github/workflows/proxy.sigrunstub-proxy.yml +++ b/.github/workflows/proxy.sigrunstub-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.skjermingsregister-proxy.yml b/.github/workflows/proxy.skjermingsregister-proxy.yml index 227bcde795b..75f5ee4bc6e 100644 --- a/.github/workflows/proxy.skjermingsregister-proxy.yml +++ b/.github/workflows/proxy.skjermingsregister-proxy.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.synthdata-meldekort-proxy.yml b/.github/workflows/proxy.synthdata-meldekort-proxy.yml index ef36d482a0e..d4c0203c9b9 100644 --- a/.github/workflows/proxy.synthdata-meldekort-proxy.yml +++ b/.github/workflows/proxy.synthdata-meldekort-proxy.yml @@ -19,8 +19,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.tps-forvalteren-proxy.yml b/.github/workflows/proxy.tps-forvalteren-proxy.yml index 7a81ab1a699..4622be4ffa0 100644 --- a/.github/workflows/proxy.tps-forvalteren-proxy.yml +++ b/.github/workflows/proxy.tps-forvalteren-proxy.yml @@ -18,8 +18,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/proxy.udistub-proxy.yml b/.github/workflows/proxy.udistub-proxy.yml index 9784f847502..030f7c9c4bd 100644 --- a/.github/workflows/proxy.udistub-proxy.yml +++ b/.github/workflows/proxy.udistub-proxy.yml @@ -20,8 +20,4 @@ jobs: permissions: contents: read id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + secrets: inherit diff --git a/.github/workflows/redis-dev.yml b/.github/workflows/redis-dev.yml index ba969b5608a..8d81f66df80 100644 --- a/.github/workflows/redis-dev.yml +++ b/.github/workflows/redis-dev.yml @@ -10,10 +10,12 @@ jobs: deploy-redis: name: Deploy redis runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@v3 - - uses: nais/deploy/actions/deploy@v1 + - uses: actions/checkout@v4 + - uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: dev-gcp RESOURCE: .nais/redis-dev.yml \ No newline at end of file diff --git a/.github/workflows/redis.yml b/.github/workflows/redis.yml index 20918085bd6..9b5521f36dd 100644 --- a/.github/workflows/redis.yml +++ b/.github/workflows/redis.yml @@ -12,10 +12,12 @@ jobs: deploy-redis: name: Deploy redis runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@v3 - - uses: nais/deploy/actions/deploy@v1 + - uses: actions/checkout@v4 + - uses: nais/deploy/actions/deploy@v2 env: - APIKEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} CLUSTER: dev-gcp RESOURCE: .nais/redis.yml \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a10faee9a95..98810bf15c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,11 +16,11 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Fetch git history" run: git fetch --unshallow - name: "Java" - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0fb86632182..0a27c9e4c1e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,5 +24,4 @@ jobs: with: working-directory: 'apps/person-organisasjon-tilgang-service/' healthcheck: 'http://localhost:8001/internal/isAlive' - secrets: - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} \ No newline at end of file + secrets: inherit \ No newline at end of file From fffbf7a044af3e77336452821cc546691e3e2260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristen=20H=C3=A6rum?= Date: Thu, 8 Feb 2024 13:51:14 +0100 Subject: [PATCH 09/19] =?UTF-8?q?Oppdatert=20mapping=20av=20localdate=20->?= =?UTF-8?q?=20localdatetime=20#deploy-test-dolly-ba=E2=80=A6=20(#3410)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Oppdatert mapping LocalDate -> LocalDateTime + Oppdatert XML-konvertering --- .../InntektsmeldingMappingStrategy.java | 104 ++++++++- .../RsInntektsmelding.java | 155 +++++++++----- .../InntektsmeldingMappingStrategyTest.java | 199 ++++++++++++++++++ .../util/XmlConverter.java | 7 + .../util/XmlInntektsmelding201809.java | 20 +- .../util/XmlInntektsmelding201812.java | 20 +- .../InntektsmeldingApplicationStarter.java | 2 +- .../v1/RsInntektsmeldingRequest.java | 4 +- .../v1/rs/RsArbeidsforhold.java | 4 +- .../v1/rs/RsDelvisFravaer.java | 8 +- .../v1/rs/RsEndringIRefusjon.java | 4 +- .../v1/rs/RsGraderingIForeldrepenger.java | 4 + .../v1/rs/RsInntektsmelding.java | 4 +- .../v1/rs/RsNaturalytelseDetaljer.java | 6 +- .../v1/rs/RsPeriode.java | 10 +- .../v1/rs/RsRefusjon.java | 4 +- .../v1/rs/RsUtsettelseAvForeldrepenger.java | 4 + 17 files changed, 460 insertions(+), 99 deletions(-) create mode 100644 apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java index de3fd9f129c..dd7ceac5fe8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java @@ -8,11 +8,18 @@ import no.nav.testnav.libs.dto.dokarkiv.v1.RsJoarkMetadata; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.RsInntektsmeldingRequest; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakInnsendingKodeListe; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsforhold; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsAvsendersystem; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsDelvisFravaer; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsEndringIRefusjon; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsKontaktinformasjon; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsNaturalytelseDetaljer; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsPeriode; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsRefusjon; import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; import org.springframework.stereotype.Component; +import java.time.LocalDate; import java.time.LocalDateTime; import static java.util.Objects.isNull; @@ -40,14 +47,15 @@ public void register(MapperFactory factory) { public void mapAtoB(RsInntektsmelding rsInntektsmelding, InntektsmeldingRequest inntektsmelding, MappingContext context) { - if (isNull(rsInntektsmelding.getJoarkMetadata())) { + if (isNull(inntektsmelding.getJoarkMetadata())) { inntektsmelding.setJoarkMetadata(new RsJoarkMetadata()); } + inntektsmelding.getJoarkMetadata().setAvsenderMottakerIdType( - (!inntektsmelding.getInntekter().isEmpty() && - nonNull(inntektsmelding.getInntekter().getFirst().getArbeidsgiver()) ? - Avsendertype.ORGNR : Avsendertype.FNR).name() - ); + (!rsInntektsmelding.getInntekter().isEmpty() && + nonNull(rsInntektsmelding.getInntekter().getFirst().getArbeidsgiver()) ? + Avsendertype.ORGNR : Avsendertype.FNR).name()); + inntektsmelding.setArbeidstakerFnr((String) context.getProperty("ident")); } }) @@ -80,9 +88,95 @@ public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding, } inntektsmelding.getAvsendersystem().setSystemnavn("Dolly"); inntektsmelding.getAvsendersystem().setSystemversjon("2.0"); + + inntektsmelding.setStartdatoForeldrepengeperiode(toLocalDateTime(rsInntektsmelding.getStartdatoForeldrepengeperiode())); + } + }) + + .exclude("startdatoForeldrepengeperiode") + .byDefault() + .register(); + + factory.classMap(RsInntektsmelding.RsArbeidsforhold.class, RsArbeidsforhold.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsInntektsmelding.RsArbeidsforhold rsArbeidsforhold, + RsArbeidsforhold arbeidsforhold, MappingContext context) { + + arbeidsforhold.setFoersteFravaersdag(toLocalDateTime(rsArbeidsforhold.getFoersteFravaersdag())); + } + }) + .exclude("foersteFravaersdag") + .byDefault() + .register(); + + factory.classMap(RsInntektsmelding.RsDelvisFravaer.class, RsDelvisFravaer.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsInntektsmelding.RsDelvisFravaer rsDelvisFravaer, + RsDelvisFravaer delvisFravaer, MappingContext context) { + + delvisFravaer.setDato(toLocalDateTime(rsDelvisFravaer.getDato())); + } + }) + .exclude("dato") + .byDefault() + .register(); + + factory.classMap(RsInntektsmelding.RsNaturalYtelseDetaljer.class, RsNaturalytelseDetaljer.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsInntektsmelding.RsNaturalYtelseDetaljer rsNaturalYtelseDetaljer, + RsNaturalytelseDetaljer naturalytelseDetaljer, MappingContext context) { + + naturalytelseDetaljer.setFom(toLocalDateTime(rsNaturalYtelseDetaljer.getFom())); + } + }) + .exclude("fom") + .byDefault() + .register(); + + factory.classMap(RsInntektsmelding.RsRefusjon.class, RsRefusjon.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsInntektsmelding.RsRefusjon rsRefusjon, + RsRefusjon refusjon, MappingContext context) { + + refusjon.setRefusjonsopphoersdato(toLocalDateTime(rsRefusjon.getRefusjonsopphoersdato())); } }) + .exclude("refusjonsopphoersdato") .byDefault() .register(); + + factory.classMap(RsInntektsmelding.RsEndringIRefusjon.class, RsEndringIRefusjon.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsInntektsmelding.RsEndringIRefusjon rsRefusjon, + RsEndringIRefusjon refusjon, MappingContext context) { + + refusjon.setEndringsdato(toLocalDateTime(rsRefusjon.getEndringsdato())); + } + }) + .exclude("endringsdato") + .byDefault() + .register(); + + factory.classMap(RsInntektsmelding.RsPeriode.class, RsPeriode.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsInntektsmelding.RsPeriode rsPeriode, + RsPeriode periode, MappingContext context) { + + periode.setFom(toLocalDateTime(rsPeriode.getFom())); + periode.setTom(toLocalDateTime(rsPeriode.getTom())); + } + }) + .register(); + } + + private static LocalDateTime toLocalDateTime(LocalDate localDate) { + + return nonNull(localDate) ? localDate.atStartOfDay() : null; } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java index 7f1b84503d7..52cb563c079 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java @@ -1,33 +1,41 @@ package no.nav.dolly.domain.resultset.inntektsmeldingstub; -import com.fasterxml.jackson.annotation.JsonInclude; import lombok.AllArgsConstructor; -import lombok.Getter; +import lombok.Builder; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Setter; import org.springframework.data.elasticsearch.annotations.DateFormat; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; -@Getter -@Setter +import static java.util.Objects.isNull; + +@Data +@Builder @NoArgsConstructor @AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_NULL) public class RsInntektsmelding { private List inntekter; private JoarkMetadata joarkMetadata; - @Getter - @Setter + public List getInntekter() { + + if (isNull(inntekter)) { + inntekter = new ArrayList<>(); + } + return inntekter; + } + + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class JoarkMetadata { private String avsenderMottakerIdType; @@ -45,11 +53,10 @@ public static class JoarkMetadata { private String variantformatOriginal; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class Inntektsmelding { private AarsakTilInnsendingType aarsakTilInnsending; @@ -67,25 +74,32 @@ public static class Inntektsmelding { private LocalDate startdatoForeldrepengeperiode; private RsSykepengerIArbeidsgiverperioden sykepengerIArbeidsgiverperioden; private YtelseType ytelse; + + public List getPleiepengerPerioder() { + + if (isNull(pleiepengerPerioder)) { + pleiepengerPerioder = new ArrayList<>(); + } + return pleiepengerPerioder; + } } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsSykepengerIArbeidsgiverperioden { private List arbeidsgiverperiodeListe; private BegrunnelseForReduksjonEllerIkkeUtbetaltType begrunnelseForReduksjonEllerIkkeUtbetalt; private Double bruttoUtbetalt; + } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsRefusjon { private List endringIRefusjonListe; @@ -94,11 +108,10 @@ public static class RsRefusjon { private LocalDate refusjonsopphoersdato; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsEndringIRefusjon { @Field(type = FieldType.Date, format = DateFormat.basic_date, pattern = "uuuu-MM-dd") @@ -106,11 +119,10 @@ public static class RsEndringIRefusjon { private Double refusjonsbeloepPrMnd; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsNaturalYtelseDetaljer { private Double beloepPrMnd; @@ -119,23 +131,37 @@ public static class RsNaturalYtelseDetaljer { private NaturalytelseType naturalytelseType; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsOmsorgspenger { private List delvisFravaersListe; private List fravaersPerioder; private Boolean harUtbetaltPliktigeDager; + + public List getDelvisFravaersListe() { + + if (isNull(delvisFravaersListe)) { + delvisFravaersListe = new ArrayList<>(); + } + return delvisFravaersListe; + } + + public List getFravaersPerioder() { + + if (isNull(fravaersPerioder)) { + fravaersPerioder = new ArrayList<>(); + } + return fravaersPerioder; + } } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsDelvisFravaer { @Field(type = FieldType.Date, format = DateFormat.basic_date, pattern = "uuuu-MM-dd") @@ -143,11 +169,10 @@ public static class RsDelvisFravaer { private Double timer; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsAvsendersystem { @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second, pattern = "uuuu-MM-dd'T'HH:mm:ss") @@ -156,44 +181,40 @@ public static class RsAvsendersystem { private String systemversjon; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsArbeidsgiver { private RsKontaktinformasjon kontaktinformasjon; private String virksomhetsnummer; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsArbeidsgiverPrivat { private RsKontaktinformasjon kontaktinformasjon; private String arbeidsgiverFnr; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsKontaktinformasjon { private String kontaktinformasjonNavn; private String telefonnummer; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsArbeidsforhold { private String arbeidsforholdId; @@ -203,45 +224,65 @@ public static class RsArbeidsforhold { private LocalDate foersteFravaersdag; private List graderingIForeldrepengerListe; private List utsettelseAvForeldrepengerListe; + + public List getAvtaltFerieListe() { + + if (isNull(avtaltFerieListe)) { + avtaltFerieListe = new ArrayList<>(); + } + return avtaltFerieListe; + } + + public List getGraderingIForeldrepengerListe() { + + if (isNull(graderingIForeldrepengerListe)) { + graderingIForeldrepengerListe = new ArrayList<>(); + } + return graderingIForeldrepengerListe; + } + + public List getUtsettelseAvForeldrepengerListe() { + + if (isNull(utsettelseAvForeldrepengerListe)) { + utsettelseAvForeldrepengerListe = new ArrayList<>(); + } + return utsettelseAvForeldrepengerListe; + } } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsUtsettelseAvForeldrepenger { private AarsakTilUtsettelseType aarsakTilUtsettelse; private RsPeriode periode; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsGraderingIForeldrepenger { private Integer arbeidstidprosent; private RsPeriode periode; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsAltinnInntekt { private AarsakVedEndringType aarsakVedEndring; private Double beloep; } - @Getter - @Setter + @Data + @Builder @NoArgsConstructor @AllArgsConstructor - @JsonInclude(JsonInclude.Include.NON_NULL) public static class RsPeriode { @Field(type = FieldType.Date, format = DateFormat.basic_date, pattern = "uuuu-MM-dd") diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java new file mode 100644 index 00000000000..c168d7524de --- /dev/null +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java @@ -0,0 +1,199 @@ +package no.nav.dolly.bestilling.inntektsmelding.mapper; + +import ma.glasnost.orika.MapperFacade; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakTilInnsendingType; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakTilUtsettelseType; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.AarsakVedEndringType; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.BegrunnelseForReduksjonEllerIkkeUtbetaltType; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.NaturalytelseType; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.RsInntektsmelding; +import no.nav.dolly.domain.resultset.inntektsmeldingstub.YtelseType; +import no.nav.dolly.mapper.MappingContextUtils; +import no.nav.dolly.mapper.strategy.LocalDateCustomMapping; +import no.nav.dolly.mapper.utils.MapperTestUtils; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakInnsendingKodeListe; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.YtelseKodeListe; +import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; + + +@ExtendWith(MockitoExtension.class) +public class InntektsmeldingMappingStrategyTest { + + private static final LocalDate START_DATO = LocalDate.of(2020, 1, 1); + private static final LocalDate SLUTT_DATO = LocalDate.of(2023, 12, 31); + private static final LocalDateTime INNSENDING_TIDSPUNKT = LocalDateTime.of(2024, 2, 8, 9, 48); + + private static final String DUMMY = "dummy"; + + private MapperFacade mapperFacade; + + @BeforeEach + void setup() { + mapperFacade = MapperTestUtils.createMapperFacadeForMappingStrategy(new LocalDateCustomMapping(), new InntektsmeldingMappingStrategy()); + } + + @Test + void mapJoarkdataAllefelter() { + + var target = mapperFacade.map(populateRsInntektsmelding(), InntektsmeldingRequest.class); + assertThat(target.getJoarkMetadata().getJournalpostType(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getAvsenderMottakerIdType(), is(equalTo("ORGNR"))); + assertThat(target.getJoarkMetadata().getBrukerIdType(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getTema(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getTittel(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getKanal(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getEksternReferanseId(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getFiltypeOriginal(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getFiltypeArkiv(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getVariantformatOriginal(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getVariantformatArkiv(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getBrevkode(), is(equalTo(DUMMY))); + assertThat(target.getJoarkMetadata().getBrevkategori(), is(equalTo(DUMMY))); + } + + @Test + void mapJoarkdataEmptyyMedIdent() { + + var context = MappingContextUtils.getMappingContext(); + context.setProperty("ident", "123"); + + var kilde = populateRsInntektsmelding(); + kilde.setJoarkMetadata(null); + + var target = mapperFacade.map(new RsInntektsmelding(), InntektsmeldingRequest.class, context); + assertThat(target.getArbeidstakerFnr(), is(equalTo("123"))); + assertThat(target.getJoarkMetadata().getAvsenderMottakerIdType(), is(equalTo("FNR"))); + } + + @Test + void mapInntektsmeldingSjekkeEnumFelter() { + + var target = mapperFacade.map(populateRsInntektsmelding(), InntektsmeldingRequest.class).getInntekter().getFirst(); + assertThat(target.getAarsakTilInnsending(), is(equalTo(AarsakInnsendingKodeListe.NY))); + assertThat(target.getArbeidsforhold().getBeregnetInntekt().getAarsakVedEndring(), is(equalTo("TARIFFENDRING"))); + assertThat(target.getArbeidsforhold().getUtsettelseAvForeldrepengerListe().getFirst().getAarsakTilUtsettelse(), is(equalTo("LOVBESTEMT_FERIE"))); + assertThat(target.getSykepengerIArbeidsgiverperioden().getBegrunnelseForReduksjonEllerIkkeUtbetalt(), is(equalTo("BETVILER_ARBEIDSUFOERHET"))); + assertThat(target.getYtelse(), is(equalTo(YtelseKodeListe.OPPLAERINGSPENGER))); + assertThat(target.getOpphoerAvNaturalytelseListe().getFirst().getNaturalytelseType(), is(equalTo("BEDRIFTSBARNEHAGEPLASS"))); + assertThat(target.getGjenopptakelseNaturalytelseListe().getFirst().getNaturalytelseType(), is(equalTo("BEDRIFTSBARNEHAGEPLASS"))); + } + + + private RsInntektsmelding populateRsInntektsmelding() { + + return RsInntektsmelding.builder() + .joarkMetadata(RsInntektsmelding.JoarkMetadata.builder() + .avsenderMottakerIdType(DUMMY) + .brevkategori(DUMMY) + .brevkode(DUMMY) + .brukerIdType(DUMMY) + .eksternReferanseId(DUMMY) + .filtypeArkiv(DUMMY) + .filtypeOriginal(DUMMY) + .journalpostType(DUMMY) + .kanal(DUMMY) + .tema(DUMMY) + .tittel(DUMMY) + .variantformatArkiv(DUMMY) + .variantformatOriginal(DUMMY) + .build()) + .inntekter(List.of(RsInntektsmelding.Inntektsmelding.builder() + .aarsakTilInnsending(AarsakTilInnsendingType.NY) + .arbeidsforhold(RsInntektsmelding.RsArbeidsforhold.builder() + .arbeidsforholdId("1") + .avtaltFerieListe(List.of(getPeriode())) + .beregnetInntekt(RsInntektsmelding.RsAltinnInntekt.builder() + .aarsakVedEndring(AarsakVedEndringType.TARIFFENDRING) + .beloep(1.0) + .build()) + .foersteFravaersdag(START_DATO) + .graderingIForeldrepengerListe(List.of(RsInntektsmelding.RsGraderingIForeldrepenger.builder() + .arbeidstidprosent(100) + .periode(getPeriode()) + .build())) + .utsettelseAvForeldrepengerListe(List.of(RsInntektsmelding.RsUtsettelseAvForeldrepenger.builder() + .aarsakTilUtsettelse(AarsakTilUtsettelseType.LOVBESTEMT_FERIE) + .periode(getPeriode()) + .build())) + .build()) + .arbeidsgiver(RsInntektsmelding.RsArbeidsgiver.builder() + .kontaktinformasjon(getKontaktinformasjon()) + .virksomhetsnummer(DUMMY) + .build()) + .arbeidsgiverPrivat(RsInntektsmelding.RsArbeidsgiverPrivat.builder() + .kontaktinformasjon(getKontaktinformasjon()) + .arbeidsgiverFnr(DUMMY) + .build()) + .avsendersystem(RsInntektsmelding.RsAvsendersystem.builder() + .innsendingstidspunkt(INNSENDING_TIDSPUNKT) + .systemnavn(DUMMY) + .systemversjon("1") + .build()) + .gjenopptakelseNaturalytelseListe(List.of(getNaturalYtelser())) + .naerRelasjon(true) + .omsorgspenger(RsInntektsmelding.RsOmsorgspenger.builder() + .delvisFravaersListe(List.of(RsInntektsmelding.RsDelvisFravaer.builder() + .dato(START_DATO) + .timer(100.0) + .build())) + .fravaersPerioder(List.of(getPeriode())) + .harUtbetaltPliktigeDager(true) + .build()) + .opphoerAvNaturalytelseListe(List.of(getNaturalYtelser())) + .pleiepengerPerioder(List.of(getPeriode())) + .refusjon(RsInntektsmelding.RsRefusjon.builder() + .endringIRefusjonListe(List.of(RsInntektsmelding.RsEndringIRefusjon.builder() + .endringsdato(START_DATO) + .refusjonsbeloepPrMnd(1000.0) + .build())) + .refusjonsbeloepPrMnd(500.0) + .refusjonsopphoersdato(SLUTT_DATO) + .build()) + .startdatoForeldrepengeperiode(START_DATO) + .sykepengerIArbeidsgiverperioden(RsInntektsmelding.RsSykepengerIArbeidsgiverperioden.builder() + .arbeidsgiverperiodeListe(List.of(getPeriode())) + .bruttoUtbetalt(100.0) + .begrunnelseForReduksjonEllerIkkeUtbetalt(BegrunnelseForReduksjonEllerIkkeUtbetaltType.BETVILER_ARBEIDSUFOERHET) + .build()) + .ytelse(YtelseType.OPPLAERINGSPENGER) + .build())) + .build(); + } + + private static RsInntektsmelding.RsPeriode getPeriode() { + + return RsInntektsmelding.RsPeriode.builder() + .fom(START_DATO) + .tom(SLUTT_DATO) + .build(); + } + + private static RsInntektsmelding.RsKontaktinformasjon getKontaktinformasjon() { + + return RsInntektsmelding.RsKontaktinformasjon.builder() + .kontaktinformasjonNavn(DUMMY) + .telefonnummer(DUMMY) + .build(); + } + + private static RsInntektsmelding.RsNaturalYtelseDetaljer getNaturalYtelser() { + + return RsInntektsmelding.RsNaturalYtelseDetaljer.builder() + .beloepPrMnd(1000.0) + .naturalytelseType(NaturalytelseType.BEDRIFTSBARNEHAGEPLASS) + .fom(START_DATO) + .build(); + } +} diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java index da1e0c21542..ea46753e7b0 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlConverter.java @@ -13,6 +13,8 @@ import java.io.StringWriter; import java.math.BigDecimal; import java.math.BigInteger; +import java.time.LocalDate; +import java.time.LocalDateTime; import static java.util.Objects.nonNull; @@ -82,4 +84,9 @@ public static String toCamelCase(String value) { return nonNull(value) ? CaseUtils.toCamelCase(value, true, '_') : null; } + + public static LocalDate toLocalDate(LocalDateTime localDateTime) { + + return nonNull(localDateTime) ? localDateTime.toLocalDate() : null; + } } diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java index 1bf55d14da7..98dc208fd0e 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201809.java @@ -56,6 +56,7 @@ import static java.util.Objects.isNull; import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigDecimal; import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigInteger; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toLocalDate; public class XmlInntektsmelding201809 { @@ -81,7 +82,7 @@ public static XMLInntektsmeldingM createInntektsmelding(RsInntektsmelding meldin XMLSykepengerIArbeidsgiverperioden.class, createSykepengerIArbeidsgiverperioden(melding.getSykepengerIArbeidsgiverperioden())), new JAXBElement<>(new QName(NAMESPACE_URI, "startdatoForeldrepengerperiode"), - LocalDate.class, melding.getStartdatoForeldrepengeperiode()), + LocalDate.class, toLocalDate(melding.getStartdatoForeldrepengeperiode())), new JAXBElement<>(new QName(NAMESPACE_URI, "opphoerAvNaturalyrelseListe"), XMLOpphoerAvNaturalytelseListe.class, createOpphoerAvNaturalytelseListe(melding.getOpphoerAvNaturalytelseListe())), @@ -132,7 +133,7 @@ private static XMLDelvisFravaersListe createDelvisFravaerListe(List(new QName(NAMESPACE_URI, "dato"), LocalDate.class, delvisFravaer.getDato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "dato"), LocalDate.class, toLocalDate(delvisFravaer.getDato())), new JAXBElement<>(new QName(NAMESPACE_URI, "timer"), BigDecimal.class, toBigDecimal(delvisFravaer.getTimer())) ); } @@ -178,8 +179,8 @@ private static XMLOpphoerAvNaturalytelseListe createOpphoerAvNaturalytelseListe( private static XMLNaturalytelseDetaljer createNaturalytelse(RsNaturalytelseDetaljer detaljer) { return new XMLNaturalytelseDetaljer( - new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, detaljer.getNaturaytelseType()), - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, detaljer.getFom()), + new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, detaljer.getNaturalytelseType()), + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, toLocalDate(detaljer.getFom())), new JAXBElement<>(new QName(NAMESPACE_URI, "beloepPrMnd"), BigDecimal.class, toBigDecimal(detaljer.getBeloepPrMnd()))); } @@ -219,7 +220,8 @@ private static XMLRefusjon createRefusjon(RsRefusjon refusjon) { return new XMLRefusjon( new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, toBigDecimal(refusjon.getRefusjonsbeloepPrMnd())), - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, refusjon.getRefusjonsopphoersdato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, + toLocalDate(refusjon.getRefusjonsopphoersdato())), new JAXBElement<>( new QName(NAMESPACE_URI, "endringIRefusjonListe"), XMLEndringIRefusjonsListe.class, @@ -241,7 +243,7 @@ private static XMLEndringIRefusjon createEndringIRefusjon(RsEndringIRefusjon end } return new XMLEndringIRefusjon( - new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, endring.getEndringsdato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, toLocalDate(endring.getEndringsdato())), new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, toBigDecimal(endring.getRefusjonsbeloepPrMnd())) ); } @@ -250,7 +252,7 @@ private static XMLArbeidsforhold createArbeidsforhold(RsArbeidsforhold arbeidsfo return new XMLArbeidsforhold( new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforholdId"), String.class, arbeidsforhold.getArbeidsforholdId()), - new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, arbeidsforhold.getFoersteFravaersdag()), + new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, toLocalDate(arbeidsforhold.getFoersteFravaersdag())), new JAXBElement<>(new QName(NAMESPACE_URI, "beregnetInntekt"), XMLInntekt.class, createInntekt(arbeidsforhold.getBeregnetInntekt())), new JAXBElement<>(new QName(NAMESPACE_URI, "avtaltFerieListe"), XMLAvtaltFerieListe.class, createAvtaltFerieListe(arbeidsforhold.getAvtaltFerieListe())), new JAXBElement<>( @@ -305,8 +307,8 @@ private static XMLPeriode createPeriode(RsPeriode periode) { return null; } return new XMLPeriode( - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, periode.getFom()), - new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, periode.getTom()) + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, toLocalDate(periode.getFom())), + new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, toLocalDate(periode.getTom())) ); } diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java index 5c8c29881e9..cba05b2d20b 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/util/XmlInntektsmelding201812.java @@ -56,9 +56,11 @@ import java.util.stream.Collectors; import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigDecimal; import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toBigInteger; import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toCamelCase; +import static no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter.toLocalDate; @Slf4j public class XmlInntektsmelding201812 { @@ -89,7 +91,7 @@ public static Melding createInntektsmelding(RsInntektsmelding melding) { XMLSykepengerIArbeidsgiverperioden.class, createSykepengerIArbeidsgiverperioden(melding.getSykepengerIArbeidsgiverperioden())), new JAXBElement<>(new QName(NAMESPACE_URI, "startdatoForeldrepengerperiode"), - LocalDate.class, melding.getStartdatoForeldrepengeperiode()), + LocalDate.class, toLocalDate(melding.getStartdatoForeldrepengeperiode())), new JAXBElement<>(new QName(NAMESPACE_URI, "opphoerAvNaturalyrelseListe"), XMLOpphoerAvNaturalytelseListe.class, createOpphoerAvNaturalytelseListe(melding.getOpphoerAvNaturalytelseListe())), @@ -141,7 +143,7 @@ private static XMLDelvisFravaersListe createDelvisFravaerListe(List(new QName(NAMESPACE_URI, "dato"), LocalDate.class, delvisFravaer.getDato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "dato"), LocalDate.class, toLocalDate(delvisFravaer.getDato())), new JAXBElement<>(new QName(NAMESPACE_URI, "timer"), BigDecimal.class, toBigDecimal(delvisFravaer.getTimer())) ); } @@ -185,8 +187,8 @@ private static XMLNaturalytelseDetaljer createNaturalytelse(RsNaturalytelseDetal return new XMLNaturalytelseDetaljer( new JAXBElement<>(new QName(NAMESPACE_URI, "naturalytelseType"), String.class, - toCamelCase(detaljer.getNaturaytelseType())), - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, detaljer.getFom()), + toCamelCase(detaljer.getNaturalytelseType())), + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, toLocalDate(detaljer.getFom())), new JAXBElement<>(new QName(NAMESPACE_URI, "beloepPrMnd"), BigDecimal.class, toBigDecimal(detaljer.getBeloepPrMnd())) ); } @@ -219,7 +221,7 @@ private static XMLRefusjon createRefusjon(RsRefusjon refusjon) { return isNull(refusjon) ? null : new XMLRefusjon( new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, toBigDecimal(refusjon.getRefusjonsbeloepPrMnd())), - new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, refusjon.getRefusjonsopphoersdato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsopphoersdato"), LocalDate.class, toLocalDate(refusjon.getRefusjonsopphoersdato())), new JAXBElement<>( new QName(NAMESPACE_URI, "endringIRefusjonListe"), XMLEndringIRefusjonsListe.class, @@ -239,7 +241,7 @@ private static XMLEndringIRefusjon createEndringIRefusjon(RsEndringIRefusjon end return isNull(endring) ? null : new XMLEndringIRefusjon( - new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, endring.getEndringsdato()), + new JAXBElement<>(new QName(NAMESPACE_URI, "endringsdato"), LocalDate.class, toLocalDate(endring.getEndringsdato())), new JAXBElement<>(new QName(NAMESPACE_URI, "refusjonsbeloepPrMnd"), BigDecimal.class, toBigDecimal(endring.getRefusjonsbeloepPrMnd()))); } @@ -250,7 +252,7 @@ private static XMLArbeidsforhold createArbeidsforhold(RsArbeidsforhold arbeidsfo return new XMLArbeidsforhold( new JAXBElement<>(new QName(NAMESPACE_URI, "arbeidsforholdId"), String.class, toCamelCase(arbeidsforhold.getArbeidsforholdId())), - new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, arbeidsforhold.getFoersteFravaersdag()), + new JAXBElement<>(new QName(NAMESPACE_URI, "foersteFravaersdag"), LocalDate.class, toLocalDate(arbeidsforhold.getFoersteFravaersdag())), new JAXBElement<>(new QName(NAMESPACE_URI, "beregnetInntekt"), XMLInntekt.class, createInntekt(arbeidsforhold.getBeregnetInntekt())), new JAXBElement<>(new QName(NAMESPACE_URI, "avtaltFerieListe"), XMLAvtaltFerieListe.class, createAvtaltFerieListe(arbeidsforhold.getAvtaltFerieListe())), new JAXBElement<>( @@ -314,8 +316,8 @@ private static XMLPeriode createPeriode(RsPeriode periode) { } return new XMLPeriode( - new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, periode.getFom()), - new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, periode.getTom())); + new JAXBElement<>(new QName(NAMESPACE_URI, "fom"), LocalDate.class, toLocalDate(periode.getFom())), + new JAXBElement<>(new QName(NAMESPACE_URI, "tom"), LocalDate.class, toLocalDate(periode.getTom()))); } private static XMLInntekt createInntekt(RsInntekt inntekt) { diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java index efea22e6623..45b5896d1f5 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/InntektsmeldingApplicationStarter.java @@ -11,4 +11,4 @@ public class InntektsmeldingApplicationStarter { public static void main(String[] args) { SpringApplication.run(InntektsmeldingApplicationStarter.class, args); } -} +} \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java index 65c8a441eb1..f3f4a2f2cfa 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/RsInntektsmeldingRequest.java @@ -16,7 +16,7 @@ import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsRefusjon; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsSykepengerIArbeidsgiverperioden; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -48,7 +48,7 @@ public class RsInntektsmeldingRequest { private RsSykepengerIArbeidsgiverperioden sykepengerIArbeidsgiverperioden; - private LocalDate startdatoForeldrepengeperiode; + private LocalDateTime startdatoForeldrepengeperiode; private List opphoerAvNaturalytelseListe; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java index 645a80c7eca..2e3024a5839 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsforhold.java @@ -3,7 +3,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -13,7 +13,7 @@ public class RsArbeidsforhold { private String arbeidsforholdId; - private LocalDate foersteFravaersdag; + private LocalDateTime foersteFravaersdag; private RsInntekt beregnetInntekt; private List avtaltFerieListe; private List utsettelseAvForeldrepengerListe; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java index 972bae42669..1ef341d3f5b 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsDelvisFravaer.java @@ -1,14 +1,18 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsDelvisFravaer { - private LocalDate dato; + private LocalDateTime dato; private Double timer; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java index 44494128e03..974fc65066a 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsEndringIRefusjon.java @@ -4,13 +4,13 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; @Data @NoArgsConstructor @AllArgsConstructor public class RsEndringIRefusjon { - private LocalDate endringsdato; + private LocalDateTime endringsdato; private Double refusjonsbeloepPrMnd; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java index 6e08b95da8f..c93937d3fd6 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsGraderingIForeldrepenger.java @@ -1,10 +1,14 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsGraderingIForeldrepenger { private RsPeriode periode; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java index 2793aaaaaf0..f04c319dcf0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsInntektsmelding.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -32,7 +32,7 @@ public class RsInntektsmelding { private RsRefusjon refusjon; private RsOmsorgspenger omsorgspenger; private RsSykepengerIArbeidsgiverperioden sykepengerIArbeidsgiverperioden; - private LocalDate startdatoForeldrepengeperiode; + private LocalDateTime startdatoForeldrepengeperiode; private List opphoerAvNaturalytelseListe; private List gjenopptakelseNaturalytelseListe; private List pleiepengerPerioder; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java index c26537d49a1..aa5c2564510 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsNaturalytelseDetaljer.java @@ -3,13 +3,13 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; @Data @NoArgsConstructor public class RsNaturalytelseDetaljer { - private String naturaytelseType; - private LocalDate fom; + private String naturalytelseType; + private LocalDateTime fom; private Double beloepPrMnd; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java index 2db350965d2..a55ec2361eb 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsPeriode.java @@ -1,14 +1,18 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsPeriode { - private LocalDate fom; - private LocalDate tom; + private LocalDateTime fom; + private LocalDateTime tom; } diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java index 9ebb9cad983..a2d66b83641 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsRefusjon.java @@ -3,7 +3,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -13,7 +13,7 @@ public class RsRefusjon { private Double refusjonsbeloepPrMnd; - private LocalDate refusjonsopphoersdato; + private LocalDateTime refusjonsopphoersdato; private List endringIRefusjonListe; public List getEndringIRefusjonListe() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java index be1d052c1ee..95ca87060b0 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsUtsettelseAvForeldrepenger.java @@ -1,10 +1,14 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsUtsettelseAvForeldrepenger { private RsPeriode periode; From 362fea9969e677ce64d914dbc16240adb49ea882 Mon Sep 17 00:00:00 2001 From: Cato Olsen Date: Thu, 8 Feb 2024 14:12:49 +0100 Subject: [PATCH 10/19] Retter feil i NAIS-manifest som stopper deploy. (#3411) --- apps/sykemelding-api/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/sykemelding-api/config.yml b/apps/sykemelding-api/config.yml index eea56030bb8..32325fb4a8c 100644 --- a/apps/sykemelding-api/config.yml +++ b/apps/sykemelding-api/config.yml @@ -70,8 +70,6 @@ spec: external: - host: mqls04.preprod.local ports: - - name: mq - port: 1413 - protocol: TCP + - port: 1413 ingresses: - "https://testnav-sykemelding-api.intern.dev.nav.no" \ No newline at end of file From 9596a50a88bff18ad112e6386ecf7869aeca4b0d Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Thu, 8 Feb 2024 15:04:21 +0100 Subject: [PATCH 11/19] Lagt til mer logging --- .../v20181211/provider/v2/InntektsmeldingV2Controller.java | 2 +- .../consumer/command/GenererInntektsmeldingCommand.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java index de1ca15add6..ea2e168e5a2 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java @@ -24,7 +24,7 @@ public class InntektsmeldingV2Controller { @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public ResponseEntity create(@RequestBody InntektsmeldingDTO inntektsmeldingDTO) { - log.info("Mottok inntektsmeldingDTO: {}", Json.pretty(inntektsmeldingDTO.toMelding())); + log.info("Mottok inntektsmeldingDTO: {}", Json.pretty(inntektsmeldingDTO)); JAXBElement melding = inntektsmeldingDTO.toMelding(); String xml = XmlConverter.toXml(melding, XMLInntektsmeldingM.class); diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/command/GenererInntektsmeldingCommand.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/command/GenererInntektsmeldingCommand.java index 97c16e131f7..18d7874644b 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/command/GenererInntektsmeldingCommand.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/command/GenererInntektsmeldingCommand.java @@ -1,10 +1,12 @@ package no.nav.registre.testnav.inntektsmeldingservice.consumer.command; +import io.swagger.v3.oas.annotations.media.Content; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.registre.testnav.inntektsmeldingservice.util.WebClientFilter; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntektsmelding; import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; @@ -31,8 +33,9 @@ public Mono call() { .post() .uri("/api/v2/inntektsmelding/2018/12/11") .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) + .contentType(MediaType.APPLICATION_JSON) .acceptCharset(StandardCharsets.UTF_8) - .body(BodyInserters.fromPublisher(Mono.just(dto), RsInntektsmelding.class)) + .bodyValue(dto) .retrieve() .bodyToMono(String.class) .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) From 2de2e1d16ce9b59d5acf84408a512bcc760c7aea Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Thu, 8 Feb 2024 16:54:25 +0100 Subject: [PATCH 12/19] Improve mapping and logging functionalities --- .../Dockerfile | 2 +- .../build.gradle | 1 + .../mapper/LocalDateCustomMapping.java | 25 +++++++ .../mapper/MapperFacadeConfig.java | 36 +++++++++ .../mapper/MappingContextUtils.java | 73 +++++++++++++++++++ .../mapper/MappingStrategy.java | 19 +++++ .../v20181211/dto/v1/ArbeidsforholdDTO.java | 4 +- .../v20181211/dto/v1/ArbeidsgiverDTO.java | 4 +- .../dto/v1/ArbeidsgiverPrivatDTO.java | 5 +- .../v20181211/dto/v1/AvsendersystemDTO.java | 4 +- .../v20181211/dto/v1/DelvisFravearDTO.java | 4 +- .../v20181211/dto/v1/EndringIRefusjonDTO.java | 4 +- .../dto/v1/GraderingIForeldrepengerDTO.java | 5 +- .../v20181211/dto/v1/InntektDTO.java | 4 +- .../v20181211/dto/v1/InntektsmeldingDTO.java | 4 +- .../dto/v1/KontaktinformasjonDTO.java | 4 +- .../dto/v1/NaturalYtelseDetaljerDTO.java | 4 +- .../v20181211/dto/v1/OmsorgspenegerDTO.java | 5 +- .../v20181211/dto/v1/PeriodeDTO.java | 5 +- .../v20181211/dto/v1/RefusjonDTO.java | 4 +- .../SykepengerIArbeidsgiverperiodenDTO.java | 4 +- .../dto/v1/UtsettelseAvForeldrepengerDTO.java | 4 +- .../v2/InntektsmeldingV2Controller.java | 16 +++- .../src/main/resources/application-prod.yml | 10 +++ .../src/main/resources/application.yml | 4 - .../ApplicationContextTest.java | 4 + 26 files changed, 213 insertions(+), 45 deletions(-) create mode 100644 apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/LocalDateCustomMapping.java create mode 100644 apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MapperFacadeConfig.java create mode 100644 apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingContextUtils.java create mode 100644 apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingStrategy.java create mode 100644 apps/inntektsmelding-generator-service/src/main/resources/application-prod.yml diff --git a/apps/inntektsmelding-generator-service/Dockerfile b/apps/inntektsmelding-generator-service/Dockerfile index dd8161548f8..72bbb83dea2 100644 --- a/apps/inntektsmelding-generator-service/Dockerfile +++ b/apps/inntektsmelding-generator-service/Dockerfile @@ -1,7 +1,7 @@ FROM ghcr.io/navikt/baseimages/temurin:21 LABEL maintainer="Team Dolly" -ENV JAVA_OPTS="-Dspring.profiles.active=prod" +ENV JAVA_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED -Dspring.profiles.active=prod" ADD /build/libs/app.jar /app/app.jar diff --git a/apps/inntektsmelding-generator-service/build.gradle b/apps/inntektsmelding-generator-service/build.gradle index 1d38132bfbd..618f6feb897 100644 --- a/apps/inntektsmelding-generator-service/build.gradle +++ b/apps/inntektsmelding-generator-service/build.gradle @@ -62,6 +62,7 @@ dependencies { implementation 'javax.activation:activation:1.1.1' implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.8' implementation 'com.sun.xml.bind:jaxb-core:2.3.0.1' + implementation 'ma.glasnost.orika:orika-core:1.5.4' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml' implementation 'org.apache.commons:commons-text:1.10.0' diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/LocalDateCustomMapping.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/LocalDateCustomMapping.java new file mode 100644 index 00000000000..0961f87743e --- /dev/null +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/LocalDateCustomMapping.java @@ -0,0 +1,25 @@ +package no.nav.registre.inntektsmeldinggeneratorservice.mapper; + +import lombok.extern.slf4j.Slf4j; +import ma.glasnost.orika.MappingContext; +import ma.glasnost.orika.converter.BidirectionalConverter; +import ma.glasnost.orika.metadata.Type; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Slf4j +@Component +public class LocalDateCustomMapping extends BidirectionalConverter { + + @Override + public LocalDate convertTo(LocalDateTime localDateTime, Type type, MappingContext mappingContext) { + return localDateTime.toLocalDate(); + } + + @Override + public LocalDateTime convertFrom(LocalDate localDate, Type type, MappingContext mappingContext) { + return localDate.atStartOfDay(); + } +} \ No newline at end of file diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MapperFacadeConfig.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MapperFacadeConfig.java new file mode 100644 index 00000000000..e319e91403d --- /dev/null +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MapperFacadeConfig.java @@ -0,0 +1,36 @@ +package no.nav.registre.inntektsmeldinggeneratorservice.mapper; + +import ma.glasnost.orika.CustomConverter; +import ma.glasnost.orika.MapperFacade; +import ma.glasnost.orika.impl.DefaultMapperFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.List; + +import static java.util.Objects.nonNull; + +@Configuration +public class MapperFacadeConfig { + + @Bean + MapperFacade mapperFacade(List mappingStrategies, List customConverters) { + DefaultMapperFactory mapperFactory = new DefaultMapperFactory.Builder().build(); + + if (nonNull(mappingStrategies)) { + for (MappingStrategy mapper : mappingStrategies) { + mapper.register(mapperFactory); + } + } + + if (nonNull(customConverters)) { + for (CustomConverter converter : customConverters) { + mapperFactory.getConverterFactory().registerConverter(converter); + } + } + + return mapperFactory.getMapperFacade(); + + } + +} diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingContextUtils.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingContextUtils.java new file mode 100644 index 00000000000..69ed01b2499 --- /dev/null +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingContextUtils.java @@ -0,0 +1,73 @@ +package no.nav.registre.inntektsmeldinggeneratorservice.mapper; + +import lombok.experimental.UtilityClass; +import ma.glasnost.orika.MappingContext; +import ma.glasnost.orika.MappingContextFactory; +import ma.glasnost.orika.impl.DefaultMapperFactory; + +/** + * The utility class to get {@link MappingContext} configured by Orika + * and ready to be used by {@link ma.glasnost.orika.MapperFacade#map(Object, Class)}. + */ +@UtilityClass +public final class MappingContextUtils { + + private static final MappingContextFactory MAPPING_CONTEXT_FACTORY; + + static { + MAPPING_CONTEXT_FACTORY = new CustomDefaultMapperFactory.Builder().build().getContextFactory(); + } + + /** + * Gets {@link MappingContext} ready to be used by {@link ma.glasnost.orika.MapperFacade#map(Object, Class)}. + * Manual creation of {@link MappingContext} does not work. Please see the link below. + * + * @return {@link MappingContext} + * @see https://github.com/orika-mapper/orika/issues/354 + */ + public static MappingContext getMappingContext() { + return MAPPING_CONTEXT_FACTORY.getContext(); + } + + /** + * The custom {@link DefaultMapperFactory} to expose getter + * for {@link MappingContextFactory} so {@link MappingContext} with prefilled globalProperties can be created. + * + * @author Dmitry Lebedko (dmitry.lebedko@t-systems.com) + */ + private static class CustomDefaultMapperFactory extends DefaultMapperFactory { + + /** + * Constructs a new instance of DefaultMapperFactory + * + * @param builder {@link MapperFactoryBuilder} + */ + protected CustomDefaultMapperFactory(MapperFactoryBuilder builder) { + super(builder); + } + + /** + * Gets {@link MappingContextFactory}. + * + * @return {@link MappingContextFactory} + */ + public MappingContextFactory getContextFactory() { + return contextFactory; + } + + public static class Builder extends DefaultMapperFactory.MapperFactoryBuilder { + + @Override + public CustomDefaultMapperFactory build() { + return new CustomDefaultMapperFactory(this); + } + + @Override + protected Builder self() { + return this; + } + + } + + } +} \ No newline at end of file diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingStrategy.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingStrategy.java new file mode 100644 index 00000000000..c25e31d383b --- /dev/null +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/mapper/MappingStrategy.java @@ -0,0 +1,19 @@ +package no.nav.registre.inntektsmeldinggeneratorservice.mapper; + +import ma.glasnost.orika.MapperFactory; + +@FunctionalInterface +public interface MappingStrategy { + + /** + * A callback for registering criteria on the provided {@link MapperFactory}. + *

+ *

{@code
+     *
+     * @Override public void register(MapperFactory factory) {
+     * factory.registerMapper(arbeidsfordelingToRestArbeidsfordeling());
+     * }
+     * }
+ */ + void register(MapperFactory factory); +} diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsforholdDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsforholdDTO.java index be41d9d4b65..5eaa58cedb0 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsforholdDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsforholdDTO.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLArbeidsforhold; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLAvtaltFerieListe; @@ -14,7 +14,7 @@ import java.time.LocalDate; import java.util.List; -@Value +@Data @NoArgsConstructor(force = true) public class ArbeidsforholdDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverDTO.java index 3c63bbcd454..db590f3c38a 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverDTO.java @@ -2,13 +2,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLArbeidsgiver; -@Value +@Data @NoArgsConstructor(force = true) public class ArbeidsgiverDTO implements ToXmlElement { @JsonProperty(required = true) diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverPrivatDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverPrivatDTO.java index c541b11de2b..23f90c5f7df 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverPrivatDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/ArbeidsgiverPrivatDTO.java @@ -2,13 +2,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLArbeidsgiverPrivat; - -@Value +@Data @NoArgsConstructor(force = true) public class ArbeidsgiverPrivatDTO implements ToXmlElement { diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/AvsendersystemDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/AvsendersystemDTO.java index dc513e3bb62..b219ac9ab85 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/AvsendersystemDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/AvsendersystemDTO.java @@ -1,14 +1,14 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLAvsendersystem; import java.time.LocalDateTime; -@Value +@Data @NoArgsConstructor(force = true) public class AvsendersystemDTO implements ToXmlElement { @JsonProperty(required = true) diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/DelvisFravearDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/DelvisFravearDTO.java index edae4a19155..ba7ffe9ef34 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/DelvisFravearDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/DelvisFravearDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLDelvisFravaer; @@ -10,7 +10,7 @@ import java.time.LocalDate; import java.util.List; -@Value +@Data @NoArgsConstructor(force = true) public class DelvisFravearDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/EndringIRefusjonDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/EndringIRefusjonDTO.java index 6d00a64c683..852b67d177a 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/EndringIRefusjonDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/EndringIRefusjonDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLEndringIRefusjon; @@ -10,7 +10,7 @@ import java.time.LocalDate; import java.util.List; -@Value +@Data @NoArgsConstructor(force = true) public class EndringIRefusjonDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/GraderingIForeldrepengerDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/GraderingIForeldrepengerDTO.java index 235d635ccda..86c5c285add 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/GraderingIForeldrepengerDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/GraderingIForeldrepengerDTO.java @@ -1,16 +1,15 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLGraderingIForeldrepenger; import java.math.BigInteger; import java.util.List; - -@Value +@Data @NoArgsConstructor(force = true) public class GraderingIForeldrepengerDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektDTO.java index 14ee32b7622..65deb1d25b6 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektDTO.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLInntekt; import org.apache.commons.text.CaseUtils; @@ -12,7 +12,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; -@Value +@Data @NoArgsConstructor(force = true) public class InntektDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektsmeldingDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektsmeldingDTO.java index 10994cb9804..e62a04b3a23 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektsmeldingDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/InntektsmeldingDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLGjenopptakelseNaturalytelseListe; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLInntektsmeldingM; @@ -17,7 +17,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; -@Value +@Data @NoArgsConstructor(force = true) public class InntektsmeldingDTO implements ToXmlElement { diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/KontaktinformasjonDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/KontaktinformasjonDTO.java index 330f3e546b4..a3173dc3fa1 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/KontaktinformasjonDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/KontaktinformasjonDTO.java @@ -2,12 +2,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.validation.constraints.Size; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLKontaktinformasjon; -@Value +@Data @NoArgsConstructor(force = true) public class KontaktinformasjonDTO implements ToXmlElement { @JsonProperty(required = true) diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/NaturalYtelseDetaljerDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/NaturalYtelseDetaljerDTO.java index 5f62a3e3698..3c05df84102 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/NaturalYtelseDetaljerDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/NaturalYtelseDetaljerDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLNaturalytelseDetaljer; import org.apache.commons.text.CaseUtils; @@ -13,7 +13,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; -@Value +@Data @NoArgsConstructor(force = true) public class NaturalYtelseDetaljerDTO implements ToXmlElement { diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/OmsorgspenegerDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/OmsorgspenegerDTO.java index 8224c7e2d2e..0f10abfb077 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/OmsorgspenegerDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/OmsorgspenegerDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLDelvisFravaersListe; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLFravaersPeriodeListe; @@ -10,8 +10,7 @@ import java.util.List; - -@Value +@Data @NoArgsConstructor(force = true) public class OmsorgspenegerDTO implements ToXmlElement { diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/PeriodeDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/PeriodeDTO.java index 64db65add8e..4574743582a 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/PeriodeDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/PeriodeDTO.java @@ -1,16 +1,15 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLPeriode; import java.time.LocalDate; import java.util.List; - -@Value +@Data @NoArgsConstructor(force = true) public class PeriodeDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/RefusjonDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/RefusjonDTO.java index b1306d0841b..c614fb4179b 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/RefusjonDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/RefusjonDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLEndringIRefusjonsListe; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLRefusjon; @@ -11,7 +11,7 @@ import java.time.LocalDate; import java.util.List; -@Value +@Data @NoArgsConstructor(force = true) public class RefusjonDTO implements ToXmlElement { diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/SykepengerIArbeidsgiverperiodenDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/SykepengerIArbeidsgiverperiodenDTO.java index 7262e4deee5..975c13021d4 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/SykepengerIArbeidsgiverperiodenDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/SykepengerIArbeidsgiverperiodenDTO.java @@ -1,8 +1,8 @@ package no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLArbeidsgiverperiodeListe; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLSykepengerIArbeidsgiverperioden; @@ -13,7 +13,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; -@Value +@Data @NoArgsConstructor(force = true) public class SykepengerIArbeidsgiverperiodenDTO implements ToXmlElement { @JsonProperty diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/UtsettelseAvForeldrepengerDTO.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/UtsettelseAvForeldrepengerDTO.java index 8b8090e2b7a..e4e329641e0 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/UtsettelseAvForeldrepengerDTO.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/dto/v1/UtsettelseAvForeldrepengerDTO.java @@ -2,14 +2,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Value; import no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLUtsettelseAvForeldrepenger; import java.util.List; -@Value +@Data @NoArgsConstructor(force = true) public class UtsettelseAvForeldrepengerDTO implements ToXmlElement { diff --git a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java index ea2e168e5a2..dba42562271 100644 --- a/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java +++ b/apps/inntektsmelding-generator-service/src/main/java/no/nav/registre/inntektsmeldinggeneratorservice/v20181211/provider/v2/InntektsmeldingV2Controller.java @@ -3,8 +3,10 @@ import io.swagger.v3.core.util.Json; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import ma.glasnost.orika.MapperFacade; import no.nav.registre.inntektsmeldinggeneratorservice.util.XmlConverter; import no.nav.registre.inntektsmeldinggeneratorservice.v20181211.dto.v1.InntektsmeldingDTO; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntektsmelding; import no.seres.xsd.nav.inntektsmelding_m._20181211.XMLInntektsmeldingM; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -22,10 +24,16 @@ @RequiredArgsConstructor public class InntektsmeldingV2Controller { + private final MapperFacade mapperFacade; + @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity create(@RequestBody InntektsmeldingDTO inntektsmeldingDTO) { - log.info("Mottok inntektsmeldingDTO: {}", Json.pretty(inntektsmeldingDTO)); - JAXBElement melding = inntektsmeldingDTO.toMelding(); + public ResponseEntity create(@RequestBody RsInntektsmelding request) { + + log.info("Mottok inntektsmelding: {}", Json.pretty(request)); + + var inntektsmelding = mapperFacade.map(request, InntektsmeldingDTO.class); + + JAXBElement melding = inntektsmelding.toMelding(); String xml = XmlConverter.toXml(melding, XMLInntektsmeldingM.class); if (!XmlConverter.validate(xml, XMLInntektsmeldingM.class)) { @@ -33,7 +41,7 @@ public ResponseEntity create(@RequestBody InntektsmeldingDTO inntektsmel .status(HttpStatus.INTERNAL_SERVER_ERROR) .body("Validering av opprett xml feilet"); } - log.info("Genererte XML for inntektsmelding: {}", Json.pretty(xml)); + log.info("Genererte XML for inntektsmelding: {}", xml); return ResponseEntity.ok(xml); } diff --git a/apps/inntektsmelding-generator-service/src/main/resources/application-prod.yml b/apps/inntektsmelding-generator-service/src/main/resources/application-prod.yml new file mode 100644 index 00000000000..6227cb2ec92 --- /dev/null +++ b/apps/inntektsmelding-generator-service/src/main/resources/application-prod.yml @@ -0,0 +1,10 @@ + +spring: + security: + oauth2: + resourceserver: + tokenx: + issuer-uri: ${TOKEN_X_ISSUER} + jwk-set-uri: ${TOKEN_X_JWKS_URI} + accepted-audience: ${TOKEN_X_CLIENT_ID} + diff --git a/apps/inntektsmelding-generator-service/src/main/resources/application.yml b/apps/inntektsmelding-generator-service/src/main/resources/application.yml index acd2b99aafa..110264c0e1e 100644 --- a/apps/inntektsmelding-generator-service/src/main/resources/application.yml +++ b/apps/inntektsmelding-generator-service/src/main/resources/application.yml @@ -13,10 +13,6 @@ spring: issuer-uri: ${AAD_ISSUER_URI}/v2.0 jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} - tokenx: - issuer-uri: ${TOKEN_X_ISSUER} - jwk-set-uri: ${TOKEN_X_JWKS_URI} - accepted-audience: ${TOKEN_X_CLIENT_ID} cloud: vault: enabled: false diff --git a/apps/inntektsmelding-generator-service/src/test/java/no/nav/registre/inntektsmeldinggeneratorservice/ApplicationContextTest.java b/apps/inntektsmelding-generator-service/src/test/java/no/nav/registre/inntektsmeldinggeneratorservice/ApplicationContextTest.java index faee7505b3e..29b0d23a6a1 100644 --- a/apps/inntektsmelding-generator-service/src/test/java/no/nav/registre/inntektsmeldinggeneratorservice/ApplicationContextTest.java +++ b/apps/inntektsmelding-generator-service/src/test/java/no/nav/registre/inntektsmeldinggeneratorservice/ApplicationContextTest.java @@ -1,5 +1,6 @@ package no.nav.registre.inntektsmeldinggeneratorservice; +import ma.glasnost.orika.MapperFacade; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -13,6 +14,9 @@ public class ApplicationContextTest { @MockBean public JwtDecoder jwtDecoder; + @MockBean + public MapperFacade mapperFacade; + @Test @SuppressWarnings("java:S2699") void load_app_context() { From 28198b5a363fefa4e6802246bf58a0d5c8016481 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Fri, 9 Feb 2024 10:18:38 +0100 Subject: [PATCH 13/19] Validering personnr forste utkast --- .../aareg/form/partials/arbeidsgiverIdent.tsx | 78 +++++++++++-------- .../fagsystem/aareg/form/validation.tsx | 37 ++++----- 2 files changed, 63 insertions(+), 52 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx index b5f3700760c..7efe8634fe3 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useEffect, useState } from 'react' import { useBoolean } from 'react-use' import * as _ from 'lodash-es' import Icon from '@/components/ui/icon/Icon' @@ -6,6 +6,7 @@ import Loading from '@/components/ui/loading/Loading' import { DollyTextInput } from '@/components/ui/form/inputs/textInput/TextInput' import { PdlforvalterApi } from '@/service/Api' import { useFormikContext } from 'formik' +import { useNaviger } from '@/utils/hooks/useNaviger' type ArbeidsgiverIdentProps = { path: string @@ -15,48 +16,61 @@ type ArbeidsgiverIdentProps = { export const ArbeidsgiverIdent = ({ path, isDisabled }: ArbeidsgiverIdentProps) => { const formikBag = useFormikContext() const [error, setError] = useState(null) + // const [success, setSuccess] = useBoolean(false) const [personnummer, setPersonnummer] = useState(_.get(formikBag.values, path)) - const [success, setSuccess] = useBoolean(false) - const [loading, setLoading] = useBoolean(false) + const [success, setSuccess] = useBoolean(personnummer && !error) + const { result, loading: loadingNaviger, error: errorNaviger, mutate } = useNaviger(personnummer) + + useEffect(() => { + if (personnummer) { + if (result?.identNavigerTil) { + setSuccess(true) + setError(null) + } else { + setError('Fant ikke arbeidsgiver-ident') + } + } + }, [result, errorNaviger]) + + useEffect(() => { + if (error) { + formikBag.setFieldError(path, error) + } else { + formikBag.setFieldError(path, undefined) + } + }, [error, formikBag.errors, personnummer]) const handleChange = (event: React.ChangeEvent) => { - event.preventDefault() + // event.preventDefault() setError(null) setSuccess(false) const personnr = event.target.value + formikBag.setFieldValue(`${path}`, personnr) - // TODO: move to frontend validation if (personnr.match(/^\d{11}$/) != null) { - handleManualPersonnrChange(personnr) + setPersonnummer(personnr) + // formikBag.setFieldValue(`${path}`, personnr) + // setValgtIdent(personnr) } else { setError('Ident må være et tall med 11 siffer') - formikBag.setFieldValue(`${path}`, '') + // formikBag.setFieldValue(path, '') } } - const handleManualPersonnrChange = (personnr: string) => { - setLoading(true) - - PdlforvalterApi.getPersoner([personnr]) - .then((response: any) => { - if (!response?.data || response?.data?.length < 1) { - setError('Fant ikke arbeidsgiver-ident') - setLoading(false) - formikBag.setFieldValue(`${path}`, '') - return - } - - setError(null) - setSuccess(true) - setLoading(false) - setPersonnummer(personnr) - - formikBag.setFieldValue(`${path}`, personnr) - }) - .catch(() => setError('Fant ikke arbeidsgiver-ident')) + const getFeilmelding = () => { + if (error) { + return { + feilmelding: error, + } + } else if (!_.get(formikBag.values, path)) { + return { feilmelding: 'Feltet er påkrevd' } + } + return null } + const feilmelding = getFeilmelding() + return (
{success && (
@@ -78,7 +88,7 @@ export const ArbeidsgiverIdent = ({ path, isDisabled }: ArbeidsgiverIdentProps) funnet
)} - {loading && } + {loadingNaviger && }
) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx index 50f1133986e..5d19104b01c 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx @@ -45,7 +45,7 @@ const innenforAnsettelsesforholdTest = (periodeValidation, validateFomMonth) => start: new Date(ansattFom), end: _.isNil(ansattTom) ? new Date() : new Date(ansattTom), }) - } + }, ) } @@ -63,7 +63,7 @@ const fullArbeidsforholdTest = (arbeidsforholdValidation) => { gyldig = false } return gyldig - } + }, ) } @@ -85,7 +85,8 @@ const arbeidsgiver = Yup.object({ ident: Yup.string().when('aktoertype', { is: 'PERS', then: () => - Yup.string() + // Yup.string() + requiredString .matches(/^\d*$/, 'Ident må være et tall med 11 sifre') .test('len', 'Ident må være et tall med 11 sifre', (val) => val && val.length === 11), }), @@ -102,7 +103,7 @@ const arbeidsavtale = Yup.object({ Yup.number() .min(1, 'Kan ikke være mindre enn ${min}') .max(75, 'Kan ikke være større enn ${max}') - .typeError(messages.required) + .typeError(messages.required), ).nullable(), }) @@ -112,7 +113,7 @@ const fartoy = Yup.array() skipsregister: requiredString, skipstype: requiredString, fartsomraade: requiredString, - }) + }), ) .nullable() @@ -152,7 +153,7 @@ export const validation = { antallTimer: Yup.number() .min(1, 'Kan ikke være mindre enn ${min}') .typeError(messages.required), - }) + }), ), utenlandsopphold: Yup.array().of( Yup.object({ @@ -161,7 +162,7 @@ export const validation = { tom: innenforAnsettelsesforholdTest(requiredDate, true), }), land: requiredString, - }) + }), ), permisjon: Yup.array().of( Yup.object({ @@ -174,7 +175,7 @@ export const validation = { .max(100, 'Kan ikke være større enn ${max}') .typeError(messages.required), permisjon: requiredString, - }) + }), ), permittering: Yup.array().of( Yup.object({ @@ -186,7 +187,7 @@ export const validation = { .min(1, 'Kan ikke være mindre enn ${min}') .max(100, 'Kan ikke være større enn ${max}') .typeError(messages.required), - }) + }), ), amelding: ifPresent( '$aareg[0].amelding', @@ -208,7 +209,7 @@ export const validation = { antallTimer: Yup.number() .min(1, 'Kan ikke være mindre enn ${min}') .typeError(messages.required), - }) + }), ), utenlandsopphold: Yup.array().of( Yup.object({ @@ -217,7 +218,7 @@ export const validation = { tom: requiredDate, }), land: requiredString, - }) + }), ), permisjon: Yup.array().of( Yup.object({ @@ -230,7 +231,7 @@ export const validation = { .max(100, 'Kan ikke være større enn ${max}') .typeError(messages.required), permisjon: requiredString, - }) + }), ), permittering: Yup.array().of( Yup.object({ @@ -242,20 +243,20 @@ export const validation = { .min(1, 'Kan ikke være mindre enn ${min}') .max(100, 'Kan ikke være større enn ${max}') .typeError(messages.required), - }) + }), ), - }) + }), ), - }) - ) + }), + ), ), genererPeriode: ifPresent( '$aareg[0].amelding[0]', Yup.object({ fom: testDatoFom(requiredPeriode, 'tom'), tom: testDatoTom(requiredPeriode, 'fom'), - }) + }), ), - }) + }), ), } From 569ac4b1e16a322787218f8c1d254420c1cc84f1 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Fri, 9 Feb 2024 10:29:08 +0100 Subject: [PATCH 14/19] Fix visning av inntektsmelding --- .../kriterier/BestillingKriterieMapper.tsx | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx b/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx index 7cce057cf3a..764181e391b 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx @@ -1228,23 +1228,23 @@ const mapInntektStub = (bestillingData, data) => { obj('Opplysningspliktig (orgnr/id)', inntektsinfo.opplysningspliktig), obj( 'Antall registrerte inntekter', - inntektsinfo.inntektsliste && inntektsinfo.inntektsliste.length, + inntektsinfo.inntektsliste && inntektsinfo.inntektsliste?.length, ), obj( 'Antall registrerte fradrag', - inntektsinfo.fradragsliste && inntektsinfo.fradragsliste.length, + inntektsinfo.fradragsliste && inntektsinfo.fradragsliste?.length, ), obj( 'Antall registrerte forskuddstrekk', - inntektsinfo.forskuddstrekksliste && inntektsinfo.forskuddstrekksliste.length, + inntektsinfo.forskuddstrekksliste && inntektsinfo.forskuddstrekksliste?.length, ), obj( 'Antall registrerte arbeidsforhold', - inntektsinfo.arbeidsforholdsliste && inntektsinfo.arbeidsforholdsliste.length, + inntektsinfo.arbeidsforholdsliste && inntektsinfo.arbeidsforholdsliste?.length, ), obj( 'Antall registrerte inntektsendringer (historikk)', - inntektsinfo.historikk && inntektsinfo.historikk.length, + inntektsinfo.historikk && inntektsinfo.historikk?.length, ), ]) }) @@ -1467,7 +1467,7 @@ const mapSykemelding = (bestillingData, data) => { obj( 'Antall registrerte bidiagnoser', sykemeldingKriterier.detaljertSykemelding.biDiagnoser && - sykemeldingKriterier.detaljertSykemelding.biDiagnoser.length, + sykemeldingKriterier.detaljertSykemelding.biDiagnoser?.length, ), obj( 'Helsepersonell navn', @@ -1497,7 +1497,7 @@ const mapSykemelding = (bestillingData, data) => { ), obj( 'Antall registrerte perioder', - sykemeldingKriterier.detaljertSykemelding.perioder.length, + sykemeldingKriterier.detaljertSykemelding.perioder?.length, ), obj( 'Tiltak fra NAV', @@ -1540,7 +1540,7 @@ const mapBrregstub = (bestillingData, data) => { obj('Registreringsdato', formatDate(enhet.registreringsdato)), obj('Organisasjonsnummer', enhet.orgNr), obj('Foretaksnavn', enhet.foretaksNavn.navn1), - obj('Antall registrerte personroller', enhet.personroller && enhet.personroller.length), + obj('Antall registrerte personroller', enhet.personroller && enhet.personroller?.length), ]) }) @@ -1825,7 +1825,7 @@ const mapUdiStub = (bestillingData, data) => { obj('Arbeidsadgang til dato', formatDate(_.get(arbeidsadgangKriterier, 'periode.til'))), obj('Hjemmel', _.get(arbeidsadgangKriterier, 'hjemmel')), obj('Forklaring', _.get(arbeidsadgangKriterier, 'forklaring')), - obj('Alias', aliaserListe.length > 0 && aliaserListe), + obj('Alias', aliaserListe?.length > 0 && aliaserListe), obj('Flyktningstatus', oversettBoolean(udiStubKriterier.flyktning)), obj( 'Asylsøker', @@ -1858,9 +1858,9 @@ const mapPensjon = (bestillingData, data, navEnheter) => { data.push(pensjonforvalterPopp) } - if (pensjonKriterier.tp && pensjonKriterier.tp.length > 0) { + if (pensjonKriterier.tp && pensjonKriterier.tp?.length > 0) { const hentTpOrdningNavn = (tpnr) => { - if (Options('tpOrdninger').length) { + if (Options('tpOrdninger')?.length) { return Options('tpOrdninger').find((ordning) => ordning.value === tpnr)?.label } return tpnr @@ -1983,7 +1983,7 @@ const mapInntektsmelding = (bestillingData, data) => { obj('Første fraværsdag', formatDate(inntekt.arbeidsforhold.foersteFravaersdag)), obj( 'Avtalte ferier', - inntekt.arbeidsforhold.avtaltFerieListe && inntekt.arbeidsforhold.avtaltFerieListe.length, + inntekt.arbeidsforhold.avtaltFerieListe && inntekt.arbeidsforhold.avtaltFerieListe?.length, ), //Refusjon obj('Refusjonsbeløp per måned', inntekt.refusjon.refusjonsbeloepPrMnd), @@ -1991,19 +1991,19 @@ const mapInntektsmelding = (bestillingData, data) => { obj( 'Endringer i refusjon', _.has(inntekt, 'refusjon.endringIRefusjonListe') && - inntekt.refusjon.endringIRefusjonListe.length, + inntekt.refusjon.endringIRefusjonListe?.length, ), //Omsorg obj('Har utbetalt pliktige dager', _.get(inntekt, 'omsorgspenger.harUtbetaltPliktigeDager')), obj( 'Fraværsperioder', _.has(inntekt, 'omsorgspenger.fravaersPerioder') && - inntekt.omsorgspenger.fravaersPerioder.length, + inntekt.omsorgspenger.fravaersPerioder?.length, ), obj( 'Delvis fravær', _.has(inntekt, 'omsorgspenger.delvisFravaersListe') && - inntekt.omsorgspenger.delvisFravaersListe.length, + inntekt.omsorgspenger.delvisFravaersListe?.length, ), //Sykepenger obj('Brutto utbetalt', _.get(inntekt, 'sykepengerIArbeidsgiverperioden.bruttoUtbetalt')), @@ -2019,20 +2019,24 @@ const mapInntektsmelding = (bestillingData, data) => { obj( 'Arbeidsgiverperioder', _.has(inntekt, 'sykepengerIArbeidsgiverperioden.arbeidsgiverperiodeListe') && - inntekt.sykepengerIArbeidsgiverperioden.arbeidsgiverperiodeListe.length, + inntekt.sykepengerIArbeidsgiverperioden.arbeidsgiverperiodeListe?.length, ), //Foreldrepenger obj('Startdato foreldrepenger', formatDate(inntekt.startdatoForeldrepengeperiode)), //Pleiepenger - obj('Pleiepengerperioder', inntekt.pleiepengerPerioder && inntekt.pleiepengerPerioder.length), + obj( + 'Pleiepengerperioder', + inntekt.pleiepengerPerioder && inntekt.pleiepengerPerioder?.length, + ), //Naturalytelse obj( 'Gjenopptagelse Naturalytelse', - inntekt.gjenopptakelseNaturalytelseListe && inntekt.gjenopptakelseNaturalytelseListe.length, + inntekt.gjenopptakelseNaturalytelseListe && + inntekt.gjenopptakelseNaturalytelseListe?.length, ), obj( 'Opphør av Naturalytelse', - inntekt.opphoerAvNaturalytelseListe && inntekt.opphoerAvNaturalytelseListe.length, + inntekt.opphoerAvNaturalytelseListe && inntekt.opphoerAvNaturalytelseListe?.length, ), ]), }) @@ -2067,7 +2071,7 @@ const mapDokarkiv = (bestillingData, data) => { obj('Sakstype', showLabel('sakstype', dokarkivKriterier.sak?.sakstype)), obj('Fagsaksystem', showLabel('fagsaksystem', dokarkivKriterier.sak?.fagsaksystem)), obj('Fagsak-ID', dokarkivKriterier.sak?.fagsakId), - obj('Antall vedlegg', dokarkivKriterier.dokumenter.length), + obj('Antall vedlegg', dokarkivKriterier.dokumenter?.length), ], } From 0edd605d5fc4898d2a1da4b729fc248d937cff66 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Fri, 9 Feb 2024 12:00:50 +0100 Subject: [PATCH 15/19] Siste fix validering --- .../aareg/form/partials/arbeidsgiverIdent.tsx | 14 +++----------- .../src/main/js/src/utils/hooks/useNaviger.tsx | 4 +++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx index 7efe8634fe3..3d444eb62ed 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsgiverIdent.tsx @@ -4,7 +4,6 @@ import * as _ from 'lodash-es' import Icon from '@/components/ui/icon/Icon' import Loading from '@/components/ui/loading/Loading' import { DollyTextInput } from '@/components/ui/form/inputs/textInput/TextInput' -import { PdlforvalterApi } from '@/service/Api' import { useFormikContext } from 'formik' import { useNaviger } from '@/utils/hooks/useNaviger' @@ -16,10 +15,9 @@ type ArbeidsgiverIdentProps = { export const ArbeidsgiverIdent = ({ path, isDisabled }: ArbeidsgiverIdentProps) => { const formikBag = useFormikContext() const [error, setError] = useState(null) - // const [success, setSuccess] = useBoolean(false) + const [success, setSuccess] = useBoolean(false) const [personnummer, setPersonnummer] = useState(_.get(formikBag.values, path)) - const [success, setSuccess] = useBoolean(personnummer && !error) - const { result, loading: loadingNaviger, error: errorNaviger, mutate } = useNaviger(personnummer) + const { result, loading: loadingNaviger, error: errorNaviger } = useNaviger(personnummer) useEffect(() => { if (personnummer) { @@ -41,20 +39,14 @@ export const ArbeidsgiverIdent = ({ path, isDisabled }: ArbeidsgiverIdentProps) }, [error, formikBag.errors, personnummer]) const handleChange = (event: React.ChangeEvent) => { - // event.preventDefault() setError(null) setSuccess(false) - const personnr = event.target.value formikBag.setFieldValue(`${path}`, personnr) - if (personnr.match(/^\d{11}$/) != null) { setPersonnummer(personnr) - // formikBag.setFieldValue(`${path}`, personnr) - // setValgtIdent(personnr) } else { setError('Ident må være et tall med 11 siffer') - // formikBag.setFieldValue(path, '') } } @@ -88,7 +80,7 @@ export const ArbeidsgiverIdent = ({ path, isDisabled }: ArbeidsgiverIdentProps) funnet )} - {loadingNaviger && } + {loadingNaviger && } ) } diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useNaviger.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useNaviger.tsx index e1b104d39da..9a46da355cc 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useNaviger.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useNaviger.tsx @@ -4,7 +4,9 @@ import { fetcher } from '@/api' const getNavigerUrl = (ident) => `/dolly-backend/api/v1/ident/naviger/${ident}` export const useNaviger = (ident) => { - const { data, isLoading, error, mutate } = useSWR(ident ? getNavigerUrl(ident) : null, fetcher) + const { data, isLoading, error, mutate } = useSWR(ident ? getNavigerUrl(ident) : null, fetcher, { + shouldRetryOnError: false, + }) return { result: data, From 04c4f4e400a644e1da403c8cff0527f22b55ef44 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Fri, 9 Feb 2024 13:20:32 +0100 Subject: [PATCH 16/19] Fix --- .../main/js/src/components/fagsystem/aareg/form/validation.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx index 5d19104b01c..512a4a32724 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/validation.tsx @@ -85,7 +85,6 @@ const arbeidsgiver = Yup.object({ ident: Yup.string().when('aktoertype', { is: 'PERS', then: () => - // Yup.string() requiredString .matches(/^\d*$/, 'Ident må være et tall med 11 sifre') .test('len', 'Ident må være et tall med 11 sifre', (val) => val && val.length === 11), From f6fbd8efc46be4cc1911506fbdd860a374abc094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristen=20H=C3=A6rum?= Date: Tue, 13 Feb 2024 14:16:25 +0100 Subject: [PATCH 17/19] Remove TPS person status related services and tests (#3415) Fjerner TPS-sync ved bestilling --- .../PensjonforvalterClient.java | 85 ++--- .../service/DollyBestillingService.java | 2 - .../service/GjenopprettBestillingService.java | 5 - .../service/GjenopprettGruppeService.java | 5 - .../service/GjenopprettIdentService.java | 6 - .../ImportAvPersonerFraPdlService.java | 6 - .../service/LeggTilPaaGruppeService.java | 6 - .../service/OppdaterPersonService.java | 6 - .../OpprettPersonerByKriterierService.java | 6 - ...PersonerFraIdenterMedKriterierService.java | 6 - .../service/TpsPersonService.java | 191 ----------- .../dolly/domain/jpa/BestillingProgress.java | 21 -- .../dolly/domain/resultset/SystemTyper.java | 1 - .../BestillingTpsPersonStatusMapper.java | 54 ---- .../BestillingStatusMappingStrategy.java | 2 - .../V1.7.22__AlterTableBestillingProgress.sql | 6 + .../service/TpsPersonServiceTest.java | 302 ------------------ 17 files changed, 37 insertions(+), 673 deletions(-) delete mode 100644 apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonService.java delete mode 100644 apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingTpsPersonStatusMapper.java create mode 100644 apps/dolly-backend/src/main/resources/db/migration/V1.7.22__AlterTableBestillingProgress.sql delete mode 100644 apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonServiceTest.java diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java index 10902a9aa71..844d4495105 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java @@ -84,7 +84,6 @@ public class PensjonforvalterClient implements ClientRegister { private static final String PEN_ALDERSPENSJON = "AP#"; private static final String PEN_UFORETRYGD = "Ufoer#"; private static final String PERIODE = "/periode/"; - private static final String TPS_NOT_READY = "Oppretting ikke utført da TPS mangler persondata."; private final PensjonforvalterConsumer pensjonforvalterConsumer; private final MapperFacade mapperFacade; @@ -173,8 +172,7 @@ public Flux gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly .flatMap(pensjon -> Flux.merge( lagreInntekt(pensjon, - dollyPerson.getIdent(), bestilteMiljoer.get(), - progress.getIsTpsSyncEnv()) + dollyPerson.getIdent(), bestilteMiljoer.get()) .map(response -> POPP_INNTEKTSREGISTER + decodeStatus(response, dollyPerson.getIdent())), lagreTpForhold(pensjon, dollyPerson.getIdent(), bestilteMiljoer.get()) @@ -192,8 +190,7 @@ public Flux gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly dollyPerson.getIdent(), bestilteMiljoer.get(), isOpprettEndre, - bestillingId, - progress.getIsTpsSyncEnv()) + bestillingId) .map(response -> PEN_ALDERSPENSJON + decodeStatus(response, dollyPerson.getIdent())), lagreUforetrygd( @@ -202,8 +199,7 @@ public Flux gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly dollyPerson.getIdent(), bestilteMiljoer.get(), isOpprettEndre, - bestillingId, - progress.getIsTpsSyncEnv()) + bestillingId) .map(response -> PEN_UFORETRYGD + decodeStatus(response, dollyPerson.getIdent())) ) .collectList() @@ -368,8 +364,7 @@ private Flux opprettPersoner(String hovedperson, Set lagreAlderspensjon(PensjonData pensjonData, Tuple2, String> utvidetPersondata, String ident, Set miljoer, - boolean isOpprettEndre, Long bestillingId, - List isTpsSyncEnv) { + boolean isOpprettEndre, Long bestillingId) { return Flux.just(pensjonData) .filter(PensjonData::hasAlderspensjon) @@ -379,38 +374,32 @@ private Flux lagreAlderspensjon(PensjonData pensjonDat if (isOpprettEndre || !transaksjonMappingService.existAlready(PEN_AP, ident, miljoe, null)) { - if (isTpsSyncEnv.contains(miljoe)) { + AlderspensjonRequest pensjonRequest; + var context = new MappingContext.Factory().getContext(); + context.setProperty(IDENT, ident); + context.setProperty(MILJOER, List.of(miljoe)); - AlderspensjonRequest pensjonRequest; - var context = new MappingContext.Factory().getContext(); - context.setProperty(IDENT, ident); - context.setProperty(MILJOER, List.of(miljoe)); - - if (isTrue(alderspensjon.getSoknad())) { - context.setProperty("relasjoner", utvidetPersondata.getT1()); - pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonSoknadRequest.class, context); - - } else { - context.setProperty(NAV_ENHET, utvidetPersondata.getT2()); - pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonVedtakRequest.class, context); - } - - var finalPensjonRequest = new AtomicReference<>(pensjonRequest); - return pensjonforvalterConsumer.lagreAlderspensjon(pensjonRequest) - .map(response -> { - response.getStatus().forEach(status -> { - if (status.getResponse().isResponse2xx()) { - saveAPTransaksjonId(ident, status.getMiljo(), bestillingId, - PEN_AP, finalPensjonRequest); - } - }); - return response; - }); + if (isTrue(alderspensjon.getSoknad())) { + context.setProperty("relasjoner", utvidetPersondata.getT1()); + pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonSoknadRequest.class, context); } else { - return getStatus(miljoe, 503, TPS_NOT_READY); + context.setProperty(NAV_ENHET, utvidetPersondata.getT2()); + pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonVedtakRequest.class, context); } + var finalPensjonRequest = new AtomicReference<>(pensjonRequest); + return pensjonforvalterConsumer.lagreAlderspensjon(pensjonRequest) + .map(response -> { + response.getStatus().forEach(status -> { + if (status.getResponse().isResponse2xx()) { + saveAPTransaksjonId(ident, status.getMiljo(), bestillingId, + PEN_AP, finalPensjonRequest); + } + }); + return response; + }); + } else { return getStatus(miljoe, 200, "OK"); } @@ -419,7 +408,7 @@ private Flux lagreAlderspensjon(PensjonData pensjonDat private Flux lagreUforetrygd(PensjonData pensjondata, String navEnhetNr, String ident, Set miljoer, boolean isOpprettEndre, - Long bestillingId, List isTpsSyncEnv) { + Long bestillingId) { return Flux.just(pensjondata) .filter(PensjonData::hasUforetrygd) @@ -429,8 +418,6 @@ private Flux lagreUforetrygd(PensjonData pensjondata, if (isOpprettEndre || !transaksjonMappingService.existAlready(PEN_UT, ident, miljoe, null)) { - if (isTpsSyncEnv.contains(miljoe)) { - var context = MappingContextUtils.getMappingContext(); context.setProperty(IDENT, ident); context.setProperty(MILJOER, List.of(miljoe)); @@ -446,10 +433,6 @@ private Flux lagreUforetrygd(PensjonData pensjondata, return response; })); - } else { - return getStatus(miljoe, 503, TPS_NOT_READY); - } - } else { return getStatus(miljoe, 200, "OK"); } @@ -490,7 +473,7 @@ private void saveAPTransaksjonId(String ident, String miljoe, Long bestillingId, } private Flux lagreInntekt(PensjonData pensjonData, String ident, - Set miljoer, List isTpsSyncEnv) { + Set miljoer) { return Flux.just(pensjonData) .filter(PensjonData::hasInntekt) @@ -498,16 +481,10 @@ private Flux lagreInntekt(PensjonData pensjonData, Str .flatMap(inntekt -> Flux.fromIterable(miljoer) .flatMap(miljoe -> { - if (isTpsSyncEnv.stream().anyMatch(sync -> sync.equals(miljoe))) { - - var request = mapperFacade.map(inntekt, PensjonPoppInntektRequest.class); - request.setFnr(ident); - request.setMiljoer(List.of(miljoe)); - return pensjonforvalterConsumer.lagreInntekter(request); - - } else { - return getStatus(miljoe, 503, TPS_NOT_READY); - } + var request = mapperFacade.map(inntekt, PensjonPoppInntektRequest.class); + request.setFnr(ident); + request.setMiljoer(List.of(miljoe)); + return pensjonforvalterConsumer.lagreInntekter(request); })); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java index 077ce0429aa..8e7638230b9 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java @@ -13,7 +13,6 @@ import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; import no.nav.dolly.bestilling.pensjonforvalter.PensjonforvalterClient; import no.nav.dolly.bestilling.tagshendelseslager.TagsHendelseslagerClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.jpa.Bruker; @@ -63,7 +62,6 @@ public class DollyBestillingService { protected final PdlDataConsumer pdlDataConsumer; protected final ErrorStatusDecoder errorStatusDecoder; protected final TransactionHelperService transactionHelperService; - protected final TpsPersonService tpsPersonService; protected final BestillingElasticRepository bestillingElasticRepository; public static Set getEnvironments(String miljoer) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java index 704da340cf2..9df72604556 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java @@ -8,7 +8,6 @@ import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.elastic.BestillingElasticRepository; @@ -52,7 +51,6 @@ public GjenopprettBestillingService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository ) { super( @@ -65,7 +63,6 @@ public GjenopprettBestillingService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.bestillingProgressService = bestillingProgressService; @@ -101,8 +98,6 @@ public void executeAsync(Bestilling bestilling) { .filter(BestillingProgress::isPdlSync) .flatMap(pdlSync -> createBestilling(bestilling, gmlProgress.getBestilling())) .flatMap(cobestilling -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, cobestilling, progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, cobestilling, fase2Klienter(), progress, false), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java index 2d282ddadf6..6bef4f0373b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java @@ -8,7 +8,6 @@ import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.elastic.BestillingElasticRepository; @@ -51,7 +50,6 @@ public GjenopprettGruppeService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository ) { super( @@ -64,7 +62,6 @@ public GjenopprettGruppeService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -110,8 +107,6 @@ public void executeAsync(Bestilling bestilling) { .doOnNext(request -> log.info("Startet gjenopprett bestilling {} for ident: {}", request.getId(), testident.getIdent())) .flatMapSequential(bestillingRequest -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, bestillingRequest, progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, bestillingRequest, fase2Klienter(), progress, false), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java index 1be07918e11..9d312403ae4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java @@ -8,7 +8,6 @@ import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.resultset.RsDollyBestillingRequest; @@ -53,7 +52,6 @@ public GjenopprettIdentService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository ) { super( @@ -66,7 +64,6 @@ public GjenopprettIdentService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -116,9 +113,6 @@ public void executeAsync(Bestilling bestilling) { log.info("Startet gjenopprett bestilling {} for ident: {}", request.getId(), testident.getIdent())) .flatMap(bestillingRequest -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, bestillingRequest, - progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, bestillingRequest, fase2Klienter(), progress, false), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java index 58a353ab24f..e7cd67e1e5e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java @@ -7,7 +7,6 @@ import no.nav.dolly.bestilling.ClientRegister; import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.resultset.RsDollyBestillingRequest; @@ -48,7 +47,6 @@ public ImportAvPersonerFraPdlService(IdentService identService, PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository) { super( identService, @@ -60,7 +58,6 @@ public ImportAvPersonerFraPdlService(IdentService identService, pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -91,9 +88,6 @@ public void executeAsync(Bestilling bestilling) { .filter(BestillingProgress::isPdlSync) .flatMap(pdlSync -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, bestKriterier, - progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, bestKriterier, fase2Klienter(), progress, true), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java index 08d207ed6e9..1e81902f92e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java @@ -8,7 +8,6 @@ import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.resultset.RsDollyBestillingRequest; @@ -55,7 +54,6 @@ public LeggTilPaaGruppeService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository) { super( identService, @@ -67,7 +65,6 @@ public LeggTilPaaGruppeService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -105,9 +102,6 @@ public void executeAsync(Bestilling bestilling) { .filter(BestillingProgress::isPdlSync) .flatMap(pdlSync -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, bestKriterier, - progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, bestKriterier, fase2Klienter(), progress, true), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java index 2848ee1a9ef..ccadf0e05f2 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java @@ -8,7 +8,6 @@ import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.resultset.RsDollyUpdateRequest; @@ -52,7 +51,6 @@ public OppdaterPersonService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository) { super( identService, @@ -64,7 +62,6 @@ public OppdaterPersonService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -99,9 +96,6 @@ public void oppdaterPersonAsync(RsDollyUpdateRequest request, Bestilling bestill .filter(BestillingProgress::isPdlSync) .flatMap(pdlSync -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, request, - progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, request, fase2Klienter(), progress, true), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java index 8649dcc50b0..3550addf54e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java @@ -7,7 +7,6 @@ import no.nav.dolly.bestilling.ClientRegister; import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.elastic.BestillingElasticRepository; @@ -49,7 +48,6 @@ public OpprettPersonerByKriterierService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository) { super( identService, @@ -61,7 +59,6 @@ public OpprettPersonerByKriterierService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -96,9 +93,6 @@ public void executeAsync(Bestilling bestilling) { .map(ClientFuture::get) .filter(BestillingProgress::isPdlSync) .flatMap(pdlSync -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, bestKriterier, - progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, bestKriterier, fase2Klienter(), progress, true), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java index 12ed355c9b0..2116d6fe12c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java @@ -7,7 +7,6 @@ import no.nav.dolly.bestilling.ClientRegister; import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; import no.nav.dolly.bestilling.personservice.PersonServiceClient; -import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingProgress; import no.nav.dolly.domain.resultset.RsDollyBestillingRequest; @@ -50,7 +49,6 @@ public OpprettPersonerFraIdenterMedKriterierService( PdlDataConsumer pdlDataConsumer, TransactionHelperService transactionHelperService, PersonServiceClient personServiceClient, - TpsPersonService tpsPersonService, BestillingElasticRepository bestillingElasticRepository) { super( identService, @@ -62,7 +60,6 @@ public OpprettPersonerFraIdenterMedKriterierService( pdlDataConsumer, errorStatusDecoder, transactionHelperService, - tpsPersonService, bestillingElasticRepository ); this.personServiceClient = personServiceClient; @@ -99,9 +96,6 @@ public void executeAsync(Bestilling bestilling) { .map(ClientFuture::get) .filter(BestillingProgress::isPdlSync) .flatMap(pdlSync -> Flux.concat( - tpsPersonService.syncPerson(dollyPerson, bestKriterier, - progress) - .map(ClientFuture::get), gjenopprettKlienter(dollyPerson, bestKriterier, fase2Klienter(), progress, true), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonService.java deleted file mode 100644 index a3a2d4ee62c..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonService.java +++ /dev/null @@ -1,191 +0,0 @@ -package no.nav.dolly.bestilling.tpsmessagingservice.service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.bestilling.ClientFuture; -import no.nav.dolly.bestilling.personservice.PersonServiceConsumer; -import no.nav.dolly.bestilling.tpsmessagingservice.TpsMessagingConsumer; -import no.nav.dolly.domain.PdlPerson; -import no.nav.dolly.domain.PdlPersonBolk; -import no.nav.dolly.domain.jpa.BestillingProgress; -import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling; -import no.nav.dolly.domain.resultset.SystemTyper; -import no.nav.dolly.domain.resultset.dolly.DollyPerson; -import no.nav.dolly.service.TransaksjonMappingService; -import no.nav.dolly.util.TransactionHelperService; -import no.nav.testnav.libs.data.tpsmessagingservice.v1.PersonMiljoeDTO; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.time.Duration; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; -import static no.nav.dolly.errorhandling.ErrorStatusDecoder.encodeStatus; -import static no.nav.dolly.util.DollyTextUtil.getSyncTextSystem; -import static org.apache.commons.lang3.StringUtils.trimToEmpty; - -@Slf4j -@Service -@RequiredArgsConstructor -public class TpsPersonService { - - private static final List PENSJON_MILJOER = List.of("q1", "q2"); - private static final long TIMEOUT_MILLIES = 839; - - @Value("${tps.person.service.wait}") - private long awaitMaxMillies; - - private final TpsMessagingConsumer tpsMessagingConsumer; - private final TransactionHelperService transactionHelperService; - private final TransaksjonMappingService transaksjonMappingService; - private final PersonServiceConsumer personServiceConsumer; - - public Flux syncPerson(DollyPerson dollyPerson, RsDollyUtvidetBestilling bestilling, BestillingProgress progress) { - - long startTime = System.currentTimeMillis(); - - return Flux.fromIterable(bestilling.getEnvironments()) - .filter(PENSJON_MILJOER::contains) - .collectList() - .filter(penMiljoer -> !penMiljoer.isEmpty()) - .filter(penMiljoer -> isRelevantBestilling(bestilling) && - (nonNull(bestilling.getPensjonforvalter().getInntekt()) || - !isTransaksjonMapping(dollyPerson.getIdent(), bestilling, penMiljoer))) - .flatMapMany(penMiljoer -> - getRelasjoner(dollyPerson.getIdent()) - .flatMap(relasjon -> Flux.from(getTpsPerson(startTime, dollyPerson.getIdent(), - penMiljoer, Collections.emptyList(), progress) - .map(status -> prepareResult(relasjon, status, bestilling.getEnvironments(), startTime))))) - .collectList() - .flatMapIterable(Function.identity()) - .map(status -> futurePersist(progress, dollyPerson.getIdent(), status)); - } - - private Flux getRelasjoner(String ident) { - - return personServiceConsumer.getPdlPersoner(List.of(ident)) - .filter(pdlPersonBolk -> nonNull(pdlPersonBolk.getData())) - .map(PdlPersonBolk::getData) - .map(PdlPersonBolk.Data::getHentPersonBolk) - .flatMap(Flux::fromIterable) - .filter(personBolk -> nonNull(personBolk.getPerson())) - .flatMap(person -> Flux.fromStream(Stream.of( - Stream.of(ident), - person.getPerson().getSivilstand().stream() - .map(PdlPerson.Sivilstand::getRelatertVedSivilstand) - .filter(Objects::nonNull), - person.getPerson().getForelderBarnRelasjon().stream() - .map(PdlPerson.ForelderBarnRelasjon::getRelatertPersonsIdent) - .filter(Objects::nonNull)) - .flatMap(Function.identity()))) - .distinct(); - } - - private boolean isRelevantBestilling(RsDollyUtvidetBestilling bestilling) { - - return nonNull(bestilling.getPensjonforvalter()) && - (nonNull(bestilling.getPensjonforvalter().getInntekt()) || - nonNull(bestilling.getPensjonforvalter().getAlderspensjon()) || - nonNull(bestilling.getPensjonforvalter().getUforetrygd())); - } - - private boolean isTransaksjonMapping(String ident, RsDollyUtvidetBestilling bestilling, List miljoer) { - - var transaksjoner = transaksjonMappingService.getTransaksjonMapping(ident); - - return (isNull(bestilling.getPensjonforvalter().getAlderspensjon()) || - miljoer.stream() - .allMatch(miljoe -> transaksjoner.stream() - .anyMatch(transaksjon -> miljoe.equals(transaksjon.getMiljoe()) && - SystemTyper.PEN_AP.name().equals(transaksjon.getSystem())))) && - - (isNull(bestilling.getPensjonforvalter().getUforetrygd()) || - miljoer.stream() - .allMatch(miljoe -> transaksjoner.stream() - .anyMatch(transaksjon -> miljoe.equals(transaksjon.getMiljoe()) && - SystemTyper.PEN_UT.name().equals(transaksjon.getSystem())))); - } - - private Mono> getTpsPerson(Long starttid, String ident, List miljoer, - List status, BestillingProgress progress) { - - if (System.currentTimeMillis() - (starttid + awaitMaxMillies) > 0 || - (status.size() == miljoer.size() && - status.stream().allMatch(PersonMiljoeDTO::isOk))) { - return Mono.just(status); - - } else { - - transactionHelperService.persisterDynamicProgress(progress, - BestillingProgress::getTpsSyncStatus, - BestillingProgress::setTpsSyncStatus, - miljoer.stream() - .map(miljoe -> "%s:%s".formatted(miljoe, encodeStatus(getSyncTextSystem("TPS", - System.currentTimeMillis() - starttid)))) - .collect(Collectors.joining(","))); - - return Flux.just(1) - .delayElements(Duration.ofMillis(TIMEOUT_MILLIES)) - .flatMap(delayed -> tpsMessagingConsumer.getPerson(ident, miljoer)) - .collectList() - .flatMap(resultat -> getTpsPerson(starttid, ident, miljoer, resultat, progress)); - } - } - - private List prepareResult(String ident, List status, Set miljoer, long startTime) { - - if (status.size() == miljoer.size()) { - log.info("Synkronisering mot TPS for {} tok {} ms.", ident, System.currentTimeMillis() - startTime); - - } else { - log.warn("Synkronisering mot TPS for {} gitt opp etter {} ms.", ident, System.currentTimeMillis() - startTime); - } - - return Stream.of(status.stream() - .filter(status1 -> StringUtils.isNotBlank(status1.getMiljoe())), - miljoer.stream() - .filter(miljoe -> status.stream().noneMatch(status1 -> miljoe.equals(status1.getMiljoe()))) - .map(miljoe -> PersonMiljoeDTO.builder() - .ident(ident) - .miljoe(miljoe) - .status("NOK") - .utfyllendeMelding(String.format("Synkronisering mot TPS gitt opp etter %d sekunder.", awaitMaxMillies / 1000)) - .build())) - .flatMap(Function.identity()) - .toList(); - } - - private ClientFuture futurePersist(BestillingProgress progress, String ident, List status) { - - return () -> { - - progress.setIsTpsSyncEnv(status.stream() - .filter(status1 -> ident.equals(status1.getIdent())) - .filter(PersonMiljoeDTO::isOk) - .map(PersonMiljoeDTO::getMiljoe) - .toList()); - - transactionHelperService.persisterDynamicProgress(progress, - BestillingProgress::getTpsSyncStatus, - BestillingProgress::setTpsSyncStatus, - status.stream() - .filter(detalj -> ident.equals(detalj.getIdent())) - .map(detalj -> "%s:%s".formatted(detalj.getMiljoe(), - encodeStatus(detalj.isOk() ? detalj.getStatus() : - trimToEmpty("Feil: %s".formatted(detalj.getUtfyllendeMelding()))))) - .collect(Collectors.joining(","))); - return progress; - }; - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java index 4c31701ae5e..57498aa2ac0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java @@ -24,10 +24,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import static java.util.Objects.isNull; import static org.apache.logging.log4j.util.Strings.isNotBlank; @Entity @@ -118,9 +115,6 @@ public class BestillingProgress implements Serializable { @Column(name = "PDL_PERSON_STATUS") private String pdlPersonStatus; - @Column(name = "TPS_SYNC_STATUS") - private String tpsSyncStatus; - @Column(name = "ARBEIDSPLASSENCV_STATUS") private String arbeidsplassenCVStatus; @@ -131,17 +125,6 @@ public class BestillingProgress implements Serializable { @Transient private boolean isPdlSync; - @Transient - private List isTpsSyncEnv; - - public List getIsTpsSyncEnv() { - - if (isNull(isTpsSyncEnv)) { - isTpsSyncEnv = new ArrayList<>(); - } - return isTpsSyncEnv; - } - private String feil; public BestillingProgress(Bestilling bestilling, String ident, Master master) { @@ -204,7 +187,6 @@ public boolean equals(Object o) { .append(getPdlOrdreStatus(), that.getPdlOrdreStatus()) .append(getKontoregisterStatus(), that.getKontoregisterStatus()) .append(getPdlPersonStatus(), that.getPdlPersonStatus()) - .append(getTpsSyncStatus(), that.getTpsSyncStatus()) .append(getArbeidsplassenCVStatus(), that.getArbeidsplassenCVStatus()) .append(getMaster(), that.getMaster()) .append(getFeil(), that.getFeil()) @@ -239,7 +221,6 @@ public int hashCode() { .append(getPdlOrdreStatus()) .append(getKontoregisterStatus()) .append(getPdlPersonStatus()) - .append(getTpsSyncStatus()) .append(getArbeidsplassenCVStatus()) .append(getMaster()) .append(getFeil()) @@ -274,11 +255,9 @@ public String toString() { ", pdlOrdreStatus='" + pdlOrdreStatus + '\'' + ", kontoregisterStatus='" + kontoregisterStatus + '\'' + ", pdlPersonStatus='" + pdlPersonStatus + '\'' + - ", tpsSyncStatus='" + tpsSyncStatus + '\'' + ", arbeidsplassenCVStatus='" + arbeidsplassenCVStatus + '\'' + ", master=" + master + ", isPdlSync=" + isPdlSync + - ", isTpsSyncEnv=" + isTpsSyncEnv + ", feil='" + feil + '\'' + '}'; } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java index 93f50ad8a63..6fecc63b7ea 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java @@ -40,7 +40,6 @@ public enum SystemTyper { PDL_ORDRE("Ordre til PDL"), KONTOREGISTER("Bankkontoregister"), PDL_PERSONSTATUS("Person finnes i PDL"), - TPS_STATUS("Person finnes i TPS"), ANNEN_FEIL("Annen Feil"), ARBEIDSPLASSENCV("Arbeidsplassen CV"); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingTpsPersonStatusMapper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingTpsPersonStatusMapper.java deleted file mode 100644 index 8a30d0e85da..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingTpsPersonStatusMapper.java +++ /dev/null @@ -1,54 +0,0 @@ -package no.nav.dolly.mapper; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import no.nav.dolly.domain.jpa.BestillingProgress; -import no.nav.dolly.domain.resultset.RsStatusRapport; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; -import static no.nav.dolly.domain.resultset.SystemTyper.TPS_STATUS; -import static no.nav.dolly.mapper.AbstractRsStatusMiljoeIdentForhold.checkAndUpdateStatus; -import static no.nav.dolly.mapper.AbstractRsStatusMiljoeIdentForhold.decodeMsg; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class BestillingTpsPersonStatusMapper { - - public static List buildTpsPersonStatusMap(List progressList) { - - // status miljø ident - Map>> statusEnvIdents = new HashMap<>(); - - progressList.forEach(progress -> { - if (isNotBlank(progress.getTpsSyncStatus())) { - List.of(progress.getTpsSyncStatus().split(",")).forEach(status -> { - var environErrMsg = status.split(":", 2); - var environ = environErrMsg[0]; - if (environErrMsg.length > 1 && isNotBlank(environErrMsg[1]) && isNotBlank(progress.getIdent())) { - var errMsg = decodeMsg(environErrMsg[1]); - checkAndUpdateStatus(statusEnvIdents, progress.getIdent(), environ, errMsg); - } - }); - } - }); - - return statusEnvIdents.isEmpty() ? emptyList() : - singletonList(RsStatusRapport.builder().id(TPS_STATUS).navn(TPS_STATUS.getBeskrivelse()) - .statuser(statusEnvIdents.entrySet().stream().map(status -> RsStatusRapport.Status.builder() - .melding(status.getKey()) - .detaljert(status.getValue().entrySet().stream().map(envIdent -> RsStatusRapport.Detaljert.builder() - .miljo(envIdent.getKey()) - .identer(envIdent.getValue()) - .build()) - .toList()) - .build()) - .toList()) - .build()); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java index f06db0581d9..e7b03e9a9f3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java @@ -42,7 +42,6 @@ import static no.nav.dolly.mapper.BestillingSkjermingsRegisterStatusMapper.buildSkjermingsRegisterStatusMap; import static no.nav.dolly.mapper.BestillingSykemeldingStatusMapper.buildSykemeldingStatusMap; import static no.nav.dolly.mapper.BestillingTpsMessagingStatusMapper.buildTpsMessagingStatusMap; -import static no.nav.dolly.mapper.BestillingTpsPersonStatusMapper.buildTpsPersonStatusMap; import static no.nav.dolly.mapper.BestillingUdiStubStatusMapper.buildUdiStubStatusMap; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -79,7 +78,6 @@ public void mapAtoB(Bestilling bestilling, RsBestillingStatus bestillingStatus, bestillingStatus.getStatus().addAll(buildPdlOrdreStatusMap(progresser, objectMapper)); bestillingStatus.getStatus().addAll(buildImportFraPdlStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildPdlPersonStatusMap(progresser)); - bestillingStatus.getStatus().addAll(buildTpsPersonStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildPensjonforvalterStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildInntektstubStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildTpsMessagingStatusMap(progresser)); diff --git a/apps/dolly-backend/src/main/resources/db/migration/V1.7.22__AlterTableBestillingProgress.sql b/apps/dolly-backend/src/main/resources/db/migration/V1.7.22__AlterTableBestillingProgress.sql new file mode 100644 index 00000000000..2595af9d52f --- /dev/null +++ b/apps/dolly-backend/src/main/resources/db/migration/V1.7.22__AlterTableBestillingProgress.sql @@ -0,0 +1,6 @@ +----------------------------- +-- A L T E R T A B L E S -- +----------------------------- + +alter table bestilling_progress +drop column tps_sync_status; \ No newline at end of file diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonServiceTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonServiceTest.java deleted file mode 100644 index 739d350b1d9..00000000000 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/service/TpsPersonServiceTest.java +++ /dev/null @@ -1,302 +0,0 @@ -package no.nav.dolly.bestilling.tpsmessagingservice.service; - -import no.nav.dolly.bestilling.ClientFuture; -import no.nav.dolly.bestilling.personservice.PersonServiceConsumer; -import no.nav.dolly.bestilling.tpsmessagingservice.TpsMessagingConsumer; -import no.nav.dolly.domain.PdlPerson; -import no.nav.dolly.domain.PdlPersonBolk; -import no.nav.dolly.domain.jpa.BestillingProgress; -import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling; -import no.nav.dolly.domain.resultset.dolly.DollyPerson; -import no.nav.dolly.domain.resultset.pensjon.PensjonData; -import no.nav.dolly.service.RsTransaksjonMapping; -import no.nav.dolly.service.TransaksjonMappingService; -import no.nav.dolly.util.TransactionHelperService; -import no.nav.testnav.libs.data.tpsmessagingservice.v1.PersonMiljoeDTO; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.test.util.ReflectionTestUtils; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; - -import java.util.List; -import java.util.Set; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyList; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class TpsPersonServiceTest { - - private static final String AP = "PEN_AP"; - private static final String UT = "PEN_UT"; - private static final Set ENVS = Set.of("q1", "q2"); - private static final String IDENT = "11111111111"; - - @Mock - private TpsMessagingConsumer tpsMessagingConsumer; - @Mock - private TransactionHelperService transactionHelperService; - @Mock - private TransaksjonMappingService transaksjonMappingService; - - @Mock - private PersonServiceConsumer personServiceConsumer; - @InjectMocks - private TpsPersonService tpsPersonService; - - @Captor - ArgumentCaptor statusCaptor; - - @BeforeEach - void setup() { - statusCaptor = ArgumentCaptor.forClass(String.class); - ReflectionTestUtils.setField(tpsPersonService, "awaitMaxMillies", 1000); - } - - @Test - void syncPerson_TPS_OK() { - - when(personServiceConsumer.getPdlPersoner(anyList())).thenReturn(Flux.just(PdlPersonBolk.builder() - .data(PdlPersonBolk.Data.builder() - .hentPersonBolk(List.of(PdlPersonBolk.PersonBolk.builder() - .person(PdlPerson.Person.builder() - .build()) - .build())) - .build()) - .build())); - when(tpsMessagingConsumer.getPerson(IDENT, ENVS.stream().toList())).thenReturn(Flux.just( - PersonMiljoeDTO.builder().miljoe("q1").ident(IDENT).status("OK").build(), - PersonMiljoeDTO.builder().miljoe("q2").ident(IDENT).status("OK").build())); - - var progress = getProgress(); - - StepVerifier.create(tpsPersonService.syncPerson(getDollyPerson(), getBestilling(null), progress) - .map(ClientFuture::get)) - .assertNext(status -> { - verify(transactionHelperService, times(2)) - .persisterDynamicProgress(any(BestillingProgress.class), any(), any(), statusCaptor.capture()); - assertThat(statusCaptor.getAllValues().get(0), containsString("q1:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(0), containsString("q2:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(1), containsString("q1:OK")); - assertThat(statusCaptor.getAllValues().get(1), containsString("q2:OK")); - assertThat(progress.getIsTpsSyncEnv(), contains("q1", "q2")); - }) - .verifyComplete(); - } - - @ParameterizedTest - @CsvSource({ - "PEN_AP", - "PEN_UT"}) - void syncPerson_pensjon_TPS_OK(String pensjonType) { - - when(transaksjonMappingService.getTransaksjonMapping(getDollyPerson().getIdent())) - .thenReturn(List.of( - RsTransaksjonMapping.builder().ident(IDENT).system(pensjonType).miljoe("q1").build(), - RsTransaksjonMapping.builder().ident(IDENT).system(pensjonType).miljoe("q2").build())); - - var progress = getProgress(); - - StepVerifier.create(tpsPersonService.syncPerson(getDollyPerson(), getBestilling(pensjonType), progress) - .map(ClientFuture::get)) - .expectNextCount(0) - .verifyComplete(); - } - - @ParameterizedTest - @CsvSource({ - "PEN_AP,q1", - "PEN_AP,q2", - "PEN_UT,q1", - "PEN_UT,q2"}) - void syncPerson_pensjon_med_en_TPS_OK(String pensjonType, String miljoe) { - - when(personServiceConsumer.getPdlPersoner(anyList())).thenReturn(Flux.just(PdlPersonBolk.builder() - .data(PdlPersonBolk.Data.builder() - .hentPersonBolk(List.of(PdlPersonBolk.PersonBolk.builder() - .person(PdlPerson.Person.builder() - .build()) - .build())) - .build()) - .build())); - when(tpsMessagingConsumer.getPerson(eq(IDENT), anyList())).thenReturn(Flux.just( - PersonMiljoeDTO.builder().miljoe(miljoe).ident(IDENT).status("OK").build())); - - var progress = getProgress(); - - StepVerifier.create(tpsPersonService.syncPerson(getDollyPerson(), getBestilling(pensjonType, miljoe), progress) - .map(ClientFuture::get)) - .assertNext(status -> { - verify(transactionHelperService, times(2)) - .persisterDynamicProgress(any(BestillingProgress.class), any(), any(), statusCaptor.capture()); - assertThat(statusCaptor.getAllValues().get(0), containsString(miljoe + ":Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(1), containsString(miljoe + ":OK")); - assertThat(progress.getIsTpsSyncEnv(), contains(miljoe)); - }) - .verifyComplete(); - } - - @Test - void syncPerson_TPS_svarer_ikke() { - - when(personServiceConsumer.getPdlPersoner(anyList())).thenReturn(Flux.just(PdlPersonBolk.builder() - .data(PdlPersonBolk.Data.builder() - .hentPersonBolk(List.of(PdlPersonBolk.PersonBolk.builder() - .person(PdlPerson.Person.builder() - .build()) - .build())) - .build()) - .build())); - when(tpsMessagingConsumer.getPerson(IDENT, ENVS.stream().toList())).thenReturn(Flux.empty()); - - var progress = getProgress(); - - StepVerifier.create(tpsPersonService.syncPerson(getDollyPerson(), getBestilling(null), progress) - .map(ClientFuture::get)) - .assertNext(status -> { - verify(transactionHelperService, Mockito.atLeastOnce()) - .persisterDynamicProgress(any(BestillingProgress.class), any(), any(), statusCaptor.capture()); - assertThat(statusCaptor.getAllValues().get(0), containsString("q1:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(0), containsString("q2:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(statusCaptor.getAllValues().size() - 1), containsString("q1:Feil= Synkronisering mot TPS gitt opp")); - assertThat(statusCaptor.getAllValues().get(statusCaptor.getAllValues().size() - 1), containsString("q2:Feil= Synkronisering mot TPS gitt opp")); - assertThat(progress.getIsTpsSyncEnv(), is(empty())); - }) - .verifyComplete(); - } - - @ParameterizedTest - @CsvSource({ - "q1,q2", - "q2,q1"}) - void syncPerson_en_TPS_svarer_ikke(String miljoeSomSvarer, String miljoeSomIkkeSvarer) { - - when(personServiceConsumer.getPdlPersoner(anyList())).thenReturn(Flux.just(PdlPersonBolk.builder() - .data(PdlPersonBolk.Data.builder() - .hentPersonBolk(List.of(PdlPersonBolk.PersonBolk.builder() - .person(PdlPerson.Person.builder() - .build()) - .build())) - .build()) - .build())); - when(tpsMessagingConsumer.getPerson(IDENT, ENVS.stream().toList())).thenReturn(Flux.just( - PersonMiljoeDTO.builder().miljoe(miljoeSomSvarer).ident(IDENT).status("OK").build())); - - var progress = getProgress(); - - StepVerifier.create(tpsPersonService.syncPerson(getDollyPerson(), getBestilling(null), progress) - .map(ClientFuture::get)) - .assertNext(status -> { - verify(transactionHelperService, Mockito.atLeastOnce()) - .persisterDynamicProgress(any(BestillingProgress.class), any(), any(), statusCaptor.capture()); - assertThat(statusCaptor.getAllValues().get(0), containsString("q1:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(0), containsString("q2:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(statusCaptor.getAllValues().size() - 1), containsString(miljoeSomSvarer + ":OK")); - assertThat(statusCaptor.getAllValues().get(statusCaptor.getAllValues().size() - 1), containsString(miljoeSomIkkeSvarer + ":Feil= Synkronisering mot TPS gitt opp")); - assertThat(progress.getIsTpsSyncEnv(), contains(miljoeSomSvarer)); - assertThat(progress.getIsTpsSyncEnv(), contains(not(miljoeSomIkkeSvarer))); - }) - .verifyComplete(); - } - - @ParameterizedTest - @CsvSource({ - "q1,q2", - "q2,q1"}) - void syncPerson_en_TPS_har_ikke_data(String miljoeSomHarData, String miljoeSomIkkeHarData) { - - when(personServiceConsumer.getPdlPersoner(anyList())).thenReturn(Flux.just(PdlPersonBolk.builder() - .data(PdlPersonBolk.Data.builder() - .hentPersonBolk(List.of(PdlPersonBolk.PersonBolk.builder() - .person(PdlPerson.Person.builder() - .build()) - .build())) - .build()) - .build())); - when(tpsMessagingConsumer.getPerson(IDENT, ENVS.stream().toList())).thenReturn(Flux.just( - PersonMiljoeDTO.builder().miljoe(miljoeSomHarData).ident(IDENT).status("OK").build(), - PersonMiljoeDTO.builder().miljoe(miljoeSomIkkeHarData).ident(IDENT).status("Feil").utfyllendeMelding("Personen finnes ikke").build())); - - var progress = getProgress(); - - StepVerifier.create(tpsPersonService.syncPerson(getDollyPerson(), getBestilling(null), progress) - .map(ClientFuture::get)) - .assertNext(status -> { - verify(transactionHelperService, Mockito.atLeastOnce()) - .persisterDynamicProgress(any(BestillingProgress.class), any(), any(), statusCaptor.capture()); - assertThat(statusCaptor.getAllValues().get(0), containsString("q1:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(0), containsString("q2:Info= Synkronisering mot TPS startet ...")); - assertThat(statusCaptor.getAllValues().get(statusCaptor.getAllValues().size() - 1), containsString(miljoeSomHarData + ":OK")); - assertThat(statusCaptor.getAllValues().get(statusCaptor.getAllValues().size() - 1), containsString(miljoeSomIkkeHarData + ":Feil= Personen finnes ikke")); - assertThat(progress.getIsTpsSyncEnv(), contains(miljoeSomHarData)); - assertThat(progress.getIsTpsSyncEnv(), contains(not(miljoeSomIkkeHarData))); - }) - .verifyComplete(); - } - - private BestillingProgress getProgress() { - - return BestillingProgress.builder() - .ident(IDENT) - .build(); - } - - private DollyPerson getDollyPerson() { - - return DollyPerson.builder() - .ident(IDENT) - .build(); - } - - private RsDollyUtvidetBestilling getBestilling(String pensjon) { - - return getBestilling(pensjon, ENVS); - } - - private RsDollyUtvidetBestilling getBestilling(String pensjon, String miljoe) { - - return getBestilling(pensjon, Set.of(miljoe)); - } - - private RsDollyUtvidetBestilling getBestilling(String pensjon, Set miljoe) { - - var dollyBestilling = new RsDollyUtvidetBestilling(); - dollyBestilling.setEnvironments(miljoe); - dollyBestilling.setPensjonforvalter(new PensjonData()); - - if (AP.equals(pensjon)) { - dollyBestilling.getPensjonforvalter() - .setAlderspensjon(new PensjonData.Alderspensjon()); - - } else if (UT.equals(pensjon)) { - dollyBestilling.getPensjonforvalter() - .setUforetrygd(new PensjonData.Uforetrygd()); - - } else { - dollyBestilling.getPensjonforvalter() - .setInntekt(new PensjonData.PoppInntekt()); - } - - return dollyBestilling; - } -} \ No newline at end of file From c6841e7780d5e7e0f141c2ccee3e48494056f27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristen=20H=C3=A6rum?= Date: Thu, 15 Feb 2024 13:03:10 +0100 Subject: [PATCH 18/19] Orika trivia inntektsmelding dato mapping --- .../InntektsmeldingMappingStrategy.java | 72 ++++++++++++++----- .../RsInntektsmelding.java | 24 +++++++ .../InntektsmeldingMappingStrategyTest.java | 61 +++++++++++++++- .../v1/rs/RsArbeidsgiver.java | 4 ++ .../v1/rs/RsArbeidsgiverPrivat.java | 4 ++ .../v1/rs/RsOmsorgspenger.java | 4 ++ 6 files changed, 150 insertions(+), 19 deletions(-) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java index dd7ceac5fe8..bc77d3dbfb7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java @@ -8,14 +8,19 @@ import no.nav.testnav.libs.dto.dokarkiv.v1.RsJoarkMetadata; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.RsInntektsmeldingRequest; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakInnsendingKodeListe; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.YtelseKodeListe; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsforhold; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsgiver; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsArbeidsgiverPrivat; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsAvsendersystem; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsDelvisFravaer; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsEndringIRefusjon; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsKontaktinformasjon; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsNaturalytelseDetaljer; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsOmsorgspenger; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsPeriode; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsRefusjon; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsSykepengerIArbeidsgiverperioden; import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; import org.springframework.stereotype.Component; @@ -26,6 +31,7 @@ import static java.util.Objects.nonNull; import static no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest.Avsendertype; import static no.nav.dolly.util.NullcheckUtil.nullcheckSetDefaultValue; +import static org.apache.commons.lang3.BooleanUtils.isTrue; @Component public class InntektsmeldingMappingStrategy implements MappingStrategy { @@ -71,16 +77,30 @@ public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding, inntektsmelding.setAarsakTilInnsending( nullcheckSetDefaultValue(inntektsmelding.getAarsakTilInnsending(), AarsakInnsendingKodeListe.NY)); - if (nonNull(inntektsmelding.getArbeidsgiver()) && - isNull(inntektsmelding.getArbeidsgiver().getKontaktinformasjon())) { - inntektsmelding.getArbeidsgiver().setKontaktinformasjon( - getFiktivKontaktinformasjon()); + if (nonNull(rsInntektsmelding.getArbeidsgiver())) { + + inntektsmelding.setArbeidsgiver(RsArbeidsgiver.builder() + .kontaktinformasjon( + nullcheckSetDefaultValue( + mapperFacade.map(rsInntektsmelding.getArbeidsgiver().getKontaktinformasjon(), + RsKontaktinformasjon.class), + getFiktivKontaktinformasjon())) + .virksomhetsnummer(rsInntektsmelding.getArbeidsgiver().getVirksomhetsnummer()) + .build()); } - if (nonNull(inntektsmelding.getArbeidsgiverPrivat()) && - isNull(inntektsmelding.getArbeidsgiverPrivat().getKontaktinformasjon())) { - inntektsmelding.getArbeidsgiverPrivat().setKontaktinformasjon( - getFiktivKontaktinformasjon()); + + if (nonNull(rsInntektsmelding.getArbeidsgiverPrivat())) { + + inntektsmelding.setArbeidsgiverPrivat(RsArbeidsgiverPrivat.builder() + .kontaktinformasjon( + nullcheckSetDefaultValue( + mapperFacade.map(rsInntektsmelding.getArbeidsgiverPrivat().getKontaktinformasjon(), + RsKontaktinformasjon.class), + getFiktivKontaktinformasjon())) + .arbeidsgiverFnr(rsInntektsmelding.getArbeidsgiverPrivat().getArbeidsgiverFnr()) + .build()); } + if (isNull(inntektsmelding.getAvsendersystem())) { inntektsmelding.setAvsendersystem(RsAvsendersystem.builder() .innsendingstidspunkt(LocalDateTime.now()) @@ -90,11 +110,29 @@ public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding, inntektsmelding.getAvsendersystem().setSystemversjon("2.0"); inntektsmelding.setStartdatoForeldrepengeperiode(toLocalDateTime(rsInntektsmelding.getStartdatoForeldrepengeperiode())); + + inntektsmelding.setArbeidsforhold(mapperFacade.map(rsInntektsmelding.getArbeidsforhold(), RsArbeidsforhold.class)); + inntektsmelding.setGjenopptakelseNaturalytelseListe(rsInntektsmelding.getGjenopptakelseNaturalytelseListe().stream() + .map(ytelse -> mapperFacade.map(ytelse, RsNaturalytelseDetaljer.class)) + .toList()); + + inntektsmelding.setNaerRelasjon(isTrue(rsInntektsmelding.getNaerRelasjon())); + inntektsmelding.setOmsorgspenger(mapperFacade.map(rsInntektsmelding.getOmsorgspenger(), RsOmsorgspenger.class)); + inntektsmelding.setOpphoerAvNaturalytelseListe(rsInntektsmelding.getOpphoerAvNaturalytelseListe().stream() + .map(ytelse -> mapperFacade.map(ytelse, RsNaturalytelseDetaljer.class)) + .toList()); + + inntektsmelding.setPleiepengerPerioder(rsInntektsmelding.getPleiepengerPerioder().stream() + .map(periode -> mapperFacade.map(periode, RsPeriode.class)) + .toList()); + + inntektsmelding.setRefusjon(mapperFacade.map(rsInntektsmelding.getRefusjon(), RsRefusjon.class)); + inntektsmelding.setSykepengerIArbeidsgiverperioden( + mapperFacade.map(rsInntektsmelding.getSykepengerIArbeidsgiverperioden(), + RsSykepengerIArbeidsgiverperioden.class)); + inntektsmelding.setYtelse(mapperFacade.map(rsInntektsmelding.getYtelse(), YtelseKodeListe.class)); } }) - - .exclude("startdatoForeldrepengeperiode") - .byDefault() .register(); factory.classMap(RsInntektsmelding.RsArbeidsforhold.class, RsArbeidsforhold.class) @@ -117,10 +155,9 @@ public void mapAtoB(RsInntektsmelding.RsDelvisFravaer rsDelvisFravaer, RsDelvisFravaer delvisFravaer, MappingContext context) { delvisFravaer.setDato(toLocalDateTime(rsDelvisFravaer.getDato())); + delvisFravaer.setTimer(rsDelvisFravaer.getTimer()); } }) - .exclude("dato") - .byDefault() .register(); factory.classMap(RsInntektsmelding.RsNaturalYtelseDetaljer.class, RsNaturalytelseDetaljer.class) @@ -143,10 +180,12 @@ public void mapAtoB(RsInntektsmelding.RsRefusjon rsRefusjon, RsRefusjon refusjon, MappingContext context) { refusjon.setRefusjonsopphoersdato(toLocalDateTime(rsRefusjon.getRefusjonsopphoersdato())); + refusjon.setEndringIRefusjonListe(rsRefusjon.getEndringIRefusjonListe().stream() + .map(refusjon1 -> mapperFacade.map(refusjon1, RsEndringIRefusjon.class)) + .toList()); + refusjon.setRefusjonsbeloepPrMnd(rsRefusjon.getRefusjonsbeloepPrMnd()); } }) - .exclude("refusjonsopphoersdato") - .byDefault() .register(); factory.classMap(RsInntektsmelding.RsEndringIRefusjon.class, RsEndringIRefusjon.class) @@ -156,10 +195,9 @@ public void mapAtoB(RsInntektsmelding.RsEndringIRefusjon rsRefusjon, RsEndringIRefusjon refusjon, MappingContext context) { refusjon.setEndringsdato(toLocalDateTime(rsRefusjon.getEndringsdato())); + refusjon.setRefusjonsbeloepPrMnd(rsRefusjon.getRefusjonsbeloepPrMnd()); } }) - .exclude("endringsdato") - .byDefault() .register(); factory.classMap(RsInntektsmelding.RsPeriode.class, RsPeriode.class) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java index 52cb563c079..607ff3ee723 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/inntektsmeldingstub/RsInntektsmelding.java @@ -82,6 +82,22 @@ public List getPleiepengerPerioder() { } return pleiepengerPerioder; } + + public List getGjenopptakelseNaturalytelseListe() { + + if (isNull(gjenopptakelseNaturalytelseListe)) { + gjenopptakelseNaturalytelseListe = new ArrayList<>(); + } + return gjenopptakelseNaturalytelseListe; + } + + public List getOpphoerAvNaturalytelseListe() { + + if (isNull(opphoerAvNaturalytelseListe)) { + opphoerAvNaturalytelseListe = new ArrayList<>(); + } + return opphoerAvNaturalytelseListe; + } } @Data @@ -106,6 +122,14 @@ public static class RsRefusjon { private Double refusjonsbeloepPrMnd; @Field(type = FieldType.Date, format = DateFormat.basic_date, pattern = "uuuu-MM-dd") private LocalDate refusjonsopphoersdato; + + public List getEndringIRefusjonListe() { + + if (isNull(endringIRefusjonListe)) { + endringIRefusjonListe = new ArrayList<>(); + } + return endringIRefusjonListe; + } } @Data diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java index c168d7524de..417e0e76fa3 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategyTest.java @@ -9,8 +9,8 @@ import no.nav.dolly.domain.resultset.inntektsmeldingstub.RsInntektsmelding; import no.nav.dolly.domain.resultset.inntektsmeldingstub.YtelseType; import no.nav.dolly.mapper.MappingContextUtils; -import no.nav.dolly.mapper.strategy.LocalDateCustomMapping; import no.nav.dolly.mapper.utils.MapperTestUtils; +import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakBeregnetInntektEndringKodeListe; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.AarsakInnsendingKodeListe; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.enums.YtelseKodeListe; import no.nav.testnav.libs.dto.inntektsmeldingservice.v1.requests.InntektsmeldingRequest; @@ -41,7 +41,7 @@ public class InntektsmeldingMappingStrategyTest { @BeforeEach void setup() { - mapperFacade = MapperTestUtils.createMapperFacadeForMappingStrategy(new LocalDateCustomMapping(), new InntektsmeldingMappingStrategy()); + mapperFacade = MapperTestUtils.createMapperFacadeForMappingStrategy(new InntektsmeldingMappingStrategy()); } @Test @@ -90,6 +90,63 @@ void mapInntektsmeldingSjekkeEnumFelter() { assertThat(target.getGjenopptakelseNaturalytelseListe().getFirst().getNaturalytelseType(), is(equalTo("BEDRIFTSBARNEHAGEPLASS"))); } + @Test + void mapSykepengerIArbeidsgiverperioden() { + + var target = mapperFacade.map(populateRsInntektsmelding(), InntektsmeldingRequest.class) + .getInntekter().getFirst().getSykepengerIArbeidsgiverperioden(); + assertThat(target.getArbeidsgiverperiodeListe().getFirst().getFom(), + is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getArbeidsgiverperiodeListe().getFirst().getTom(), + is(equalTo(SLUTT_DATO.atStartOfDay()))); + assertThat(target.getBruttoUtbetalt(), is(equalTo(100.0))); + assertThat(target.getBegrunnelseForReduksjonEllerIkkeUtbetalt(), + is(equalTo(BegrunnelseForReduksjonEllerIkkeUtbetaltType.BETVILER_ARBEIDSUFOERHET.name()))); + } + + @Test + void mapRefusjon() { + + var target = mapperFacade.map(populateRsInntektsmelding(), InntektsmeldingRequest.class) + .getInntekter().getFirst().getRefusjon(); + assertThat(target.getEndringIRefusjonListe().getFirst().getEndringsdato(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getEndringIRefusjonListe().getFirst().getRefusjonsbeloepPrMnd(), is(equalTo(1000.0))); + assertThat(target.getRefusjonsbeloepPrMnd(), is(equalTo(500.0))); + assertThat(target.getRefusjonsopphoersdato(), is(equalTo(SLUTT_DATO.atStartOfDay()))); + } + + @Test + void mapOmsorgspenger() { + + var target = mapperFacade.map(populateRsInntektsmelding(), InntektsmeldingRequest.class) + .getInntekter().getFirst().getOmsorgspenger(); + assertThat(target.getFravaersPerioder().getFirst().getFom(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getFravaersPerioder().getFirst().getTom(), is(equalTo(SLUTT_DATO.atStartOfDay()))); + assertThat(target.getDelvisFravaersListe().getFirst().getDato(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getDelvisFravaersListe().getFirst().getTimer(), is(equalTo(100.0))); + assertThat(target.getHarUtbetaltPliktigeDager(), is(true)); + } + + @Test + void mapArbeidsforhold() { + var target = mapperFacade.map(populateRsInntektsmelding(), InntektsmeldingRequest.class) + .getInntekter().getFirst().getArbeidsforhold(); + + assertThat(target.getArbeidsforholdId(), is(equalTo("1"))); + assertThat(target.getAvtaltFerieListe().getFirst().getFom(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getAvtaltFerieListe().getFirst().getTom(), is(equalTo(SLUTT_DATO.atStartOfDay()))); + assertThat(target.getBeregnetInntekt().getAarsakVedEndring(), + is(equalTo(AarsakBeregnetInntektEndringKodeListe.TARIFFENDRING.name()))); + assertThat(target.getBeregnetInntekt().getBeloep(), is(equalTo(1.0))); + assertThat(target.getFoersteFravaersdag(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getGraderingIForeldrepengerListe().getFirst().getArbeidstidprosent(), is(equalTo(100))); + assertThat(target.getGraderingIForeldrepengerListe().getFirst().getPeriode().getFom(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getGraderingIForeldrepengerListe().getFirst().getPeriode().getTom(), is(equalTo(SLUTT_DATO.atStartOfDay()))); + assertThat(target.getUtsettelseAvForeldrepengerListe().getFirst().getAarsakTilUtsettelse(), + is(equalTo(AarsakTilUtsettelseType.LOVBESTEMT_FERIE.name()))); + assertThat(target.getUtsettelseAvForeldrepengerListe().getFirst().getPeriode().getFom(), is(equalTo(START_DATO.atStartOfDay()))); + assertThat(target.getUtsettelseAvForeldrepengerListe().getFirst().getPeriode().getTom(), is(equalTo(SLUTT_DATO.atStartOfDay()))); + } private RsInntektsmelding populateRsInntektsmelding() { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java index c7522dd1368..62774780c74 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiver.java @@ -1,11 +1,15 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsArbeidsgiver { @Size(min = 9, max = 9) diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java index 8f03f6a169a..fca95a90c5f 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsArbeidsgiverPrivat.java @@ -1,11 +1,15 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsArbeidsgiverPrivat { @Size(min = 11, max = 11) diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java index e78d2811317..1b73026dee7 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/inntektsmeldinggeneratorservice/v1/rs/RsOmsorgspenger.java @@ -1,5 +1,7 @@ package no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @@ -8,7 +10,9 @@ import java.util.Objects; @Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class RsOmsorgspenger { private Boolean harUtbetaltPliktigeDager; From d8c3c2bc0836a2b3d98d341be5d9533c13ab50a1 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Thu, 15 Feb 2024 14:17:20 +0100 Subject: [PATCH 19/19] Fjernet tpsmessaging fra sikkerhetstiltak --- .../steg/steg1/paneler/Personinformasjon.tsx | 16 ++------ .../fagsystem/pdlf/form/initialValues.tsx | 7 ---- .../sikkerhetstiltak/Sikkerhetstiltak.tsx | 41 ++++--------------- 3 files changed, 12 insertions(+), 52 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx index 4bab27e2f80..ae4b2031c91 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx @@ -12,7 +12,6 @@ import { initialFullmakt, initialSikkerhetstiltak, initialTilrettelagtKommunikasjon, - initialTpsSikkerhetstiltak, initialVergemaal, } from '@/components/fagsystem/pdlf/form/initialValues' @@ -187,10 +186,7 @@ PersoninformasjonPanel.initialValues = ({ set, setMulti, del, has, opts }) => { }, vergemaal: 'pdldata.person.vergemaal', fullmakt: 'pdldata.person.fullmakt', - sikkerhetstiltak: { - pdl: 'pdldata.person.sikkerhetstiltak', - tpsM: 'tpsMessaging.sikkerhetstiltak', - }, + sikkerhetstiltak: 'pdldata.person.sikkerhetstiltak', tilrettelagtKommunikasjon: 'pdldata.person.tilrettelagtKommunikasjon', utenlandskBankkonto: 'bankkonto.utenlandskBankkonto', norskBankkonto: 'bankkonto.norskBankkonto', @@ -357,13 +353,9 @@ PersoninformasjonPanel.initialValues = ({ set, setMulti, del, has, opts }) => { }, sikkerhetstiltak: { label: 'Sikkerhetstiltak', - checked: has(paths.sikkerhetstiltak.pdl), - add: () => - setMulti( - [paths.sikkerhetstiltak.pdl, [initialSikkerhetstiltak]], - [paths.sikkerhetstiltak.tpsM, [initialTpsSikkerhetstiltak]], - ), - remove: () => del([paths.sikkerhetstiltak.pdl, paths.sikkerhetstiltak.tpsM]), + checked: has(paths.sikkerhetstiltak), + add: () => set(paths.sikkerhetstiltak, [initialSikkerhetstiltak]), + remove: () => del(paths.sikkerhetstiltak), }, tilrettelagtKommunikasjon: { label: 'Tilrettelagt komm.', diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx index d4ef7f9f37e..b6ba59e9136 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx @@ -171,13 +171,6 @@ export const initialMedlAvgangssystem = { dekning: '', } -export const initialTpsSikkerhetstiltak = { - tiltakstype: '', - beskrivelse: '', - gyldigFraOgMed: new Date(), - gyldigTilOgMed: null as unknown as string, -} - export const getInitialStatsborgerskap = (master = 'FREG') => ({ landkode: null as unknown as string, gyldigFraOgMed: null as unknown as string, diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx index cc28c04cfbb..df75022c834 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx @@ -12,10 +12,7 @@ import { isToday } from 'date-fns' import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' import { InputWarning } from '@/components/ui/form/inputWarning/inputWarning' import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' -import { - initialSikkerhetstiltak, - initialTpsSikkerhetstiltak, -} from '@/components/fagsystem/pdlf/form/initialValues' +import { initialSikkerhetstiltak } from '@/components/fagsystem/pdlf/form/initialValues' import { useNavEnheter } from '@/utils/hooks/useNorg2' import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' @@ -28,7 +25,7 @@ interface SikkerhetstiltakValues { } interface SikkerhetstiltakProps { - formikBag: FormikProps<{ tpsf: SikkerhetstiltakValues }> + formikBag: FormikProps } export const Sikkerhetstiltak = ({ formikBag }: SikkerhetstiltakProps) => { @@ -41,13 +38,9 @@ export const Sikkerhetstiltak = ({ formikBag }: SikkerhetstiltakProps) => { setRandomNavUsers(genererTilfeldigeNavPersonidenter()) }, []) - const paths = { - rootPath: 'pdldata.person.sikkerhetstiltak', - tpsMessagingRootPath: 'tpsMessaging.sikkerhetstiltak', - } + const rootPath = 'pdldata.person.sikkerhetstiltak' - const sikkerhetstiltakListe = _.get(formikBag.values, paths.rootPath) - const sikkerhetstiltakListeTps = _.get(formikBag.values, paths.tpsMessagingRootPath) + const sikkerhetstiltakListe = _.get(formikBag.values, rootPath) if (!sikkerhetstiltakListe) { return null @@ -64,36 +57,18 @@ export const Sikkerhetstiltak = ({ formikBag }: SikkerhetstiltakProps) => { ) } - const handleNewEntry = () => { - formikBag.setFieldValue(paths.rootPath, [...sikkerhetstiltakListe, initialSikkerhetstiltak]) - formikBag.setFieldValue(paths.tpsMessagingRootPath, [ - ...sikkerhetstiltakListeTps, - initialTpsSikkerhetstiltak, - ]) - } - const handleValueChange = (value: string, name: string, idx: number) => { - formikBag.setFieldValue(`${paths.rootPath}[${idx}].${name}`, value) - formikBag.setFieldValue(`${paths.tpsMessagingRootPath}[${idx}].${name}`, value) - } - - const handleRemoveEntry = (idx: number) => { - sikkerhetstiltakListe.splice(idx, 1) - sikkerhetstiltakListeTps.splice(idx, 1) - formikBag.setFieldValue(paths.rootPath, sikkerhetstiltakListe) - formikBag.setFieldValue(paths.tpsMessagingRootPath, sikkerhetstiltakListeTps) + formikBag.setFieldValue(`${rootPath}[${idx}].${name}`, value) } return ( - +
{(path: string, idx: number) => { const personident = _.get(formikBag.values, `${path}.kontaktperson.personident`) @@ -107,7 +82,7 @@ export const Sikkerhetstiltak = ({ formikBag }: SikkerhetstiltakProps) => { ? Options('sikkerhetstiltakType') : Options('sikkerhetstiltakType').filter( (option) => option.label !== 'Opphørt', - ) + ) } size="large" onChange={(option: Option) => handleSikkerhetstiltakChange(option, idx)}