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

View File

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