diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index bf29bfdcf2..adee588308 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -713,20 +713,25 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ ${spaces.store}
+ ${spaces.archive.store}
+
+
-
-
-
diff --git a/config/alfresco/opencmis-context.xml b/config/alfresco/opencmis-context.xml
index 60eacd1421..daa6454308 100644
--- a/config/alfresco/opencmis-context.xml
+++ b/config/alfresco/opencmis-context.xml
@@ -37,22 +37,24 @@
-
+
+
-
+
+
diff --git a/config/alfresco/policy-context.xml b/config/alfresco/policy-context.xml
index 33b5328639..e3dd35c25f 100644
--- a/config/alfresco/policy-context.xml
+++ b/config/alfresco/policy-context.xml
@@ -62,20 +62,10 @@
-
-
-
-
+
-
-
-
- ${spaces.store}
- ${spaces.archive.store}
-
-
diff --git a/pom.xml b/pom.xml
index 904cc51512..57f3def2d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -928,6 +928,25 @@
+
+
+
+ org.commonjava.maven.plugins
+
+
+ directory-maven-plugin
+
+
+ [0.1,)
+
+
+ highest-basedir
+
+
+
+
+
+
diff --git a/source/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java b/source/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java
index 402fad7aa9..7f11484059 100644
--- a/source/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java
+++ b/source/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java
@@ -279,16 +279,17 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
List childrenList;
if (typeId == null)
{
- childrenList = connector.getOpenCMISDictionaryService().getBaseTypes();
+ childrenList = connector.getOpenCMISDictionaryService().getBaseTypes(true);
}
else
{
- TypeDefinitionWrapper tdw = connector.getOpenCMISDictionaryService().findType(typeId);
- if (tdw == null)
- {
- throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
- }
- childrenList = tdw.getChildren();
+ TypeDefinitionWrapper tdw = connector.getOpenCMISDictionaryService().findType(typeId);
+ if (tdw == null)
+ {
+ throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
+ }
+ childrenList = connector.getOpenCMISDictionaryService().getChildren(typeId);
+// childrenList = tdw.getChildren();
}
// create result
@@ -341,7 +342,7 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
if (typeId == null)
{
- for (TypeDefinitionWrapper tdw : connector.getOpenCMISDictionaryService().getBaseTypes())
+ for (TypeDefinitionWrapper tdw : connector.getOpenCMISDictionaryService().getBaseTypes(true))
{
result.add(getTypesDescendants(d, tdw, includePropertyDefinitions));
}
@@ -353,10 +354,10 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
{
throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
}
-
- if (tdw.getChildren() != null)
+ List children = connector.getOpenCMISDictionaryService().getChildren(typeId);
+ if(children != null)
{
- for (TypeDefinitionWrapper child : tdw.getChildren())
+ for (TypeDefinitionWrapper child : children)
{
result.add(getTypesDescendants(d, child, includePropertyDefinitions));
}
@@ -378,10 +379,12 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
if (depth != 0)
{
- if (tdw.getChildren() != null)
+ String typeId = tdw.getTypeId();
+ List children = connector.getOpenCMISDictionaryService().getChildren(typeId);
+ if (children != null)
{
result.setChildren(new ArrayList());
- for (TypeDefinitionWrapper tdc : tdw.getChildren())
+ for (TypeDefinitionWrapper tdc : children)
{
result.getChildren().add(
getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions));
diff --git a/source/java/org/alfresco/repo/admin/RepoAdminServiceImpl.java b/source/java/org/alfresco/repo/admin/RepoAdminServiceImpl.java
index 8578fffab0..6dd6b0bfa7 100644
--- a/source/java/org/alfresco/repo/admin/RepoAdminServiceImpl.java
+++ b/source/java/org/alfresco/repo/admin/RepoAdminServiceImpl.java
@@ -141,7 +141,7 @@ public class RepoAdminServiceImpl implements RepoAdminService
List modelsInRepo = new ArrayList();
- Collection models = dictionaryDAO.getModels();
+ Collection models = dictionaryDAO.getModels(true);
List dictionaryModels = new ArrayList();
for (QName model : models)
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryModelType.java b/source/java/org/alfresco/repo/dictionary/DictionaryModelType.java
index 2e45384171..4206e56063 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryModelType.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryModelType.java
@@ -21,14 +21,11 @@ package org.alfresco.repo.dictionary;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
-import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
-import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.ContentServicePolicies;
import org.alfresco.repo.lock.JobLockService;
@@ -38,34 +35,17 @@ import org.alfresco.repo.policy.JavaBehaviour;
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.Tenant;
-import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
-import org.alfresco.repo.transaction.TransactionListenerAdapter;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
+import org.alfresco.repo.transaction.TransactionListenerAdapter;
import org.alfresco.repo.version.Version2Model;
-import org.alfresco.repo.workflow.BPMEngineRegistry;
-import org.alfresco.service.cmr.dictionary.AspectDefinition;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
-import org.alfresco.service.cmr.dictionary.DictionaryException;
import org.alfresco.service.cmr.dictionary.ModelDefinition;
-import org.alfresco.service.cmr.dictionary.NamespaceDefinition;
-import org.alfresco.service.cmr.dictionary.PropertyDefinition;
-import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.repository.StoreRef;
-import org.alfresco.service.cmr.search.ResultSet;
-import org.alfresco.service.cmr.search.SearchService;
-import org.alfresco.service.cmr.workflow.WorkflowDefinition;
-import org.alfresco.service.cmr.workflow.WorkflowService;
-import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition;
-import org.alfresco.service.namespace.NamespaceException;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
@@ -116,30 +96,18 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
/** The policy component */
private PolicyComponent policyComponent;
- /** The workflow service */
- private WorkflowService workflowService;
-
- /** The search service */
- private SearchService searchService;
-
- /** The namespace service */
- private NamespaceService namespaceService;
-
/** The tenant service */
private TenantService tenantService;
- /** The tenant deployer service */
- private TenantAdminService tenantAdminService;
-
private TransactionService transactionService;
private JobLockService jobLockService;
/** Transaction listener */
private DictionaryModelTypeTransactionListener transactionListener;
-
- private List storeUrls; // stores against which model deletes should be validated
-
+
+ private ModelValidator modelValidator;
+
/** Validation marker */
private boolean doValidation = true;
@@ -150,8 +118,13 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
{
this.dictionaryDAO = dictionaryDAO;
}
-
- /**
+
+ public void setModelValidator(ModelValidator modelValidator)
+ {
+ this.modelValidator = modelValidator;
+ }
+
+ /**
* Set the namespace DOA
*/
public void setNamespaceDAO(NamespaceDAO namespaceDAO)
@@ -182,31 +155,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
{
this.policyComponent = policyComponent;
}
-
- /**
- * Set the workflow service
- */
- public void setWorkflowService(WorkflowService workflowService)
- {
- this.workflowService = workflowService;
- }
-
- /**
- * Set the search service
- */
- public void setSearchService(SearchService searchService)
- {
- this.searchService = searchService;
- }
-
- /**
- * Set the namespace service
- */
- public void setNamespaceService(NamespaceService namespaceService)
- {
- this.namespaceService = namespaceService;
- }
-
+
/**
* Set the tenant service
*/
@@ -214,15 +163,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
{
this.tenantService = tenantService;
}
-
- /**
- * Set the tenant admin service
- */
- public void setTenantAdminService(TenantAdminService tenantAdminService)
- {
- this.tenantAdminService = tenantAdminService;
- }
-
+
/**
* Set the transaction service
*/
@@ -235,12 +176,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
{
this.jobLockService = jobLockService;
}
-
- public void setStoreUrls(List storeUrls)
- {
- this.storeUrls = storeUrls;
- }
-
+
public void setDoValidation(boolean doValidation)
{
this.doValidation = doValidation;
@@ -403,7 +339,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
if (modelName != null)
{
// Validate model delete against usages - content and/or workflows
- validateModelDelete(modelName);
+ modelValidator.validateModelDelete(modelName);
Set pendingModelDeletes = (Set)AlfrescoTransactionSupport.getResource(KEY_PENDING_DELETE_MODELS);
if (pendingModelDeletes == null)
@@ -484,7 +420,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
}
}
}
-
+
/**
* Dictionary model type transaction listener class.
*/
@@ -693,10 +629,11 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
// Validate model against dictionary - could be new, unchanged or updated
if (doValidation == true)
{
- validateModel(modelDefinition.getName(), m2Model, compiledModel);
+ modelValidator.validateModel(compiledModel);
}
-
+
// invalidate - to force lazy re-init
+ // TODO
//dictionaryDAO.destroy();
if (logger.isTraceEnabled())
@@ -711,7 +648,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
if (modelName != null)
{
// Validate model delete against usages - content and/or workflows
- validateModelDelete(modelName);
+ modelValidator.validateModelDelete(modelName);
// invalidate - to force lazy re-init
//dictionaryDAO.destroy();
@@ -752,314 +689,4 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
}
}
}
-
- /**
- * validate against repository contents / workflows (e.g. when deleting an existing model)
- *
- * @param modelName
- */
- private void validateModelDelete(final QName modelName)
- {
- // TODO add model locking during delete (would need to be tenant-aware & cluster-aware) to avoid potential
- // for concurrent addition of new content/workflow as model is being deleted
-
- final Collection namespaceDefs;
- final Collection typeDefs;
- final Collection aspectDefs;
-
- try
- {
- namespaceDefs = dictionaryDAO.getNamespaces(modelName);
- typeDefs = dictionaryDAO.getTypes(modelName);
- aspectDefs = dictionaryDAO.getAspects(modelName);
- }
- catch (DictionaryException e)
- {
- if (logger.isDebugEnabled())
- {
- logger.debug("Dictionary model '" + modelName + "' does not exist ... skip delete validation : " + e);
- }
- return;
- }
-
- // TODO - in case of MT we do not currently allow deletion of an overridden model (with usages) ... but could allow if (re-)inherited model is equivalent to an incremental update only ?
- validateModelDelete(namespaceDefs, typeDefs, aspectDefs, false);
-
- if (tenantService.isEnabled() && tenantService.isTenantUser() == false)
- {
- // shared model - need to check all tenants (whether enabled or disabled) unless they have overridden
- List tenants = tenantAdminService.getAllTenants();
- for (Tenant tenant : tenants)
- {
- // validate model delete within context of tenant domain
- AuthenticationUtil.runAs(new RunAsWork