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

77202: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud)
      74762: ACE-955 "Custom Content Models in Cloud"
      Fix Enterprise build tests, some tidy up


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78058 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-23 16:29:07 +00:00
parent eb471ae410
commit c0224dacca
2 changed files with 28 additions and 42 deletions

View File

@@ -36,6 +36,8 @@ import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.repo.transaction.TransactionListenerAdapter;
@@ -463,8 +465,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
for (NodeRef nodeRef : pendingModels)
{
String tenantDomain = tenantService.getDomain(nodeRef.getStoreRef().getIdentifier());
String tenantSystemUserName = tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain);
systemTenants.add(tenantSystemUserName);
systemTenants.add(tenantDomain);
}
}
@@ -476,37 +477,34 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
for (NodeRef nodeRef : pendingDeleteModels)
{
String tenantDomain = tenantService.getDomain(nodeRef.getStoreRef().getIdentifier());
String tenantSystemUserName = tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain);
systemTenants.add(tenantSystemUserName);
systemTenants.add(tenantDomain);
}
}
if (systemTenants.size() > 0)
{
for (final String tenantSystemUserName : systemTenants)
for (final String tenantName : systemTenants)
{
RetryingTransactionCallback<Void> work = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
AuthenticationUtil.runAs(new RunAsWork<Object>()
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>()
{
public Void doWork()
{
// invalidate - to force lazy re-init
// note: since afterCommit - need to either clear shared cache or destroy in separate txn
dictionaryDAO.destroy();
if (logger.isTraceEnabled())
{
public Object doWork()
{
// invalidate - to force lazy re-init
// note: since afterCommit - need to either clear shared cache or destroy in separate txn
dictionaryDAO.destroy();
logger.trace("afterCommit: Dictionary destroyed ["+AlfrescoTransactionSupport.getTransactionId()+"]");
}
if (logger.isTraceEnabled())
{
logger.trace("afterCommit: Dictionary destroyed ["+AlfrescoTransactionSupport.getTransactionId()+"]");
}
return null;
}
}, tenantSystemUserName);
return null;
return null;
}
}, tenantName);
}
};

View File

@@ -66,25 +66,13 @@ public class DynamicCreateRepositoryLocation extends RepositoryLocation
public void checkAndCreate(NodeRef rootNodeRef)
{
// try
// {
// String[] pathElements = getPathElements();
List<NodeRef> nodes = searchService.selectNodes(rootNodeRef, getPath(), null, namespaceService, false);
if(nodes.size() == 0)
{
logger.info("Repository location " + getPath() + " does not exist for tenant "
+ TenantUtil.getCurrentDomain() + ", creating");
create();
}
// fileFolderService.resolveNamePath(rootNodeRef, Arrays.asList(pathElements));
// }
// catch(FileNotFoundException e)
// {
// logger.info("Repository location " + getPath() + " does not exist for tenant "
// + TenantUtil.getCurrentDomain() + ", creating");
// create();
// }
List<NodeRef> nodes = searchService.selectNodes(rootNodeRef, getPath(), null, namespaceService, false);
if(nodes.size() == 0)
{
logger.info("Repository location " + getPath() + " does not exist for tenant "
+ TenantUtil.getCurrentDomain() + ", creating");
create();
}
}
protected String getParentPath()