-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Utvider Ettersendelse med pleietrengende og type (#422)
* Utvider Ettersendelse med pleietrengende og type * Not Notnull * TODO
- Loading branch information
Showing
6 changed files
with
123 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
ettersendelse/src/main/java/no/nav/k9/ettersendelse/EttersendelseType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package no.nav.k9.ettersendelse; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | ||
|
||
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.ANY) | ||
public enum EttersendelseType { | ||
LEGEERKLÆRING, | ||
ANNET | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ettersendelse/src/main/java/no/nav/k9/ettersendelse/Pleietrengende.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package no.nav.k9.ettersendelse; | ||
|
||
import java.util.Objects; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAlias; | ||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.AssertTrue; | ||
import jakarta.validation.constraints.NotNull; | ||
import no.nav.k9.søknad.felles.type.NorskIdentitetsnummer; | ||
import no.nav.k9.søknad.felles.type.Person; | ||
import no.nav.k9.søknad.felles.type.PersonIdent; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE) | ||
public class Pleietrengende implements Person { | ||
|
||
@JsonAlias({ "fødselsnummer", "norskIdentifikator", "identitetsnummer", "fnr" }) | ||
@JsonProperty(value = "norskIdentitetsnummer", required = true) | ||
@NotNull | ||
@Valid | ||
private NorskIdentitetsnummer norskIdentitetsnummer; | ||
|
||
@JsonCreator | ||
public Pleietrengende(@JsonProperty(value = "norskIdentitetsnummer", required = true) @JsonAlias({ "fødselsnummer", "norskIdentifikator", "identitetsnummer", "fnr" }) NorskIdentitetsnummer norskIdentitetsnummer) { | ||
this.norskIdentitetsnummer = Objects.requireNonNull(norskIdentitetsnummer, "norskIdentitetsnummer"); | ||
} | ||
|
||
@Override | ||
public PersonIdent getPersonIdent() { | ||
return norskIdentitetsnummer; | ||
} | ||
|
||
@AssertTrue(message = "norskIdentitetsnummer må være satt") | ||
private boolean isOk() { | ||
return norskIdentitetsnummer != null && norskIdentitetsnummer.getVerdi() != null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(norskIdentitetsnummer); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == this) | ||
return true; | ||
if (obj == null || !getClass().equals(obj.getClass())) | ||
return false; | ||
var other = (Pleietrengende) obj; | ||
return Objects.equals(getPersonIdent(), other.getPersonIdent()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters