From 1ddb0c1e128eea8d6759f58551eb99c1ff520bc4 Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Wed, 11 Sep 2024 15:53:20 +0200 Subject: [PATCH] Add 'isFunnet' method to OrganisasjonDTO Introduce 'isFunnet' method to check if the juridiskEnhet is found. This includes defining a constant NOT_FOUND and utilizing @JsonIgnore for the method. This enhancement is crucial for distinguishing valid organizational entities. --- .../libs/dto/organisasjon/v1/OrganisasjonDTO.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisasjon/v1/OrganisasjonDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisasjon/v1/OrganisasjonDTO.java index 821c2eef33e..b9285723fd7 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisasjon/v1/OrganisasjonDTO.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisasjon/v1/OrganisasjonDTO.java @@ -1,5 +1,6 @@ package no.nav.testnav.libs.dto.organisasjon.v1; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Builder; @@ -8,6 +9,8 @@ import java.util.List; +import static java.util.Objects.nonNull; + @Data @Builder @AllArgsConstructor @@ -15,6 +18,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class OrganisasjonDTO { + public static final String NOT_FOUND = "Ikke funnet"; + private final String error; private final String orgnummer; private final String enhetType; @@ -24,5 +29,10 @@ public class OrganisasjonDTO { private final AdresseDTO forretningsadresser; private final String redigertnavn; private final List driverVirksomheter; -} + @JsonIgnore + public boolean isFunnet() { + + return nonNull(juridiskEnhet) && !NOT_FOUND.equals(juridiskEnhet); + } +}