Added double-checks for associations when a potential failure is detected

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28974 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-07-13 11:44:57 +00:00
parent f12b5edafa
commit 17a5ae11ff
6 changed files with 93 additions and 7 deletions

View File

@@ -167,6 +167,17 @@ public class AssocSourceMultiplicityIntegrityEvent extends AbstractIntegrityEven
if ((mandatory && actualSize == 0) || (!allowMany && actualSize > 1))
{
if (actualSize == 0)
{
// Double check that the association source is still present
ClassDefinition classDef = assocDef.getTargetClass();
if (classDef.isAspect() && !nodeService.hasAspect(targetNodeRef, classDef.getName()))
{
// The target is an aspect but the aspect is not present
return;
}
}
String parentOrSourceStr = (assocDef.isChild() ? "parent" : "source");
IntegrityRecord result = new IntegrityRecord(
"The association " + parentOrSourceStr + " multiplicity has been violated: \n" +