Skip to content

Commit

Permalink
Migrate survey runs to use the involvement group table
Browse files Browse the repository at this point in the history
#CTCTOWALTZ-2760
finos#6637
  • Loading branch information
jessica-woodland-scott-db committed Jun 7, 2023
1 parent a45c261 commit 17891dc
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.stream.Collectors;

import static org.finos.waltz.common.CollectionUtilities.notEmpty;
import static org.finos.waltz.data.JooqUtilities.summarizeResults;
import static org.finos.waltz.schema.Tables.INVOLVEMENT_GROUP;
import static org.finos.waltz.schema.Tables.INVOLVEMENT_GROUP_ENTRY;

Expand Down Expand Up @@ -61,15 +62,17 @@ public Long createInvolvementGroup(InvolvementGroupCreateCommand cmd) {
.getId();

if (invGroupId != null && notEmpty(cmd.involvementKindIds())) {
cmd.involvementKindIds()

int inserted = summarizeResults(cmd.involvementKindIds()
.stream()
.map(kindId -> {
InvolvementGroupEntryRecord entry = dsl.newRecord(INVOLVEMENT_GROUP_ENTRY);
entry.setInvolvementGroupId(invGroupId);
entry.setInvolvementKindId(kindId);
return entry;
})
.collect(Collectors.collectingAndThen(Collectors.toSet(), dsl::batchInsert));
.collect(Collectors.collectingAndThen(Collectors.toSet(), dsl::batchInsert))
.execute());
}

return invGroupId;
Expand Down

0 comments on commit 17891dc

Please sign in to comment.