Fix PatchMetadataIT failures by ensuring MetadataValue place is updated for virtual fields as well. Also minor code cleanup in PatchMetadataIT.

This commit is contained in:
Tim Donohue
2024-03-27 14:38:35 -05:00
parent befef7f7b1
commit 66402b2d62
2 changed files with 19 additions and 17 deletions

View File

@@ -97,7 +97,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
/**
* log4j category
*/
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Item.class);
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
@Autowired(required = true)
protected ItemDAO itemDAO;
@@ -1742,6 +1742,8 @@ prevent the generation of resource policy entry values with null dspace_object a
*/
@Override
protected void moveSingleMetadataValue(Context context, Item dso, int place, MetadataValue rr) {
// If this is a (virtual) metadata value representing a relationship,
// then we must also update the corresponding Relationship with the new place
if (rr instanceof RelationshipMetadataValue) {
try {
//Retrieve the applicable relationship
@@ -1757,10 +1759,10 @@ prevent the generation of resource policy entry values with null dspace_object a
//should not occur, otherwise metadata can't be updated either
log.error("An error occurred while moving " + rr.getAuthority() + " for item " + dso.getID(), e);
}
} else {
//just move the metadata
rr.setPlace(place);
}
// Update the MetadataValue object with the new place setting
rr.setPlace(place);
}
@Override