MOB-1073: Fix build. Use dictionaryService.getAspect() rather than dictionaryService.getType() to look up aspects

- Also improved Boolean logic so that it's possible to switch on archiving via an aspect (as suggested by Derek)
- M2ClassDefinition.getArchive() now returns true, false or null
- false takes precedence and is the ultimate default
- fixed JIBX classpath


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16022 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-09-01 16:10:49 +00:00
parent a949dcad97
commit 415c90c971
5 changed files with 50 additions and 38 deletions

View File

@@ -730,11 +730,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
Pair<Long, NodeRef> 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<Long, ChildAssociationRef> 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<QName> 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)