Backbase / stream-services

Stream Services are an Open-Source accelerator to connect with Backbase "out-of-the-box" components responsible for orchestrating calls to Banking Services.
http://engineering.backbase.com/stream-services/
Other
28 stars 20 forks source link

move processAudiencesSegmentation after setupUsers in the LegalEntity… #381

Closed madz0 closed 1 year ago

madz0 commented 1 year ago

move processAudiencesSegmentation after setupUsers in the LegalEntitySaga

Description

move processAudiencesSegmentation after setupUsers in the LegalEntitySaga as when you run it after processJobProfiles some users might be filtered out because of lacking referenceJobRole. Because of this code inside LegalEntitySaga:

private Mono<List<BusinessFunctionGroup>> getBusinessFunctionGroupTemplates(LegalEntityTask streamTask, JobProfileUser jobProfileUser) {
    streamTask.info(LEGAL_ENTITY, BUSINESS_FUNCTION_GROUP, "getBusinessFunctionGroupTemplates", "", "", "Using Reference Job Roles and Custom Job Roles defined in Job Profile User");
    List<BusinessFunctionGroup> businessFunctionGroups = jobProfileUser.getBusinessFunctionGroups();
    if (!isEmpty(jobProfileUser.getReferenceJobRoleNames())) {
        return accessGroupService.getFunctionGroupsForServiceAgreement(retrieveServiceAgreement(streamTask.getData()).getInternalId())
            .map(functionGroups -> {
                Map<String, FunctionGroupItem> idByFunctionGroupName = functionGroups
                    .stream()
                    .filter(fg -> nonNull(fg.getId()))
                    .collect(Collectors.toMap(FunctionGroupItem::getName, Function.identity()));
                return jobProfileUser.getReferenceJobRoleNames().stream()
                    .map(idByFunctionGroupName::get)
                    .filter(Objects::nonNull)
                    .map(businessFunctionGroupMapper::map)
                    .collect(Collectors.toList());
            })
            .map(bf -> {
                if (!isEmpty(businessFunctionGroups))
                    bf.addAll(businessFunctionGroups);
                return bf;
            });
    }
    return Mono.justOrEmpty(businessFunctionGroups);
}

Checklist

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication