Skip to content

Commit

Permalink
Refactor organization processing logic in service layer #deploy-altin…
Browse files Browse the repository at this point in the history
…n3-tilgang-service-prod #deploy-altinn3-tilgang-service

Removed unnecessary mapping and flattening of subunits from the organization processing pipeline. This simplifies the logic and improves readability without affecting the core functionality. Adjustments focus on streamlining filters and data transformation.
  • Loading branch information
krharum committed Dec 20, 2024
1 parent 3947226 commit fc342cb
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

import java.util.List;

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

@Slf4j
@Service
@RequiredArgsConstructor
Expand All @@ -37,10 +34,6 @@ private Flux<OrganisasjonDTO> getOrganisasjon(Tuple2<List<AuthorizedPartyDTO>, L

return Flux.fromIterable(organisasjoner.getT1())
.doOnNext(org -> log.info("Organisasjon {}", org))
// .filter(party -> organisasjoner.getT2().stream()
// .anyMatch(organisasjon -> organisasjon.getOrganisasjonsnummer().equals(party.getOrganizationNumber())))
.map(AuthorizedPartyDTO::getSubunits)
.flatMap(Flux::fromIterable)
.filter(party -> party.getAuthorizedResources().contains(DOLLY_RESOURCE))
.filter(party -> organisasjoner.getT2().stream()
.anyMatch(organisasjon -> organisasjon.getOrganisasjonsnummer().equals(party.getOrganizationNumber())))
Expand All @@ -67,8 +60,6 @@ public Mono<PersonDTO> getPersonOrganisasjonDetaljertTilgang(String ident) {
private Flux<PersonDTO.OrganisasjonDTO> getTilpassetOrganisasjon(Tuple2<List<AuthorizedPartyDTO>, List<Organisasjon>> organisasjoner) {

return Flux.fromIterable(organisasjoner.getT1())
.map(AuthorizedPartyDTO::getSubunits)
.flatMap(Flux::fromIterable)
.map(party -> PersonDTO.OrganisasjonDTO.builder()
.navn(party.getName())
.organisasjonsnummer(party.getOrganizationNumber())
Expand Down

0 comments on commit fc342cb

Please sign in to comment.