Skip to content

Commit

Permalink
Merge pull request #456 from Backbase/hotfix/data_group_update_fix
Browse files Browse the repository at this point in the history
Hotfix/data group update fix
  • Loading branch information
jlimamob authored Sep 9, 2024
2 parents b77993c + ee2f724 commit 35ca68b
Show file tree
Hide file tree
Showing 3 changed files with 467 additions and 16 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.9.1](https://github.com/Backbase/stream-services/compare/5.9.0...5.9.1)
### Fixed
- Update data groups with custom data items

## [5.9.0](https://github.com/Backbase/stream-services/compare/5.8.0...5.9.0)
### Added
- Added plan-manager for TVP (Tailored Value Proposition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.backbase.stream.legalentity.model.BusinessFunction;
import com.backbase.stream.legalentity.model.BusinessFunctionGroup;
import com.backbase.stream.legalentity.model.BusinessFunctionGroup.TypeEnum;
import com.backbase.stream.legalentity.model.CustomDataGroupItem;
import com.backbase.stream.legalentity.model.JobProfileUser;
import com.backbase.stream.legalentity.model.JobRole;
import com.backbase.stream.legalentity.model.LegalEntity;
Expand Down Expand Up @@ -773,9 +774,9 @@ public Mono<ProductGroupTask> setupProductGroups(ProductGroupTask streamTask) {

public Mono<BatchProductGroupTask> updateExistingDataGroupsBatch(BatchProductGroupTask task, List<DataGroupItem> existingDataGroups, List<BaseProductGroup> productGroups) {
List<PresentationDataGroupItemPutRequestBody> batchUpdateRequest = new ArrayList<>();
final Set<String> affectedArrangements = productGroups.stream()
.map(StreamUtils::getInternalProductIds)
.flatMap(List::stream)
final Set<String> affectedArrangements = Stream.concat(
productGroups.stream().map(StreamUtils::getInternalProductIds).flatMap(List::stream),
productGroups.stream().map(BaseProductGroup::getCustomDataGroupItems).flatMap(List::stream).map(CustomDataGroupItem::getInternalId))
.collect(Collectors.toSet());
if (task.getIngestionMode().isDataGroupsReplaceEnabled()) {
// if REPLACE mode, existing products (not sent in the request) also need to be added to the set of affected arrangements.
Expand All @@ -794,7 +795,8 @@ public Mono<BatchProductGroupTask> updateExistingDataGroupsBatch(BatchProductGro
List<String> arrangementsToAdd = new ArrayList<>();
List<String> arrangementsToRemove = new ArrayList<>();
affectedArrangements.forEach(arrangement -> pg.ifPresent(p -> {
boolean shouldBeInGroup = StreamUtils.getInternalProductIds(pg.get()).contains(arrangement);
boolean shouldBeInGroup = StreamUtils.getInternalProductIds(pg.get()).contains(arrangement) ||
pg.get().getCustomDataGroupItems().stream().map(CustomDataGroupItem::getInternalId).anyMatch(arrangement::equals);
if (!dbsDataGroup.getItems().contains(arrangement) && shouldBeInGroup) {
// ADD.
log.debug("Arrangement item {} to be added to Data Group {}", arrangement, dbsDataGroup.getName());
Expand Down
Loading

0 comments on commit 35ca68b

Please sign in to comment.