Merged V3.1 to HEAD

13270: Additional items from CHK-6464 as pointed out by Will.
   13271: SiteService Build fix.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13592 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-03-12 11:37:15 +00:00
parent 748a5315f4
commit 5b098b6f10

View File

@@ -770,18 +770,28 @@ public class SiteServiceImpl implements SiteService, SiteModel
{
final String cacheKey = this.tenantAdminService.getCurrentUserDomain() + '_' + shortName;
NodeRef siteNodeRef = this.siteNodeRefs.get(cacheKey);
if (siteNodeRef == null)
if (siteNodeRef != null)
{
NodeRef siteRoot = getSiteParent(shortName);
// the site "short name" directly maps to the cm:name property
siteNodeRef = this.nodeService.getChildByName(siteRoot, ContentModel.ASSOC_CONTAINS, shortName);
// cache the result if found - null results will be requeried to ensure new sites are found later
if (siteNodeRef != null)
{
this.siteNodeRefs.put(cacheKey, siteNodeRef);
}
// test for existance - and remove from cache if no longer exists
if (!this.nodeService.exists(siteNodeRef))
{
this.siteNodeRefs.remove(cacheKey);
siteNodeRef = null;
}
}
else
{
// not in cache - find and store
NodeRef siteRoot = getSiteParent(shortName);
// the site "short name" directly maps to the cm:name property
siteNodeRef = this.nodeService.getChildByName(siteRoot, ContentModel.ASSOC_CONTAINS, shortName);
// cache the result if found - null results will be requeried to ensure new sites are found later
if (siteNodeRef != null)
{
this.siteNodeRefs.put(cacheKey, siteNodeRef);
}
}
return siteNodeRef;
}