diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryDAOTest.java b/source/java/org/alfresco/repo/dictionary/DictionaryDAOTest.java
index 6e33c92d25..39a18f415a 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryDAOTest.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryDAOTest.java
@@ -307,20 +307,20 @@ public class DictionaryDAOTest extends TestCase
{
QName testFileQName = QName.createQName(TEST_URL, "file");
ClassDefinition fileClassDef = service.getClass(testFileQName);
- assertTrue("File type should have the archive flag", fileClassDef.isArchive());
+ assertTrue("File type should have the archive flag", fileClassDef.getArchive());
QName testFileDerivedQName = QName.createQName(TEST_URL, "file-derived");
ClassDefinition fileDerivedClassDef = service.getClass(testFileDerivedQName);
- assertTrue("Direct derived File type should have the archive flag", fileDerivedClassDef.isArchive());
+ assertTrue("Direct derived File type should have the archive flag", fileDerivedClassDef.getArchive());
QName testFileDerivedNoArchiveQName = QName.createQName(TEST_URL, "file-derived-no-archive");
ClassDefinition fileDerivedNoArchiveClassDef = service.getClass(testFileDerivedNoArchiveQName);
assertFalse("Derived File with archive override type should NOT have the archive flag",
- fileDerivedNoArchiveClassDef.isArchive());
+ fileDerivedNoArchiveClassDef.getArchive());
QName testFolderQName = QName.createQName(TEST_URL, "folder");
ClassDefinition folderClassDef = service.getClass(testFolderQName);
- assertFalse("Folder type should not have the archive flag", folderClassDef.isArchive());
+ assertNull("Folder type should not have the archive flag", folderClassDef.getArchive());
}
public void testMandatoryEnforced()
diff --git a/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java b/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java
index 65c2d277f2..1b52eccbc8 100644
--- a/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java
+++ b/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java
@@ -154,9 +154,9 @@ import org.alfresco.service.namespace.QName;
return type.isAspect();
}
- public boolean isArchive()
+ public Boolean getArchive()
{
- return type.isArchive();
+ return type.getArchive();
}
/* (non-Javadoc)
diff --git a/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java b/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java
index 712eae4a05..957e2c6245 100644
--- a/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java
+++ b/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2007 Alfresco Software Limited.
+ * Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,7 +18,7 @@
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
- * FLOSS exception. You should have recieved a copy of the text describing
+ * FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
@@ -374,16 +374,10 @@ import org.alfresco.service.namespace.QName;
return (m2Class instanceof M2Aspect);
}
- /**
- * @return Returns the archive flag, which defaults to true for aspects and false for other classes
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.dictionary.ClassDefinition#getArchive()
*/
- public boolean isArchive()
- {
- Boolean isArchive = getArchive();
- return isArchive == null ? isAspect() : isArchive.booleanValue();
- }
-
- protected Boolean getArchive()
+ public Boolean getArchive()
{
return archive == null ? inheritedArchive : archive;
}
@@ -597,9 +591,20 @@ import org.alfresco.service.namespace.QName;
}
// check archive/inheritedArchive
- if (isArchive() != classDef.isArchive())
+ if (archive == null)
{
- isUpdatedIncrementally = true;
+ if (classDef.getArchive() != null)
+ {
+ isUpdatedIncrementally = true;
+ }
+ }
+ else
+ {
+ Boolean classArchive = classDef.getArchive();
+ if (classArchive == null || classArchive.booleanValue() != archive.booleanValue())
+ {
+ isUpdatedIncrementally = true;
+ }
}
String modelDiffType;
diff --git a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java
index 1b7aa16dfa..d173c13820 100644
--- a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java
+++ b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java
@@ -730,11 +730,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
Pair nodePair = getNodePairNotNull(nodeRef);
Long nodeId = nodePair.getFirst();
- boolean requiresDelete = false;
-
+ Boolean requiresDelete = null;
+
// Invoke policy behaviours
invokeBeforeDeleteNode(nodeRef);
-
+
// get the primary parent-child relationship before it is gone
Pair childAssocPair = nodeDaoService.getPrimaryParentAssoc(nodeId);
ChildAssociationRef childAssocRef = childAssocPair.getSecond();
@@ -754,27 +754,33 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{
// get the type and check if we need archiving.
TypeDefinition typeDef = dictionaryService.getType(nodeTypeQName);
- if (typeDef == null || !typeDef.isArchive())
+ if (typeDef != null)
{
- requiresDelete = true;
- }
- else
- {
- // If the type wants archiving, check whether any applied aspects have explicitly turned off the
- // archive flag
- for (QName nodeAspectQName : nodeAspectQNames)
+ Boolean requiresArchive = typeDef.getArchive();
+ if (requiresArchive != null)
{
- typeDef = dictionaryService.getType(nodeAspectQName);
- if (typeDef != null && !typeDef.isArchive())
+ requiresDelete = !requiresArchive;
+ }
+ }
+
+ // If the type hasn't asked for deletion, check whether any applied aspects have
+ Iterator i = nodeAspectQNames.iterator();
+ while ((requiresDelete == null || !requiresDelete) && i.hasNext())
+ {
+ QName nodeAspectQName = i.next();
+ AspectDefinition aspectDef = dictionaryService.getAspect(nodeAspectQName);
+ if (aspectDef != null)
+ {
+ Boolean requiresArchive = aspectDef.getArchive();
+ if (requiresArchive != null)
{
- requiresDelete = true;
- break;
+ requiresDelete = !requiresArchive;
}
}
}
}
-
- if (requiresDelete)
+
+ if (requiresDelete == null || requiresDelete)
{
// Cascade as required
if (cascadeInTransaction)
diff --git a/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java b/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java
index b0e2510955..8df3fae549 100644
--- a/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java
+++ b/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java
@@ -69,9 +69,10 @@ public interface ClassDefinition
public boolean isAspect();
/**
- * @return Return true if the type should be archived on delete
+ * @return Return true
if the type should be archived on delete, false
if it should be
+ * deleted or null
if not defined.
*/
- public boolean isArchive();
+ public Boolean getArchive();
/**
* @return the properties of the class, including inherited properties