Skip to content

Commit

Permalink
Merge pull request #497 from Backbase/hotfix/support/5.16.x
Browse files Browse the repository at this point in the history
MAINT-33753 - backport the fix for proper job roles creation
  • Loading branch information
lenach87 authored Dec 20, 2024
2 parents 8ba3f25 + 2bd456f commit cbaa7a4
Showing 3 changed files with 267 additions and 53 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [5.16.2](https://github.com/Backbase/stream-services/compare/5.16.1...5.16.2)
### Fixed
- Fixed respecting the value provided for a job role type in functionGroup

## [5.16.1](https://github.com/Backbase/stream-services/compare/5.16.0...5.16.1)
### Fixed
- Fixed missing explicit state mappings for BaseProduct related classes
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.mapstruct.factory.Mappers;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -1228,11 +1229,26 @@ private Mono<JobRole> createJobRole(StreamTask streamTask, ServiceAgreement serv
presentationIngestFunctionGroup.setExternalServiceAgreementId(serviceAgreement.getExternalId());
presentationIngestFunctionGroup.setMetadata(jobRole.getMetadata());

//since ReferenceJobRole class was removed, now all job roles have the same class, and
//reference job role can be created only for MSA, for CSA it failed
if(BooleanUtils.isTrue(serviceAgreement.getIsMaster())) {
log.debug("Creating a Reference Job Role.");
presentationIngestFunctionGroup.setType(PresentationIngestFunctionGroup.TypeEnum.TEMPLATE);
if (CollectionUtils.isEmpty(jobRole.getFunctionGroups())) {
throw new IllegalArgumentException(
String.format("Unexpected no function groups for job role: %s", jobRole.getName()));
}
final var jobRoleType = jobRole.getFunctionGroups().getFirst().getType();
if (!ObjectUtils.isEmpty(jobRoleType)) {
switch (jobRoleType) {
case TEMPLATE:
presentationIngestFunctionGroup.setType(PresentationIngestFunctionGroup.TypeEnum.TEMPLATE);
break;
case DEFAULT:
presentationIngestFunctionGroup.setType(PresentationIngestFunctionGroup.TypeEnum.REGULAR);
break;
default:
throw new IllegalArgumentException(
String.format("Unexpected enum constant: %s for job role: %s", jobRoleType, jobRole.getName()));
}
} else {
log.debug("No function group job role type is provided, creating a Local Job Role");
presentationIngestFunctionGroup.setType(PresentationIngestFunctionGroup.TypeEnum.REGULAR);
}

// Removing constant from mapper and adding default APS here to avoid issues with apsName.
Loading

0 comments on commit cbaa7a4

Please sign in to comment.