mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
91390: Revert changes to interface RelationshipMetadataService
This commit is contained in:
@@ -49,7 +49,7 @@ public interface RelationshipMetadataService {
|
||||
* @return The list of virtual metadata values
|
||||
*/
|
||||
public List<RelationshipMetadataValue> findRelationshipMetadataValueForItemRelationship(
|
||||
Context context, Item item, EntityType entityType, Relationship relationship, boolean enableVirtualMetadata)
|
||||
Context context, Item item, String entityType, Relationship relationship, boolean enableVirtualMetadata)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
|
@@ -76,7 +76,7 @@ public class RelationshipMetadataServiceImpl implements RelationshipMetadataServ
|
||||
List<Relationship> relationships = relationshipService.findByItem(context, item, -1, -1, true);
|
||||
for (Relationship relationship : relationships) {
|
||||
fullMetadataValueList
|
||||
.addAll(findRelationshipMetadataValueForItemRelationship(context, item, entityType,
|
||||
.addAll(findRelationshipMetadataValueForItemRelationship(context, item, entityType.getLabel(),
|
||||
relationship, enableVirtualMetadata));
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class RelationshipMetadataServiceImpl implements RelationshipMetadataServ
|
||||
|
||||
@Override
|
||||
public List<RelationshipMetadataValue> findRelationshipMetadataValueForItemRelationship(
|
||||
Context context, Item item, EntityType entityType, Relationship relationship, boolean enableVirtualMetadata)
|
||||
Context context, Item item, String entityType, Relationship relationship, boolean enableVirtualMetadata)
|
||||
throws SQLException {
|
||||
List<RelationshipMetadataValue> resultingMetadataValueList = new LinkedList<>();
|
||||
RelationshipType relationshipType = relationship.getRelationshipType();
|
||||
@@ -199,7 +199,7 @@ public class RelationshipMetadataServiceImpl implements RelationshipMetadataServ
|
||||
Item otherItem;
|
||||
int place = 0;
|
||||
boolean isLeftwards;
|
||||
if (relationshipType.getLeftType().equals(entityType) &&
|
||||
if (StringUtils.equals(relationshipType.getLeftType().getLabel(), entityType) &&
|
||||
item.getID().equals(relationship.getLeftItem().getID())) {
|
||||
hashMaps = virtualMetadataPopulator.getMap().get(relationshipType.getLeftwardType());
|
||||
otherItem = relationship.getRightItem();
|
||||
@@ -207,7 +207,7 @@ public class RelationshipMetadataServiceImpl implements RelationshipMetadataServ
|
||||
place = relationship.getLeftPlace();
|
||||
isLeftwards = false; //if the current item is stored on the left,
|
||||
// the name variant is retrieved from the rightwards label
|
||||
} else if (relationshipType.getRightType().equals(entityType) &&
|
||||
} else if (StringUtils.equals(relationshipType.getRightType().getLabel(), entityType) &&
|
||||
item.getID().equals(relationship.getRightItem().getID())) {
|
||||
hashMaps = virtualMetadataPopulator.getMap().get(relationshipType.getRightwardType());
|
||||
otherItem = relationship.getLeftItem();
|
||||
|
@@ -865,11 +865,11 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
boolean copyToRightItem)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (copyToLeftItem) {
|
||||
EntityType entityType = relationshipMetadataService
|
||||
.getEntityTypeFromMetadata(context, relationship.getLeftItem());
|
||||
String entityTypeString = relationshipMetadataService
|
||||
.getEntityTypeStringFromMetadata(relationship.getLeftItem());
|
||||
List<RelationshipMetadataValue> relationshipMetadataValues =
|
||||
relationshipMetadataService.findRelationshipMetadataValueForItemRelationship(context,
|
||||
relationship.getLeftItem(), entityType, relationship, true);
|
||||
relationship.getLeftItem(), entityTypeString, relationship, true);
|
||||
for (RelationshipMetadataValue relationshipMetadataValue : relationshipMetadataValues) {
|
||||
// This adds the plain text metadata values on the same spot as the virtual values.
|
||||
// This will be overruled in org.dspace.content.DSpaceObjectServiceImpl.update
|
||||
@@ -892,11 +892,11 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
itemService.update(context, relationship.getLeftItem());
|
||||
}
|
||||
if (copyToRightItem) {
|
||||
EntityType entityType = relationshipMetadataService
|
||||
.getEntityTypeFromMetadata(context, relationship.getRightItem());
|
||||
String entityTypeString = relationshipMetadataService
|
||||
.getEntityTypeStringFromMetadata(relationship.getRightItem());
|
||||
List<RelationshipMetadataValue> relationshipMetadataValues =
|
||||
relationshipMetadataService.findRelationshipMetadataValueForItemRelationship(context,
|
||||
relationship.getRightItem(), entityType, relationship, true);
|
||||
relationship.getRightItem(), entityTypeString, relationship, true);
|
||||
for (RelationshipMetadataValue relationshipMetadataValue : relationshipMetadataValues) {
|
||||
itemService.addMetadata(context, relationship.getRightItem(),
|
||||
relationshipMetadataValue.getMetadataField().
|
||||
|
Reference in New Issue
Block a user