diff --git a/microsoft-integration/impl/src/main/java/org/sakaiproject/microsoft/impl/MicrosoftSynchronizationServiceImpl.java b/microsoft-integration/impl/src/main/java/org/sakaiproject/microsoft/impl/MicrosoftSynchronizationServiceImpl.java index 6057ddc4764..155b6532d8b 100644 --- a/microsoft-integration/impl/src/main/java/org/sakaiproject/microsoft/impl/MicrosoftSynchronizationServiceImpl.java +++ b/microsoft-integration/impl/src/main/java/org/sakaiproject/microsoft/impl/MicrosoftSynchronizationServiceImpl.java @@ -224,9 +224,21 @@ public List getLinkedSiteSynchronizations(boolean fillSite) @Override public List getFilteredSiteSynchronizations(boolean fillSite, SakaiSiteFilter filter, ZonedDateTime fromDate, ZonedDateTime toDate) { + List result = microsoftSiteSynchronizationRepository.findByDate(fromDate, toDate); + + if(filter.getSiteProperty().isEmpty()){ + return result.stream().map(ss -> { + if (fillSite) { + ss.setSite(sakaiProxy.getSite(ss.getSiteId())); + } + return ss; + }) + .collect(Collectors.toList()); + } + final List sites = sakaiProxy.getSakaiSites(filter); - List result = microsoftSiteSynchronizationRepository.findByDate(fromDate, toDate).stream().map(ss -> { + return result.stream().map(ss -> { Site site = null; if (fillSite) { site = sites.stream().filter(s -> s.getId().equals(ss.getSiteId())).findFirst().orElse(null); @@ -237,7 +249,6 @@ public List getFilteredSiteSynchronizations(boolean fillSit }) .filter(Objects::nonNull) .collect(Collectors.toList()); - return result; } @Override