mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
91561: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 91503: Fix for MNT-12875 - Tags list in Repository view does not work when overridden repository root node using xpath syntax is used. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94808 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -64,10 +64,12 @@ public class Repository implements ApplicationContextAware
|
||||
// company home
|
||||
private StoreRef companyHomeStore; // ie. workspace://SpaceStore
|
||||
private String companyHomePath; // ie. /app:company_home
|
||||
private String sharedHomePath; // ie. /app:shared
|
||||
|
||||
// note: cache is tenant-aware (if using EhCacheAdapter shared cache)
|
||||
private SimpleCache<String, NodeRef> singletonCache; // eg. for companyHomeNodeRef
|
||||
private final String KEY_COMPANYHOME_NODEREF = "key.companyhome.noderef";
|
||||
private final String KEY_SHAREDHOME_NODEREF = "key.sharedhome.noderef";
|
||||
|
||||
|
||||
/**
|
||||
@@ -90,6 +92,16 @@ public class Repository implements ApplicationContextAware
|
||||
this.companyHomePath = companyHomePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Shared Home Path
|
||||
*
|
||||
* @param sharedHomePath
|
||||
*/
|
||||
public void setSharedHomePath(String sharedHomePath)
|
||||
{
|
||||
this.sharedHomePath = sharedHomePath;
|
||||
}
|
||||
|
||||
public void setSingletonCache(SimpleCache<String, NodeRef> singletonCache)
|
||||
{
|
||||
this.singletonCache = singletonCache;
|
||||
@@ -212,17 +224,51 @@ public class Repository implements ApplicationContextAware
|
||||
if (refs.size() != 1)
|
||||
{
|
||||
throw new IllegalStateException("Invalid company home path: " + companyHomePath + " - found: " + refs.size());
|
||||
}
|
||||
return refs.get(0);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
return refs.get(0);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
singletonCache.put(KEY_COMPANYHOME_NODEREF, companyHomeRef);
|
||||
}
|
||||
return companyHomeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Shared Home. Note this is tenant-aware if the correct Cache is supplied.
|
||||
*
|
||||
* @return shared home node ref
|
||||
*/
|
||||
public NodeRef getSharedHome()
|
||||
{
|
||||
NodeRef sharedHomeRef = singletonCache.get(KEY_SHAREDHOME_NODEREF);
|
||||
if (sharedHomeRef == null)
|
||||
{
|
||||
sharedHomeRef = AuthenticationUtil.runAs(new RunAsWork<NodeRef>()
|
||||
{
|
||||
public NodeRef doWork() throws Exception
|
||||
{
|
||||
return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef execute() throws Exception
|
||||
{
|
||||
List<NodeRef> refs = searchService.selectNodes(nodeService.getRootNode(companyHomeStore), sharedHomePath, null, namespaceService, false);
|
||||
if (refs.size() != 1)
|
||||
{
|
||||
throw new IllegalStateException("Invalid shared home path: " + sharedHomePath + " - found: " + refs.size());
|
||||
}
|
||||
return refs.get(0);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
singletonCache.put(KEY_SHAREDHOME_NODEREF, sharedHomeRef);
|
||||
}
|
||||
return sharedHomeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the currently authenticated person
|
||||
|
Reference in New Issue
Block a user