diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml index 34396a9a69..cc93252202 100644 --- a/config/alfresco/core-services-context.xml +++ b/config/alfresco/core-services-context.xml @@ -22,6 +22,8 @@ classpath:alfresco/repository.properties classpath:alfresco/domain/transaction.properties + + classpath*:alfresco/module/*/alfresco-global.properties classpath*:alfresco-global.properties diff --git a/config/alfresco/model/contentModel.xml b/config/alfresco/model/contentModel.xml index 49bf9dbffc..c77f28a7a3 100644 --- a/config/alfresco/model/contentModel.xml +++ b/config/alfresco/model/contentModel.xml @@ -792,6 +792,8 @@ Working Copy + + false d:text diff --git a/config/alfresco/model/systemModel.xml b/config/alfresco/model/systemModel.xml index aba1b51b9b..3e8b6b89d6 100644 --- a/config/alfresco/model/systemModel.xml +++ b/config/alfresco/model/systemModel.xml @@ -143,6 +143,8 @@ Temporary + + false diff --git a/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java b/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java index 1996e43c04..712eae4a05 100644 --- a/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java +++ b/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java @@ -312,7 +312,7 @@ import org.alfresco.service.namespace.QName; if (parentClass != null && archive == null) { // archive not explicitly set on this class and there is a parent class - inheritedArchive = ((M2ClassDefinition)parentClass).isArchive(); + inheritedArchive = ((M2ClassDefinition)parentClass).getArchive(); } } @@ -375,23 +375,17 @@ import org.alfresco.service.namespace.QName; } /** - * @return Returns the archive flag, which defaults to false + * @return Returns the archive flag, which defaults to true for aspects and false for other classes */ public boolean isArchive() { - if (archive == null) - { - if (inheritedArchive != null) - { - return inheritedArchive.booleanValue(); - } - else - { - // default to false - return false; - } - } - return archive; + Boolean isArchive = getArchive(); + return isArchive == null ? isAspect() : isArchive.booleanValue(); + } + + protected Boolean getArchive() + { + return archive == null ? inheritedArchive : archive; } /* (non-Javadoc) diff --git a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java index d3123d4534..1b7aa16dfa 100644 --- a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java +++ b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java @@ -93,8 +93,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl private static Log loggerPaths = LogFactory.getLog(DbNodeServiceImpl.class.getName() + ".paths"); private NodeDaoService nodeDaoService; - /** A set of aspects, the presence of which indicate that nodes must not be archived */ - private Set ignoreArchiveAspects; private StoreArchiveMap storeArchiveMap; private NodeService avmNodeService; private NodeIndexer nodeIndexer; @@ -745,24 +743,35 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl Set nodeAspectQNames = nodeDaoService.getNodeAspects(nodeId); // check if we need to archive the node - StoreRef archiveStoreRef = null; - if (nodeAspectQNames.contains(ContentModel.ASPECT_TEMPORARY) || - nodeAspectQNames.contains(ContentModel.ASPECT_WORKING_COPY)) + StoreRef storeRef = nodeRef.getStoreRef(); + StoreRef archiveStoreRef = storeArchiveMap.get(storeRef); + + if (archiveStoreRef == null) { - // The node is either temporary or a working copy. - // It can not be archived. - requiresDelete = true; + requiresDelete = true; } else { - StoreRef storeRef = nodeRef.getStoreRef(); - archiveStoreRef = storeArchiveMap.get(storeRef); - // get the type and check if we need archiving - TypeDefinition typeDef = dictionaryService.getType(nodeTypeQName); - if (typeDef == null || !typeDef.isArchive() || archiveStoreRef == null) - { - requiresDelete = true; - } + // get the type and check if we need archiving. + TypeDefinition typeDef = dictionaryService.getType(nodeTypeQName); + if (typeDef == null || !typeDef.isArchive()) + { + requiresDelete = true; + } + else + { + // If the type wants archiving, check whether any applied aspects have explicitly turned off the + // archive flag + for (QName nodeAspectQName : nodeAspectQNames) + { + typeDef = dictionaryService.getType(nodeAspectQName); + if (typeDef != null && !typeDef.isArchive()) + { + requiresDelete = true; + break; + } + } + } } if (requiresDelete)