mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed ALF-9591: Integrity check: Association source multiplicity checking is incorrect
- Drop checks for source multiplicity when no associations are pointing to a type/aspect instance git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31018 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -169,13 +169,11 @@ public class AssocSourceMultiplicityIntegrityEvent extends AbstractIntegrityEven
|
||||
{
|
||||
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;
|
||||
}
|
||||
// ALF-9591: Integrity check: Association source multiplicity checking is incorrect
|
||||
// At this point, there is no point worrying. There are no more associations
|
||||
// pointing *to* this node and therefore the checking of the source
|
||||
// multiplicity (a feature of the source type/aspect) is not relevant
|
||||
return;
|
||||
}
|
||||
|
||||
String parentOrSourceStr = (assocDef.isChild() ? "parent" : "source");
|
||||
|
@@ -448,4 +448,28 @@ public class IntegrityTest extends TestCase
|
||||
|
||||
checkIntegrityExpectFailure("Failed to detect excess source cardinality for one-to-many assocs", 1);
|
||||
}
|
||||
|
||||
public void testSourceAssocAfterDeletion() throws Exception
|
||||
{
|
||||
NodeRef source1 = createNode("abc", TEST_TYPE_WITH_ASSOCS, null);
|
||||
NodeRef source2 = createNode("abc", TEST_TYPE_WITH_ASSOCS, null);
|
||||
NodeRef target1 = createNode("target1", TEST_TYPE_WITHOUT_ANYTHING, null);
|
||||
NodeRef target2 = createNode("target1", TEST_TYPE_WITHOUT_ANYTHING, null);
|
||||
nodeService.createAssociation(source1, target1, TEST_ASSOC_NODE_ONE_ONE);
|
||||
nodeService.createAssociation(source2, target2, TEST_ASSOC_NODE_ONE_ONE);
|
||||
checkIntegrityNoFailure();
|
||||
|
||||
nodeService.createAssociation(source1, target1, TEST_ASSOC_NODE_ONE_MANY);
|
||||
nodeService.createAssociation(source2, target1, TEST_ASSOC_NODE_ONE_MANY);
|
||||
// Both (or either of) the associations are in violation
|
||||
checkIntegrityExpectFailure("Failed to detect excess source cardinality for one-to-many assocs", 1);
|
||||
|
||||
// Now remove one of the associations
|
||||
nodeService.removeAssociation(source2, target1, TEST_ASSOC_NODE_ONE_MANY);
|
||||
checkIntegrityNoFailure();
|
||||
|
||||
// Now remove the last association
|
||||
nodeService.removeAssociation(source1, target1, TEST_ASSOC_NODE_ONE_MANY);
|
||||
checkIntegrityNoFailure();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user