Skip to content

Commit

Permalink
Fixed parallel mode for group imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasvoelcker committed Dec 7, 2023
1 parent d9a4e1d commit 83b5f35
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ private void buildGroupPathLookupMap(Map<String, GroupRepresentation> map, Group
private void createOrUpdateRealmGroup(String realmName, GroupRepresentation group) {
String groupName = group.getName();

Optional<GroupRepresentation> maybeGroup = groupRepository.searchByName(realmName, groupName);
GroupRepresentation existingGroup = groupRepository.getGroupByName(realmName, group.getName());

if (maybeGroup.isPresent()) {
updateGroupIfNecessary(realmName, group);
if (existingGroup != null) {
updateGroupIfNecessary(realmName, group, existingGroup);
} else {
logger.debug("Create group '{}' in realm '{}'", groupName, realmName);
createGroup(realmName, group);
Expand Down Expand Up @@ -186,8 +186,7 @@ public void addSubGroup(String realmName, String parentGroupId, GroupRepresentat
addSubGroups(realmName, patchedGroup);
}

private void updateGroupIfNecessary(String realmName, GroupRepresentation group) {
GroupRepresentation existingGroup = groupRepository.getGroupByName(realmName, group.getName());
private void updateGroupIfNecessary(String realmName, GroupRepresentation group, GroupRepresentation existingGroup) {
GroupRepresentation patchedGroup = CloneUtil.patch(existingGroup, group);
String groupName = existingGroup.getName();

Expand Down

0 comments on commit 83b5f35

Please sign in to comment.