mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 22:43:12 +00:00
Entities performance improvement in RelationshipServiceImpl
If there's no max on the relationships, don't bother trying to verify whether the max would be exceeded Don't get virtual metadata for retrieving the relationship type
This commit is contained in:
@@ -244,6 +244,10 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
Integer maxCardinality,
|
||||
RelationshipType relationshipType,
|
||||
boolean isLeft) throws SQLException {
|
||||
if (maxCardinality == null) {
|
||||
//no need to check the relationships
|
||||
return true;
|
||||
}
|
||||
List<Relationship> rightRelationships = findByItemAndRelationshipType(context, itemToProcess, relationshipType,
|
||||
isLeft);
|
||||
if (maxCardinality != null && rightRelationships.size() >= maxCardinality) {
|
||||
@@ -253,7 +257,8 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
}
|
||||
|
||||
private boolean verifyEntityTypes(Item itemToProcess, EntityType entityTypeToProcess) {
|
||||
List<MetadataValue> list = itemService.getMetadata(itemToProcess, "relationship", "type", null, Item.ANY);
|
||||
List<MetadataValue> list = itemService.getMetadata(itemToProcess, "relationship", "type",
|
||||
null, Item.ANY, false);
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user