Browse code

BM-15247 Fix: lookup bj-data when syncing domain ABs

Thomas Fricker authored on 02/10/2019 15:07:45
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@ import java.util.Date;
23 23
 import java.util.List;
24 24
 import java.util.Set;
25 25
 import java.util.TimeZone;
26
+import java.util.stream.Collectors;
26 27
 
27 28
 import org.slf4j.Logger;
28 29
 import org.slf4j.LoggerFactory;
... ...
@@ -83,9 +84,13 @@ public class LdapAddressBookSyncJob implements IScheduledJob {
83 84
 				.instance(IContainers.class);
84 85
 
85 86
 		BmContext context = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM).getContext();
86
-		ContainersSyncStore store = new ContainersSyncStore(context.getDataSource());
87
-		List<String> uids = ContainersSyncStore
88
-				.doOrFail(() -> store.list(IAddressBookUids.TYPE, from.getTime().getTime(), MAX, "baseDn"));
87
+
88
+		List<String> uids = context.getAllMailboxDataSource().stream().flatMap(dataSource -> {
89
+			ContainersSyncStore store = new ContainersSyncStore(dataSource);
90
+			return ContainersSyncStore
91
+					.doOrFail(() -> store.list(IAddressBookUids.TYPE, from.getTime().getTime(), MAX, "baseDn"))
92
+					.stream();
93
+		}).collect(Collectors.toList());
89 94
 
90 95
 		if (uids.size() > 0) {
91 96
 			double total = 100d / uids.size();