Skip to content

Commit 3510b58

Browse files
committed
feature: Refactor logging and error handling in various services for improved clarity and consistency #deploy-test-dolly-backend
1 parent 21460bf commit 3510b58

7 files changed

Lines changed: 16 additions & 17 deletions

File tree

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/InstdataClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ private Mono<BestillingProgress> oppdaterStatus(BestillingProgress progress, Str
100100
public void release(List<String> identer) {
101101

102102
instdataConsumer.deleteInstdata(identer)
103-
.subscribe(response -> log.info("Slettet identer fra Instdata (inst 2)"));
103+
.subscribe(_ -> log.info("Slettet identer fra Instdata (inst 2)"));
104104
instdataConsumer.deleteInstKdiData(identer)
105-
.subscribe(response -> log.info("Slettet identer fra Institusjonsopphold fengsel (KDI)"));
105+
.subscribe(_ -> log.info("Slettet identer fra Institusjonsopphold fengsel (KDI)"));
106106
}
107107

108108
private Mono<List<Instdata>> filterInstdata(List<Instdata> instdataRequest, String miljoe) {
@@ -149,8 +149,8 @@ private Mono<String> postInstdataKdi(InstdataKdiDTO instdata, String ident) {
149149
.map(response -> String.format("%s:%s".formatted(
150150
instdata.getEnvironment(),
151151
response.getStatus().is2xxSuccessful() ? "OK" :
152-
errorStatusDecoder.getErrorText(response.getStatus(),
153-
response.getFeilmelding()))));
152+
ErrorStatusDecoder.encodeStatus(errorStatusDecoder.getErrorText(response.getStatus(),
153+
response.getFeilmelding())))));
154154

155155
}
156156
}

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/domain/InstdataKdiDTO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static class ForventetLoeslatelse extends Hendelse{
109109
@AllArgsConstructor
110110
public static class Annullering extends Hendelse {
111111

112-
private LocalDateTime annullertMeldingId;
112+
private String annullertMeldingId;
113113
}
114114

115115
@lombok.Data

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public PersonServiceConsumer(
4646

4747
this.tokenService = tokenService;
4848
serverProperties = consumers.getTestnavPersonService();
49-
log.info("PersonServiceConsumer: Initialiserer med JsonMapper type: {}",
50-
jsonMapper != null ? jsonMapper.getClass().getName() : "null");
5149
this.webClient = webClient
5250
.mutate()
5351
.baseUrl(serverProperties.getUrl())
@@ -106,11 +104,11 @@ public Flux<PdlPersonBolk> getPdlPersoner(List<String> identer, AtomicInteger re
106104
.anyMatch(data -> isNull(data.getPerson())))) {
107105

108106
return Flux.just(true)
109-
.doOnNext(melding ->
107+
.doOnNext(_ ->
110108
log.info("PDL har tomt resultat for {}, retry #{}", String.join(", ", identer),
111109
retry.incrementAndGet()))
112110
.delayElements(Duration.ofMillis(200))
113-
.flatMap(delay -> getPdlPersoner(identer, new AtomicInteger(retry.get())));
111+
.flatMap(_ -> getPdlPersoner(identer, new AtomicInteger(retry.get())));
114112
} else {
115113
return Flux.just(resultat);
116114
}

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import static java.util.Objects.isNull;
5252
import static java.util.Objects.nonNull;
5353
import static no.nav.dolly.domain.jpa.Testident.Master.PDL;
54+
import static no.nav.dolly.domain.jpa.Testident.Master.PDLF;
5455
import static org.apache.logging.log4j.util.Strings.isBlank;
5556
import static org.apache.logging.log4j.util.Strings.isNotBlank;
5657

@@ -156,7 +157,7 @@ private Mono<BestillingProgress> endrePerson(Supplier<Mono<PdlResponse>> operasj
156157

157158
return transactionHelperService.persister(bestillingProgress, BestillingProgress::setPdlForvalterStatus,
158159
bestillingProgress.getPdlForvalterStatus())
159-
.flatMap(progress1 -> operasjon.get())
160+
.flatMap(_ -> operasjon.get())
160161
.map(response -> {
161162

162163
String status;
@@ -236,7 +237,7 @@ protected Mono<DollyPerson> opprettDollyPerson(BestillingProgress progress, Bruk
236237
.master(progress.getMaster())
237238
.tags(Stream.concat(testgruppe.getTags().stream(),
238239
Stream.of(Tags.DOLLY)
239-
.filter(tag -> progress.getMaster() == PDL))
240+
.filter(_ -> progress.getMaster() == PDL))
240241
.toList())
241242
.bruker(bruker)
242243
.build()));
@@ -273,9 +274,9 @@ protected Mono<Void> saveBestillingToElasticServer(RsDollyBestilling bestillingR
273274
}
274275
}
275276

276-
protected Mono<BestillingProgress> opprettProgress(Bestilling bestilling, Testident.Master master) {
277+
protected Mono<BestillingProgress> opprettPDLFProgress(Bestilling bestilling) {
277278

278-
return opprettProgress(bestilling, master, null);
279+
return opprettProgress(bestilling, PDLF, null);
279280
}
280281

281282
protected Mono<BestillingProgress> opprettProgress(Bestilling bestilling, Testident.Master master, String ident) {
@@ -292,7 +293,7 @@ protected Mono<BestillingProgress> opprettPerson(OriginatorUtility.Originator or
292293

293294
bestillingProgress.setPdlForvalterStatus("Info: Oppretting av person startet ...");
294295
return endrePerson(() -> pdlDataConsumer.opprettPdl(originator.getPdlBestilling()), bestillingProgress)
295-
.doOnNext(response -> log.info("Opprettet person med ident ... {}", originator.getPdlBestilling()));
296+
.doOnNext(response -> log.info("Opprettet person med ident ... {}", response.getIdent()));
296297
}
297298

298299
protected Mono<BestillingProgress> oppdaterPerson(OriginatorUtility.Originator originator, BestillingProgress progress) {

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import java.util.List;
2929

30-
import static no.nav.dolly.domain.jpa.Testident.Master.PDLF;
3130
import static org.apache.commons.lang3.StringUtils.isBlank;
3231

3332
@Slf4j
@@ -101,7 +100,7 @@ private Flux<BestillingProgress> opprettPerson(Bestilling bestilling,
101100

102101
return Flux.from(bestillingService.isStoppet(bestilling.getId()))
103102
.takeWhile(BooleanUtils::isFalse)
104-
.concatMap(ok -> opprettProgress(bestilling, PDLF))
103+
.concatMap(ok -> opprettPDLFProgress(bestilling))
105104
.concatMap(progress -> opprettPerson(originator, progress))
106105
.concatMap(this::sendOrdrePerson)
107106
.filter(BestillingProgress::isIdentGyldig)

apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum SystemTyper {
2323
HISTARK("Saksmappearkiv (HISTARK)"),
2424
INNTK("Inntektstub (INNTK)"),
2525
INNTKMELD("Inntektsmelding (ALTINN/JOARK)"),
26-
INST2("Institusjonsopphold (Inst2)"),
26+
INST2("Institusjonsopphold (INST2)"),
2727
INST_KDI("Institusjonsopphold fengsel (KDI)"),
2828
KELVIN_AAP("Kelvin AAP-ytelse"),
2929
KONTOREGISTER("Bankkontoregister"),

apps/dolly-backend/src/main/java/no/nav/dolly/errorhandling/ErrorStatusDecoder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public static String encodeStatus(String toBeEncoded) {
129129
.replace(':', '=')
130130
.replace("\"", "")
131131
.replace("$", "§")
132+
.replace("%", "")
132133
.replace("\n", ""): "";
133134
}
134135
}

0 commit comments

Comments
 (0)