From 8deeb853493d53a7cf115cfa51659a31bd09fefb Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 31 Jan 2015 15:27:34 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud) 93981: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 93849: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1) 93762: Fix for MNT-13198 BM-0012: Run v420b1494_01: (CMIS) GetSites is Slow - use the bridge table to list sites. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@95021 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/repo/site/SiteServiceImpl.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/source/java/org/alfresco/repo/site/SiteServiceImpl.java b/source/java/org/alfresco/repo/site/SiteServiceImpl.java index 16b622b4d7..a8cc104cf0 100644 --- a/source/java/org/alfresco/repo/site/SiteServiceImpl.java +++ b/source/java/org/alfresco/repo/site/SiteServiceImpl.java @@ -1210,22 +1210,23 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic { final int maxResults = size > 0 ? size : 1000; final Set siteNames = new TreeSet(); - authorityService.getContainingAuthoritiesInZone(AuthorityType.GROUP, userName, AuthorityService.ZONE_APP_SHARE, new AuthorityFilter(){ - @Override - public boolean includeAuthority(String authority) + + // MNT-13198 - use the bridge table + Set containingAuthorities = authorityService.getContainingAuthorities(AuthorityType.GROUP, userName, false); + for(String authority : containingAuthorities) + { + if (siteNames.size() < maxResults) { - if (siteNames.size() < maxResults) + String siteName = resolveSite(authority); + // MNT-10836 fix, after MNT-10109 we should also check site existence + // A simple exists check would be better than getting the site properties etc - profiling suggests x2 faster + if ((siteName != null) && (getSite(siteName) != null)) { - String siteName = resolveSite(authority); - // MNT-10836 fix, after MNT-10109 we should also check site existence - if (siteName == null || getSite(siteName) == null) - { - return false; - } - return siteNames.add(siteName); + siteNames.add(siteName); } - return false; - }}, maxResults); + } + } + if (siteNames.isEmpty()) { return Collections.emptyList();