Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

98900: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      98891: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         98889: Reverse merged V4.1-BUG-FIX (4.1.10)
            << Caused a performance problem found in 5.0.1 testing >>
            Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.5)
               93762: Fix for     MNT-13198    BM-0012: Run v420b1494_01: (CMIS) GetSites is Slow 
               - use the bridge table to list sites.
               93802: Fix for     MNT-13198    BM-0012: Run v420b1494_01: (CMIS) GetSites is Slow 
               - use hasSite to check for existence and fix person lookup case sensitivity configuration


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@98956 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-03-06 22:37:09 +00:00
parent 0c51454940
commit a330f85a38

View File

@@ -1210,26 +1210,22 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
{
final int maxResults = size > 0 ? size : 1000;
final Set<String> siteNames = new TreeSet<String>();
// MNT-13198 - use the bridge table
String actualUserName = personService.getUserIdentifier(userName);
if(actualUserName != null)
{
Set<String> containingAuthorities = authorityService.getContainingAuthorities(AuthorityType.GROUP, actualUserName, false);
for(String authority : containingAuthorities)
authorityService.getContainingAuthoritiesInZone(AuthorityType.GROUP, userName, AuthorityService.ZONE_APP_SHARE, new AuthorityFilter(){
@Override
public boolean includeAuthority(String authority)
{
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) && hasSite(siteName))
if (siteName == null || getSite(siteName) == null)
{
siteNames.add(siteName);
return false;
}
return siteNames.add(siteName);
}
}
}
return false;
}}, maxResults);
if (siteNames.isEmpty())
{
return Collections.emptyList();