Skip to content

Commit

Permalink
Add 'isFunnet' method to OrganisasjonDTO
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
krharum committed Sep 11, 2024
1 parent 141634f commit 1ddb0c1
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -8,13 +9,17 @@

import java.util.List;

import static java.util.Objects.nonNull;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor(force = true)
@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;
Expand All @@ -24,5 +29,10 @@ public class OrganisasjonDTO {
private final AdresseDTO forretningsadresser;
private final String redigertnavn;
private final List<String> driverVirksomheter;
}

@JsonIgnore
public boolean isFunnet() {

return nonNull(juridiskEnhet) && !NOT_FOUND.equals(juridiskEnhet);
}
}

0 comments on commit 1ddb0c1

Please sign in to comment.