From 166569a02834ddb15cc092a8eadc8c4a7b959e69 Mon Sep 17 00:00:00 2001 From: Davide Negretti Date: Mon, 12 Sep 2022 20:25:25 +0200 Subject: [PATCH] [CST-6317] New COLLECTIONS rendering --- .../src/main/java/org/dspace/layout/CrisLayoutBoxTypes.java | 3 ++- .../layout/service/impl/CrisLayoutBoxServiceImpl.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dspace-api/src/main/java/org/dspace/layout/CrisLayoutBoxTypes.java b/dspace-api/src/main/java/org/dspace/layout/CrisLayoutBoxTypes.java index ad4be3ddc8b5..198d00636431 100644 --- a/dspace-api/src/main/java/org/dspace/layout/CrisLayoutBoxTypes.java +++ b/dspace-api/src/main/java/org/dspace/layout/CrisLayoutBoxTypes.java @@ -11,5 +11,6 @@ public enum CrisLayoutBoxTypes { IIIFVIEWER, METADATA, RELATION, - METRICS + METRICS, + COLLECTIONS } diff --git a/dspace-api/src/main/java/org/dspace/layout/service/impl/CrisLayoutBoxServiceImpl.java b/dspace-api/src/main/java/org/dspace/layout/service/impl/CrisLayoutBoxServiceImpl.java index a1bc95b818c3..269dd6601853 100644 --- a/dspace-api/src/main/java/org/dspace/layout/service/impl/CrisLayoutBoxServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/layout/service/impl/CrisLayoutBoxServiceImpl.java @@ -159,6 +159,8 @@ public boolean hasContent(Context context, CrisLayoutBox box, Item item) { return hasRelationBoxContent(context, box, item); case "METRICS": return hasMetricsBoxContent(context, box, item); + case "COLLECTIONS": + return isOwningCollectionPresent(item); case "IIIFVIEWER": return isIiifEnabled(item); case "METADATA": @@ -246,6 +248,10 @@ private boolean isIiifEnabled(Item item) { new MetadataFieldName("dspace.iiif.enabled"), Item.ANY)); } + private boolean isOwningCollectionPresent(Item item) { + return Objects.nonNull(item.getOwningCollection()); + } + private boolean currentUserIsNotAllowedToReadItem(Context context, Item item) { try { return !authorizeService.authorizeActionBoolean(context, item, Constants.READ);