Skip to content

Commit

Permalink
Cannot create a new version because an owningcollection is null (#731)
Browse files Browse the repository at this point in the history
* control if owning collection is null
  • Loading branch information
Paurikova2 authored Sep 2, 2024
1 parent d56362f commit 6a1d7aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ public static Metadata retrieveMetadata(Context context, Item item) {
if (restricted) {
other.getField().add(createValue("restrictedAccess", "true"));
}
other.getField().add(createValue("owningCollection", item.getOwningCollection().getName()));
// Because we reindex Solr, which is not done in vanilla
// The owning collection for workspace items is null
other.getField().add(createValue("owningCollection",
item.getOwningCollection() != null ? item.getOwningCollection().getName() : null));
other.getField().add(createValue("itemId", item.getID().toString()));
metadata.getElement().add(other);

Expand Down

0 comments on commit 6a1d7aa

Please sign in to comment.