Skip to content

Commit

Permalink
Changed com/col prefix in the comcolfilter (#684)
Browse files Browse the repository at this point in the history
* User community or collection handle `com_/col_` instead of v5 prefix `hdl_` because it cannot match handle of the community which should not be exposed.

* Throw error when the dso object is not Community or Collection in the ColComFilter.java.
  • Loading branch information
milanmajchrak committed Jul 8, 2024
1 parent 7168a7c commit b6cd923
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,19 @@ public boolean isShown(DSpaceItem item) {
}

private String getSetSpec() {
return "hdl_" + dso.getHandle().replace("/", "_");
// Set prefix for the community as default value.
String handlePrefix;
if (dso instanceof Collection) {
// Prefix for the Collection.
handlePrefix = "col_";
} else if (dso instanceof Community) {
handlePrefix = "com_";
} else {
String message = "The DSO object must be of type Community or Collection.";
log.error(message);
throw new RuntimeException(message);
}
return handlePrefix + dso.getHandle().replace("/", "_");
}

private DSpaceObject getDSpaceObject() {
Expand Down

0 comments on commit b6cd923

Please sign in to comment.