Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into feature/java-conventions-plugin-2
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/app.dolly-backend.yml
  • Loading branch information
rfc3092 committed Jul 8, 2024
2 parents f70fcda + 58f5e7f commit cc731dc
Show file tree
Hide file tree
Showing 203 changed files with 13,467 additions and 5,809 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/app.dolly-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ on:
push:
paths:
- "plugins/**"
- libs/data-transfer-objects
- libs/database
- libs/reactive-core
- libs/security-core
- libs/servlet-core
- libs/servlet-insecure-security
- libs/servlet-security
- libs/data-transfer-objects/**
- libs/data-transfer-search-objects/**
- libs/database/**
- libs/reactive-core/**
- libs/security-core/**
- libs/servlet-core/**
- libs/servlet-insecure-security/**
- libs/servlet-security/**
- apps/dolly-backend/**
- .github/workflows/app.dolly-backend.yml

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/app.endringsmelding-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- "plugins/**"
- libs/data-transfer-objects
- libs/data-transfer-search-objects
- libs/reactive-core
- libs/reactive-security
- libs/security-core
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/app.pdl-forvalter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- "plugins/**"
- libs/data-transfer-objects
- libs/data-transfer-search-objects
- libs/database
- libs/security-core
- libs/servlet-core
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/app.skattekort-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: skattekort-service

on:
push:
paths:
- libs/reactive-core
- libs/reactive-security
- libs/security-core
- libs/data-transfer-objects
- apps/skattekort-service/**
- .github/workflows/app.skattekort-service.yml

jobs:
workflow:
uses: ./.github/workflows/common.workflow.backend.yml
with:
working-directory: "apps/skattekort-service"
deploy-tag: "#deploy-skattekort-service"
permissions:
contents: read
id-token: write
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/app.tps-messaging-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- "plugins/**"
- libs/data-transfer-objects
- libs/data-transfer-search-objects
- libs/security-core
- libs/servlet-core
- libs/servlet-security
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/common.workflow.libs.frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
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
run: npm version patch && npm publish
working-directory: ${{ inputs.working-directory }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions apps/dolly-backend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ spec:
allowAllUsers: true
enabled: true
tenant: nav.no
claims:
groups:
- id: '2d7f1c0d-5784-4f81-8bb2-8f3a79f8f949' #everyone else
- id: '9c7efec1-1599-4216-a67e-6fd53a6a951c' #admins
image: "{{image}}"
openSearch:
instance: bestillinger
Expand Down
4 changes: 4 additions & 0 deletions apps/dolly-backend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ spec:
allowAllUsers: true
enabled: true
tenant: nav.no
claims:
groups:
- id: '2d7f1c0d-5784-4f81-8bb2-8f3a79f8f949' #everyone else
- id: '9c7efec1-1599-4216-a67e-6fd53a6a951c' #admins
image: "{{image}}"
openSearch:
instance: bestillinger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public static void main(String[] args) {

SpringApplication.run(DollyBackendApplicationStarter.class, args);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void mapAtoB(RsBregdata bregdata, RolleoversiktTo rolleoversiktTo, Mappin
rolleoversiktTo.setAdresse(mapperFacade.map(personBolk.getPerson(), AdresseTo.class));
rolleoversiktTo.setEnheter(mapperFacade.mapAsList(bregdata.getEnheter(), RolleTo.class));
rolleoversiktTo.setFnr(personBolk.getIdent());
rolleoversiktTo.setFodselsdato(personBolk.getPerson().getFoedsel().stream().findFirst()
.orElse(new PdlPerson.Foedsel())
.getFoedselsdato());
rolleoversiktTo.setFodselsdato(personBolk.getPerson().getFoedselsdato().stream()
.map(PdlPerson.Foedselsdato::getFoedselsdato)
.findFirst().orElse(null));
rolleoversiktTo.setHovedstatus(0);
rolleoversiktTo.setNavn(mapperFacade.map(personBolk.getPerson().getNavn().stream().findFirst()
.orElse(new PdlPerson.Navn()), NavnTo.class));
Expand All @@ -66,7 +66,7 @@ public void mapAtoB(RsBregdata.RolleTo rsRolleTo, RolleTo rolleTo, MappingContex
public void mapAtoB(PdlPerson.Person person, AdresseTo adresseTo, MappingContext context) {

if (!person.getBostedsadresse().isEmpty()) {
var adresse = person.getBostedsadresse().get(0);
var adresse = person.getBostedsadresse().getFirst();
if (nonNull(adresse.getVegadresse())) {
adresseTo.setAdresse1(format("%s %s", adresse.getVegadresse().getAdressenavn(),
adresse.getVegadresse().getHusnummer()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public void mapAtoB(PdlPersonBolk.PersonBolk person, PensjonPersonRequest pensjo

pensjonPersonRequest.setFnr(person.getIdent());

pensjonPersonRequest.setFodselsDato(getFoedselsdato(person.getPerson().getFoedsel().stream()
.map(PdlPerson.Foedsel::getFoedselsdato)
pensjonPersonRequest.setFodselsDato(getFoedselsdato(person.getPerson().getFoedselsdato().stream()
.map(PdlPerson.Foedselsdato::getFoedselsdato)
.filter(Objects::nonNull)
.findFirst().orElse(null), pensjonPersonRequest.getFnr()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ public void mapAtoB(PdlPersonBolk.Data persondata, Pasient pasient, MappingConte
.findFirst().orElse(new PdlPerson.Navn()), pasient);
pasient.setAdresse(mapperFacade.map(person.getPerson().getBostedsadresse().stream()
.findFirst().orElse(new BostedadresseDTO()), Adresse.class, context));
pasient.setFoedselsdato(person.getPerson().getFoedsel().getFirst().getFoedselsdato());
pasient.setFoedselsdato(person.getPerson().getFoedselsdato().stream()
.map(PdlPerson.Foedselsdato::getFoedselsdato)
.findFirst().orElse(null));

pasient.setTelefon(person.getPerson().getTelefonnummer().stream()
.filter(telefonnummer -> telefonnummer.getPrioritet() == 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public UdiPersonWrapper merge(RsUdiPerson nyUdiPerson, UdiPersonResponse eksiste
udiPerson.setIdent(personBolk.getIdent());
udiPerson.setNavn(mapperFacade.map(personBolk.getPerson().getNavn().stream()
.findFirst().orElse(new PdlPerson.Navn()), UdiPersonNavn.class));
udiPerson.setFoedselsDato(personBolk.getPerson().getFoedsel().stream().map(PdlPerson.Foedsel::getFoedselsdato)
udiPerson.setFoedselsDato(personBolk.getPerson().getFoedselsdato().stream()
.map(PdlPerson.Foedselsdato::getFoedselsdato)
.findFirst().orElse(null));

udiPerson.setAliaser(personBolk.getPerson().getFolkeregisteridentifikator().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import no.nav.testnav.libs.data.pdlforvalter.v1.DeltBostedDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.DoedfoedtBarnDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.FalskIdentitetDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.FoedestedDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.ForeldreansvarDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.FullmaktDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.InnflyttingDTO;
Expand Down Expand Up @@ -103,7 +104,8 @@ public static class Identer {
public static class Person {

private List<PdlPerson.Navn> navn;
private List<PdlPerson.Foedsel> foedsel;
private List<PdlPerson.Foedselsdato> foedselsdato;
private List<FoedestedDTO> foedested;
private List<PdlPerson.ForelderBarnRelasjon> forelderBarnRelasjon;
private List<PdlPerson.Sivilstand> sivilstand;
private List<PdlPerson.Doedsfall> doedsfall;
Expand Down Expand Up @@ -137,13 +139,6 @@ public List<PdlPerson.Navn> getNavn() {
return navn;
}

public List<PdlPerson.Foedsel> getFoedsel() {
if (isNull(foedsel)) {
foedsel = new ArrayList<>();
}
return foedsel;
}

public List<PdlPerson.ForelderBarnRelasjon> getForelderBarnRelasjon() {
if (isNull(forelderBarnRelasjon)) {
forelderBarnRelasjon = new ArrayList<>();
Expand Down Expand Up @@ -311,6 +306,20 @@ public List<InnflyttingDTO> getInnflyttingTilNorge() {
}
return innflyttingTilNorge;
}

public List<Foedselsdato> getFoedselsdato() {
if (isNull(foedselsdato)) {
foedselsdato = new ArrayList<>();
}
return foedselsdato;
}

public List<FoedestedDTO> getFoedested() {
if (isNull(foedested)) {
return foedested;
}
return foedested;
}
}

@lombok.Data
Expand Down Expand Up @@ -363,6 +372,17 @@ public static class Foedsel extends DbVersjonDTO {
private LocalDate foedselsdato;
}

@lombok.Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public static class Foedselsdato extends DbVersjonDTO {

private Integer foedselsaar;
private LocalDate foedselsdato;
}

@lombok.Data
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
Expand Down Expand Up @@ -514,7 +534,7 @@ public enum Personstatus {
MIDLERTIDIG("midlertidig"),
INAKTIV("inaktiv");

private String beskrivelse;
private final String beskrivelse;

Personstatus(String camelCaseValue) {
this.beskrivelse = camelCaseValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -25,7 +26,9 @@
import org.hibernate.annotations.Parameter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static no.nav.dolly.domain.jpa.HibernateConstants.SEQUENCE_STYLE_GENERATOR;
Expand Down Expand Up @@ -76,6 +79,9 @@ public class Bruker implements Serializable {
@JoinColumn(name = "EID_AV_ID")
private Bruker eidAv;

@Transient
private List<String> grupper = new ArrayList<>();

@OneToMany
@JoinColumn(name = "opprettet_av")
@Builder.Default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class RsBruker {
private Brukertype brukertype;
private String epost;
private String navIdent;
private List<String> grupper;
private List<RsTestgruppe> favoritter;

public List<RsTestgruppe> getFavoritter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class BestillingTpsMessagingStatusMapper {

private static final List<String> HIDE_MILJOER = List.of("t13", "q5", "qa", "qx");
private static final String OKEY = "OK";
private static final String ADVARSEL = "Advarsel: ";
private static final String FEIL = "Feil: ";
Expand All @@ -50,6 +51,7 @@ public static List<RsStatusRapport> buildTpsMessagingStatusMap(List<BestillingPr
.map(melding ->
Stream.of(melding.split("#")[1].split(","))
.filter(status -> status.contains(":"))
.filter(BestillingTpsMessagingStatusMapper::containsValidMiljoe)
.map(status -> StatusTemp.builder()
.ident(progress.getIdent())
.melding(getStatus(String.format("%s %s", melding.split("#")[0],
Expand Down Expand Up @@ -114,7 +116,7 @@ private static String formatMsg(String message) {
.replace("_", " "));
}
if (StringUtils.containsIgnoreCase(message, "Startet ")) {
return decodeMsg(message.replace("Startet ",""));
return decodeMsg(message.replace("Startet ", ""));
}
return message;
}
Expand All @@ -128,7 +130,6 @@ private static String getStatus(String status) {
return status.contains(OKEY) ||
status.toLowerCase().contains("person ikke funnet i tps") ||
status.toLowerCase().contains("dette er data som allerede er registrert i tps") ||
status.toLowerCase().contains("det finnes allerede en lik putl-adresse") ||
status.toLowerCase().contains("utgått fødselsnr") ||
status.toLowerCase().contains("mottaker svarer ikke") ||
status.toLowerCase().contains("forbindelsen er ustabil")
Expand All @@ -137,6 +138,10 @@ private static String getStatus(String status) {
}
}

private static boolean containsValidMiljoe(String status) {
return !HIDE_MILJOER.contains(status.split(":")[0]);
}

@Data
@Builder
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
package no.nav.dolly.mapper.strategy;

import lombok.RequiredArgsConstructor;
import ma.glasnost.orika.CustomMapper;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.MappingContext;
import no.nav.dolly.domain.jpa.Bruker;
import no.nav.dolly.domain.resultset.entity.bruker.RsBruker;
import no.nav.dolly.domain.resultset.entity.bruker.RsBrukerAndGruppeId;
import no.nav.dolly.domain.resultset.entity.bruker.RsBrukerUtenFavoritter;
import no.nav.dolly.mapper.MappingStrategy;
import no.nav.testnav.libs.servletsecurity.action.GetUserInfo;
import org.springframework.stereotype.Component;

import static java.util.Objects.nonNull;
import static no.nav.dolly.util.CurrentAuthentication.getAuthUser;

@Component
@RequiredArgsConstructor
public class BrukerMappingStrategy implements MappingStrategy {

private final GetUserInfo getUserInfo;

@Override
public void register(MapperFactory factory) {
factory.classMap(Bruker.class, RsBrukerAndGruppeId.class)
Expand Down Expand Up @@ -47,5 +54,18 @@ public void mapAtoB(Bruker bruker, RsBrukerUtenFavoritter rsBruker, MappingConte
})
.byDefault()
.register();

factory.classMap(Bruker.class, RsBruker.class)
.customize(new CustomMapper<>() {
@Override
public void mapAtoB(Bruker bruker, RsBruker rsBruker, MappingContext context) {

var brukerInfo = getAuthUser(getUserInfo);
rsBruker.setGrupper(brukerInfo.getGrupper());
}
})
.byDefault()
.register();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ public void mapAtoB(PersonDTO personDTO, PersonDTO akkumulertDTO, MappingContext
akkumulertDTO.getDoedfoedtBarn().addAll(personDTO.getDoedfoedtBarn());
akkumulertDTO.getDoedsfall().addAll(personDTO.getDoedsfall());
akkumulertDTO.getFalskIdentitet().addAll(personDTO.getFalskIdentitet());
akkumulertDTO.getFoedested().addAll(personDTO.getFoedested());
akkumulertDTO.getFoedsel().addAll(personDTO.getFoedsel());
akkumulertDTO.getFoedselsdato().addAll(personDTO.getFoedselsdato());
akkumulertDTO.getFolkeregisterPersonstatus().addAll(personDTO.getFolkeregisterPersonstatus());
akkumulertDTO.getForelderBarnRelasjon().addAll(personDTO.getForelderBarnRelasjon());
akkumulertDTO.getForeldreansvar().addAll(personDTO.getForeldreansvar());
Expand Down
Loading

0 comments on commit cc731dc

Please sign in to comment.