Skip to content

Commit

Permalink
Changed method for getAllGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
olabrustad committed Jun 28, 2024
1 parent 7c1fff5 commit 55c4a1b
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/main/java/no/fintlabs/AzureClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,31 @@ private void pageThroughGroups(GroupCollectionPage inPage) {
GroupCollectionPage page = inPage;
do {
for (Group group : page.getCurrentPage()) {
groups++;

AzureGroup newGroup;
try {
newGroup = new AzureGroup(group, configGroup);
} catch (NumberFormatException e) {
log.warn("Problems converting resourceID to LONG! {}. Skipping creation of group", e);
continue;
}
if (group.displayName != null && group.displayName.endsWith(configGroup.getSuffix())) {
groups++;
AzureGroup newGroup;
try {
newGroup = new AzureGroup(group, configGroup);
} catch (NumberFormatException e) {
log.warn("Problems converting resourceID to LONG! {}. Skipping creation of group", e);
continue;
}

// Put object into cache
try {
pageThroughAzureGroup(
newGroup,
graphService.groups(group.id).members()
.buildRequest()
.select("id")
.get()
);
} catch (ClientException e) {
log.error("Error fetching page", e);
// Put object into cache
try {
pageThroughAzureGroup(
newGroup,
graphService.groups(group.id).members()
.buildRequest()
.select("id")
.get()
);
} catch (ClientException e) {
log.error("Error fetching page", e);
}
azureGroupProducerService.publish(newGroup);
}
azureGroupProducerService.publish(newGroup);
}
if (page.getNextPage() == null) {
break;
Expand Down

0 comments on commit 55c4a1b

Please sign in to comment.