Merged V2.0 to HEAD

5116: AWC-1067, AWC-1126
   5121: AR-1233 (from 1.4 via 2.0)
   5129: AR-966
   5131: Overlay copy and duplicate name


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5323 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-03-07 09:50:10 +00:00
parent bf9a4976e7
commit 80ce950335
5 changed files with 114 additions and 2 deletions

View File

@@ -605,7 +605,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
// remove the aspect, if present
boolean removed = node.getAspects().remove(aspectTypeQName);
// if the aspect was present, remove the associated properties
// if the aspect was present, remove the associated properties and associations
if (removed)
{
Map<QName, PropertyValue> nodeProperties = node.getProperties();
@@ -615,6 +615,36 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
nodeProperties.remove(propertyName);
}
// Remove child associations
Map<QName, ChildAssociationDefinition> childAssocDefs = aspectDef.getChildAssociations();
Collection<ChildAssoc> childAssocs = nodeDaoService.getChildAssocs(node);
for (ChildAssoc childAssoc : childAssocs)
{
// Ignore if the association type is not defined by the aspect
QName childAssocQName = childAssoc.getTypeQName();
if (!childAssocDefs.containsKey(childAssocQName))
{
continue;
}
// The association is of a type that should be removed
nodeDaoService.deleteChildAssoc(childAssoc, true);
}
// Remove regular associations
Map<QName, AssociationDefinition> assocDefs = aspectDef.getAssociations();
List<NodeAssoc> nodeAssocs = nodeDaoService.getTargetNodeAssocs(node);
for (NodeAssoc nodeAssoc : nodeAssocs)
{
// Ignore if the association type is not defined by the aspect
QName nodeAssocQName = nodeAssoc.getTypeQName();
if (!assocDefs.containsKey(nodeAssocQName))
{
continue;
}
// Delete the association
nodeDaoService.deleteNodeAssoc(nodeAssoc);
}
// Invoke policy behaviours
invokeOnUpdateNode(nodeRef);
invokeOnRemoveAspect(nodeRef, aspectTypeQName);