Adding support for max cardinality

Fixing test_placeRecalculationAfterDelete (WIP)
This commit is contained in:
Ben Bosman
2022-04-19 14:34:23 +02:00
parent 40b8f63ca7
commit 753350958c
2 changed files with 483 additions and 503 deletions

View File

@@ -526,15 +526,19 @@ public class RelationshipServiceImpl implements RelationshipService {
logRelationshipTypeDetailsForError(relationshipType);
return false;
}
if (!verifyMaxCardinality(context, relationship.getLeftItem(),
if (!relationship.getLatestVersionStatus().equals(LatestVersionStatus.RIGHT_ONLY)
&& !verifyMaxCardinality(context, relationship.getLeftItem(),
relationshipType.getLeftMaxCardinality(), relationshipType, true)) {
//If RIGHT_ONLY => it's a copied relationship, and the count can be ignored
log.warn("The relationship has been deemed invalid since the left item has more" +
" relationships than the left max cardinality allows after we'd store this relationship");
logRelationshipTypeDetailsForError(relationshipType);
return false;
}
if (!verifyMaxCardinality(context, relationship.getRightItem(),
if (!relationship.getLatestVersionStatus().equals(LatestVersionStatus.LEFT_ONLY)
&& !verifyMaxCardinality(context, relationship.getRightItem(),
relationshipType.getRightMaxCardinality(), relationshipType, false)) {
//If LEFT_ONLY => it's a copied relationship, and the count can be ignored
log.warn("The relationship has been deemed invalid since the right item has more" +
" relationships than the right max cardinality allows after we'd store this relationship");
logRelationshipTypeDetailsForError(relationshipType);