Skip to content

Commit

Permalink
* Statusmapper Fullmakt backend
Browse files Browse the repository at this point in the history
#deploy-test-dolly-backend
  • Loading branch information
stigus committed Oct 16, 2024
1 parent 4199769 commit aca6e70
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public enum SystemTyper {
INST2("Institusjonsopphold (INST2)"),
KONTOREGISTER("Bankkontoregister"),
KRRSTUB("Digital kontaktinformasjon (DKIF)"),
FULLMAKT("Fullmakt"),
MEDL("Medlemskap (MEDL)"),
ORGANISASJON_FORVALTER("Enhetsregisteret (EREG)"),
PDLIMPORT("Import av personer (TESTNORGE)"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package no.nav.dolly.mapper;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsStatusRapport;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static no.nav.dolly.domain.resultset.SystemTyper.FULLMAKT;
import static no.nav.dolly.mapper.AbstractRsStatusMiljoeIdentForhold.decodeMsg;
import static no.nav.dolly.util.ListUtil.listOf;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class BestillingFullmaktStatusMapper {

public static List<RsStatusRapport> buildFullmaktStatusMap(List<BestillingProgress> progressList) {

Map<String, List<String>> statusMap = new HashMap<>();

progressList.forEach(progress -> {
if (isNotBlank(progress.getFullmaktStatus())) {
if (statusMap.containsKey(progress.getFullmaktStatus())) {
statusMap.get(progress.getFullmaktStatus()).add(progress.getIdent());
} else {
statusMap.put(progress.getFullmaktStatus(), listOf(progress.getIdent()));
}
}
});

return statusMap.isEmpty() ? emptyList() :
singletonList(RsStatusRapport.builder().id(FULLMAKT).navn(FULLMAKT.getBeskrivelse())
.statuser(statusMap.entrySet().stream().map(entry -> RsStatusRapport.Status.builder()
.melding(decodeMsg(entry.getKey()))
.identer(entry.getValue())
.build())
.toList())
.build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static no.nav.dolly.mapper.BestillingArenaforvalterStatusMapper.buildArenaStatusMap;
import static no.nav.dolly.mapper.BestillingBrregStubStatusMapper.buildBrregStubStatusMap;
import static no.nav.dolly.mapper.BestillingDokarkivStatusMapper.buildDokarkivStatusMap;
import static no.nav.dolly.mapper.BestillingFullmaktStatusMapper.buildFullmaktStatusMap;
import static no.nav.dolly.mapper.BestillingHistarkStatusMapper.buildHistarkStatusMap;
import static no.nav.dolly.mapper.BestillingImportFraPdlStatusMapper.buildImportFraPdlStatusMap;
import static no.nav.dolly.mapper.BestillingInntektsmeldingStatusMapper.buildInntektsmeldingStatusMap;
Expand Down Expand Up @@ -93,6 +94,7 @@ public void mapAtoB(Bestilling bestilling, RsBestillingStatus bestillingStatus,
bestillingStatus.getStatus().addAll(buildAaregStatusMap(progresser));
bestillingStatus.getStatus().addAll(buildInntektstubStatusMap(progresser));
bestillingStatus.getStatus().addAll(buildKrrStubStatusMap(progresser));
bestillingStatus.getStatus().addAll(buildFullmaktStatusMap(progresser));
bestillingStatus.getStatus().addAll(buildMedlStatusMap(progresser));
bestillingStatus.getStatus().addAll(buildSigrunStubStatusMap(progresser));
bestillingStatus.getStatus().addAll(buildArenaStatusMap(progresser));
Expand Down

0 comments on commit aca6e70

Please sign in to comment.