Skip to content

Commit

Permalink
Merge branch 'master' into feature/tps-messaging-legge-til-kilde-i-pr…
Browse files Browse the repository at this point in the history
…olog
  • Loading branch information
krharum committed May 14, 2024
2 parents 6b89279 + bbedb6f commit fe5c7c2
Show file tree
Hide file tree
Showing 243 changed files with 5,080 additions and 5,414 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app.organisasjon-tilgang-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: ./.github/workflows/common.workflow.frontend.yml
with:
working-directory: "apps/organisasjon-tilgang-frontend"
deploy-tag: "#deploy-test-organisasjon-tilgang-frontend"
deploy-tag: "#deploy-organisasjon-tilgang-frontend"
permissions:
contents: read
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/proxy.dokarkiv-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
cluster: "dev-fss"
working-directory: "proxies/dokarkiv-proxy"
deploy-tag: "#deploy-proxy"
deploy-tag: "#deploy-dokarkiv-proxy"
permissions:
contents: read
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/proxy.pdl-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
cluster: "dev-fss"
working-directory: "proxies/pdl-proxy"
deploy-tag: "#deploy-proxy"
deploy-tag: "#deploy-pdl-proxy"
permissions:
contents: read
id-token: write
Expand Down
3 changes: 1 addition & 2 deletions apps/adresse-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
3 changes: 1 addition & 2 deletions apps/amelding-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
3 changes: 1 addition & 2 deletions apps/brreg-stub/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
6 changes: 2 additions & 4 deletions apps/bruker-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand All @@ -25,8 +24,7 @@

<springProfile name="dev">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
3 changes: 1 addition & 2 deletions apps/budpro-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<configuration>
<springProfile name="prod,dev">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackLayout"/>
<encoder class="no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder">
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-backend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spec:
- application: testnav-batch-bestilling-service
- application: testnav-dollystatus
- application: testnav-oversikt-frontend
- application: testnav-tenor-search-service
outbound:
rules:
- application: generer-navn-service
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-backend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
- application: testnav-dollystatus
- application: testnav-helsepersonell-service
- application: testnav-oversikt-frontend
- application: testnav-tenor-search-service
- application: etterlatte-testdata
namespace: etterlatte
outbound:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import no.nav.dolly.bestilling.pdldata.command.PdlDataOpprettingCommand;
import no.nav.dolly.bestilling.pdldata.command.PdlDataOrdreCommand;
import no.nav.dolly.bestilling.pdldata.command.PdlDataSlettCommand;
import no.nav.dolly.bestilling.pdldata.command.PdlDataSlettUtenomCommand;
import no.nav.dolly.bestilling.pdldata.command.PdlDataStanaloneCommand;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.config.Consumers;
Expand All @@ -33,8 +32,6 @@
@Service
public class PdlDataConsumer implements ConsumerStatus {

private static final int BLOCK_SIZE = 10;

private final TokenExchange tokenService;
private final WebClient webClient;
private final ServerProperties serverProperties;
Expand Down Expand Up @@ -72,19 +69,6 @@ public Mono<List<Void>> slettPdl(List<String> identer) {
.collectList();
}

@Timed(name = "providers", tags = {"operation", "pdl_delete_utenom"})
public Mono<List<Void>> slettPdlUtenom(List<String> identer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> Flux.range(0, (identer.size() / BLOCK_SIZE) + 1)
.delayElements(Duration.ofMillis(1000))
.map(count -> new PdlDataSlettUtenomCommand(webClient,
identer.subList(count * BLOCK_SIZE, Math.min((count + 1) * BLOCK_SIZE, identer.size())),
token.getTokenValue()).call())
.flatMap(Flux::from))
.collectList();
}

@Timed(name = "providers", tags = {"operation", "pdl_opprett"})
public Flux<PdlResponse> opprettPdl(BestillingRequestDTO request) {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
package no.nav.dolly.bestilling.pdldata.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

import static org.apache.commons.lang3.StringUtils.isNotBlank;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class PdlResponse {

private static final String FINNES_IKKE = "finnes ikke";

private String ident;
private String jsonNode;
private HttpStatus status;
private String feilmelding;

@JsonIgnore
public boolean isFinnesIkke() {

return isNotBlank(feilmelding) && feilmelding.contains(FINNES_IKKE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import no.nav.dolly.service.BestillingService;
import no.nav.dolly.service.IdentService;
import no.nav.dolly.util.TransactionHelperService;
import no.nav.testnav.libs.data.pdlforvalter.v1.PersonUpdateRequestDTO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -145,16 +146,26 @@ protected Flux<BestillingProgress> gjenopprettKlienter(DollyPerson dollyPerson,
.map(ClientFuture::get);
}

protected void leggIdentTilGruppe(BestillingProgress progress, String beskrivelse) {

leggIdentTilGruppe(null, progress, beskrivelse);
}

protected void leggIdentTilGruppe(String ident, BestillingProgress progress, String beskrivelse) {

identService.saveIdentTilGruppe(ident, progress.getBestilling().getGruppe(), progress.getMaster(), beskrivelse);
log.info("Ident {} lagt til gruppe {}", ident, progress.getBestilling().getGruppe().getId());
identService.saveIdentTilGruppe(isNotBlank(ident) ? ident : progress.getIdent(), progress.getBestilling().getGruppe(), progress.getMaster(), beskrivelse);
log.info("Ident {} lagt til gruppe {}", progress.getIdent(), progress.getBestilling().getGruppe().getId());
}

protected Flux<DollyPerson> opprettDollyPerson(BestillingProgress progress, Bruker bruker) {

return opprettDollyPerson(null, progress, bruker);
}

protected Flux<DollyPerson> opprettDollyPerson(String ident, BestillingProgress progress, Bruker bruker) {

return Flux.just(DollyPerson.builder()
.ident(ident)
.ident(isNotBlank(ident) ? ident : progress.getIdent())
.master(progress.getMaster())
.tags(Stream.concat(progress.getBestilling().getGruppe().getTags().stream(),
Stream.of(Tags.DOLLY)
Expand Down Expand Up @@ -224,6 +235,11 @@ protected Flux<PdlResponse> opprettPerson(OriginatorUtility.Originator originato

protected Flux<String> sendOrdrePerson(BestillingProgress progress, PdlResponse forvalterStatus) {

if (progress.getMaster() == PDL) {

transactionHelperService.persister(progress, BestillingProgress::setPdlImportStatus, "OK");
}

if (nonNull(forvalterStatus.getStatus())) {

transactionHelperService.persister(progress, BestillingProgress::setPdlForvalterStatus,
Expand All @@ -234,12 +250,7 @@ protected Flux<String> sendOrdrePerson(BestillingProgress progress, PdlResponse
forvalterStatus.getIdent() : "?");
}

if (progress.getMaster() == PDL) {

transactionHelperService.persister(progress, BestillingProgress::setPdlImportStatus, "OK");
return Flux.just(progress.getIdent());

} else if (isNull(forvalterStatus.getStatus()) || forvalterStatus.getStatus().is2xxSuccessful()) {
if (isNull(forvalterStatus.getStatus()) || forvalterStatus.getStatus().is2xxSuccessful()) {

transactionHelperService.persister(progress, BestillingProgress::setPdlOrdreStatus,
"Info: Ordre til PDL startet ...");
Expand All @@ -248,10 +259,12 @@ protected Flux<String> sendOrdrePerson(BestillingProgress progress, PdlResponse
var status = resultat.getStatus().is2xxSuccessful() ?
resultat.getJsonNode() :
errorStatusDecoder.getErrorText(resultat.getStatus(), resultat.getFeilmelding());
transactionHelperService.persister(progress, BestillingProgress::setPdlOrdreStatus, status);
transactionHelperService.persister(progress, BestillingProgress::setPdlOrdreStatus,
!resultat.isFinnesIkke() ? status : null);
log.info("Sendt ordre til PDL for ident {} ", forvalterStatus.getIdent());
})
.map(resultat -> resultat.getStatus().is2xxSuccessful() ? forvalterStatus.getIdent() : "");
.map(resultat -> resultat.getStatus().is2xxSuccessful() || resultat.isFinnesIkke()
? forvalterStatus.getIdent() : "");

} else {

Expand Down Expand Up @@ -282,4 +295,23 @@ protected Flux<RsDollyBestillingRequest> createBestilling(Bestilling bestilling,
coBestilling.getMiljoer())
.build()));
}

protected Flux<PdlResponse> oppdaterPdlPerson(OriginatorUtility.Originator originator, BestillingProgress progress) {

if (nonNull(originator.getPdlBestilling()) && nonNull(originator.getPdlBestilling().getPerson())) {

transactionHelperService.persister(progress, BestillingProgress::setPdlForvalterStatus,
"Info: Oppdatering av person startet ...");
return pdlDataConsumer.oppdaterPdl(originator.getIdent(),
PersonUpdateRequestDTO.builder()
.person(originator.getPdlBestilling().getPerson())
.build())
.doOnNext(response -> log.info("Oppdatert person til PDL-forvalter med response {}", response));

} else {
return Flux.just(PdlResponse.builder()
.ident(originator.getIdent())
.build());
}
}
}
Loading

0 comments on commit fe5c7c2

Please sign in to comment.