diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/DiscoverFacetsConverter.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/DiscoverFacetsConverter.java index cbbdc3e9cbec..d099c6016666 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/DiscoverFacetsConverter.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/DiscoverFacetsConverter.java @@ -83,6 +83,7 @@ public void addFacetValues(Context context, final DiscoverResult searchResult, f if (field.exposeMinAndMaxValue()) { handleExposeMinMaxValues(context, field, facetEntry); } + facetEntry.setOpenByDefault(field.isOpenByDefault()); facetEntry.setExposeMinMax(field.exposeMinAndMaxValue()); facetEntry.setFacetType(field.getType()); for (DiscoverResult.FacetResult value : CollectionUtils.emptyIfNull(facetValues)) { diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java index cc15700b924e..433e270912f3 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java @@ -28,6 +28,7 @@ public static Matcher authorFacet(boolean hasNext) { hasJsonPath("$.name", is("author")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/author")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/author")) ); @@ -40,6 +41,7 @@ public static Matcher authorFacetWithMinMax(boolean hasNext, Str hasJsonPath("$.facetLimit", any(Integer.class)), hasJsonPath("$.minValue", is(min)), hasJsonPath("$.maxValue", is(max)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/author")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/author")) ); @@ -50,6 +52,7 @@ public static Matcher subjectFacet(boolean hasNext) { hasJsonPath("$.name", is("subject")), hasJsonPath("$.facetType", is("hierarchical")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/subject")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/subject")) @@ -61,6 +64,7 @@ public static Matcher submitterFacet(boolean hasNext) { hasJsonPath("$.name", is("submitter")), hasJsonPath("$.facetType", is("authority")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/submitter")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/submitter")) @@ -72,6 +76,7 @@ public static Matcher supervisedByFacet(boolean hasNext) { hasJsonPath("$.name", is("supervisedBy")), hasJsonPath("$.facetType", is("authority")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/supervisedBy")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/supervisedBy")) @@ -83,6 +88,7 @@ public static Matcher dateIssuedFacet(boolean hasNext) { hasJsonPath("$.name", is("dateIssued")), hasJsonPath("$.facetType", is("date")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateIssued")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/dateIssued")) ); @@ -95,6 +101,7 @@ public static Matcher dateIssuedFacetWithMinMax(boolean hasNext, hasJsonPath("$.facetLimit", any(Integer.class)), hasJsonPath("$.minValue", is(min)), hasJsonPath("$.maxValue", is(max)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateIssued")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/dateIssued")) ); @@ -105,6 +112,7 @@ public static Matcher hasContentInOriginalBundleFacet(boolean ha hasJsonPath("$.name", is("has_content_in_original_bundle")), hasJsonPath("$.facetType", is("standard")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/has_content_in_original_bundle")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/has_content_in_original_bundle")) ); @@ -115,6 +123,7 @@ public static Matcher matchFacet(boolean hasNext, String name, S hasJsonPath("$.name", is(name)), hasJsonPath("$.facetType", is(facetType)), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/" + name)), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/" + name)) ); @@ -133,6 +142,7 @@ public static Matcher typeFacet(boolean b) { hasJsonPath("$.name", is("itemtype")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/itemtype")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/itemtype")) ); @@ -151,6 +161,7 @@ public static Matcher resourceTypeFacet(boolean b) { hasJsonPath("$.name", is("namedresourcetype")), hasJsonPath("$.facetType", is("authority")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/namedresourcetype")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/namedresourcetype")) ); @@ -165,6 +176,7 @@ public static Matcher entityTypeFacet(boolean hasNext) { return allOf( hasJsonPath("$.name", is("entityType")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/entityType")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/entityType")) ); @@ -175,6 +187,7 @@ public static Matcher relatedItemFacet(boolean b) { hasJsonPath("$.name", is("relateditem")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/relateditem")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/relateditem")) ); @@ -185,6 +198,7 @@ public static Matcher originFacet(boolean b) { hasJsonPath("$.name", is("origin")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/origin")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/origin")) ); @@ -195,6 +209,7 @@ public static Matcher targetFacet(boolean b) { hasJsonPath("$.name", is("target")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/target")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/target")) ); @@ -205,6 +220,7 @@ public static Matcher queueStatusFacet(boolean b) { hasJsonPath("$.name", is("queue_status")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/queue_status")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/queue_status")) ); @@ -215,6 +231,7 @@ public static Matcher activityStreamTypeFacet(boolean b) { hasJsonPath("$.name", is("activity_stream_type")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/activity_stream_type")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/activity_stream_type")) ); @@ -225,6 +242,7 @@ public static Matcher coarNotifyTypeFacet(boolean b) { hasJsonPath("$.name", is("coar_notify_type")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/coar_notify_type")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/coar_notify_type")) ); @@ -235,6 +253,7 @@ public static Matcher notificationTypeFacet(boolean b) { hasJsonPath("$.name", is("notification_type")), hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/notification_type")), hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/notification_type")) );