Skip to content

Commit

Permalink
Lagt til kjoenn og identtype #deploy-test-dolly-backend (#3340)
Browse files Browse the repository at this point in the history
Elastic kjoenn og identtype
  • Loading branch information
krharum authored Nov 21, 2023
1 parent 6f352b0 commit b862706
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import no.nav.testnav.libs.data.pdlforvalter.v1.AdressebeskyttelseDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.Identtype;
import no.nav.testnav.libs.data.pdlforvalter.v1.KjoennDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.SivilstandDTO;

@Data
Expand All @@ -15,13 +17,8 @@
@NoArgsConstructor(force = true)
public class PersonRequest {

@Schema($comment = "Status: " +
"UOPPGITT, UGIFT," +
"GIFT, ENKE_ELLER_ENKEMANN," +
"SKILT, SEPARERT," +
"REGISTRERT_PARTNER, SEPARERT_PARTNER," +
"SKILT_PARTNER, GJENLEVENDE_PARTNER" +
"SAMBOER")
private Identtype identtype;
private KjoennDTO.Kjoenn kjoenn;
private SivilstandDTO.Sivilstand sivilstand;
private AdressebeskyttelseDTO.AdresseBeskyttelse addressebeskyttelse;
private Boolean harBarn;
Expand All @@ -39,7 +36,7 @@ public class PersonRequest {
private Boolean harTilrettelagtKommunikasjon;
private Boolean harSikkerhetstiltak;
private Boolean harOpphold;
@Schema($comment = "landkode")
@Schema(description = "landkode")
private String statsborgerskap;
private Boolean nyIdentitet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addHarTilrettelagtKommunikasjonQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addHarUtenlandskIdentifikasjonsnummerQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addHarUtflyttingQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addIdenttypeQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addKjoennQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addSivilstandQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addStatsborgerskapQuery;
import static no.nav.dolly.elastic.utils.PersonQueryUtils.addVergemaalQuery;
Expand Down Expand Up @@ -137,6 +139,8 @@ private Criteria getCriteria(SearchRequest request) {
addStatsborgerskapQuery(criteria, request);
addHarOppholdQuery(criteria, request);
addHarNyIdentitetQuery(criteria, request);
addKjoennQuery(criteria, request);
addIdenttypeQuery(criteria, request);
});
return criteria;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,24 @@ public static void addHarNyIdentitetQuery(Criteria criteria, SearchRequest reque
}
}

public static void addKjoennQuery(Criteria criteria, SearchRequest request) {

if (nonNull(request.getPersonRequest().getKjoenn())) {
criteria.and(getCriteria("pdldata.person.kjoenn.kjoenn",
request.getPersonRequest().getKjoenn().name()));
}
}

public static void addIdenttypeQuery(Criteria criteria, SearchRequest request) {

if (nonNull(request.getPersonRequest().getIdenttype())) {
criteria.subCriteria(getCriteria("pdldata.opprettNyPerson.identtype",
request.getPersonRequest().getIdenttype().name())
.or(getCriteria("pdldata.person.nyident.identtype",
request.getPersonRequest().getIdenttype().name())));
}
}

private Criteria getCriteria(String field, String value) {

return new Criteria(field).is(value);
Expand Down

0 comments on commit b862706

Please sign in to comment.