From 0d194a28a330b036d23a23d48acbed3d1bb6c10f Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 26 Jul 2022 12:05:37 +0200 Subject: [PATCH] Using renamed constant from gcat-api --- CHANGELOG.md | 2 ++ src/main/java/org/gcube/gcat/rest/Group.java | 10 +++++----- src/main/java/org/gcube/gcat/rest/Item.java | 10 +++++----- src/main/java/org/gcube/gcat/rest/Organization.java | 10 +++++----- src/main/java/org/gcube/gcat/rest/Profile.java | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76e8973..d7e5774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [v2.4.0-SNAPSHOT] - Added moderation link in moderation message [#23142] +- Added query parameter in item listing to get the whole item instead of just the name [#23691] +- Using renamed constant from gcat-api ## [v2.3.0] diff --git a/src/main/java/org/gcube/gcat/rest/Group.java b/src/main/java/org/gcube/gcat/rest/Group.java index 3ba9aff..7434ad4 100644 --- a/src/main/java/org/gcube/gcat/rest/Group.java +++ b/src/main/java/org/gcube/gcat/rest/Group.java @@ -45,9 +45,9 @@ public class Group extends REST implements org.gcube.gcat.api.interfa @GET @Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) // @AuthorizationControl(allowedRoles={Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class) - public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit, - @QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset, - @QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) { + public String list(@QueryParam(GCatConstants.LIMIT_QUERY_PARAMETER) @DefaultValue("10") int limit, + @QueryParam(GCatConstants.OFFSET_QUERY_PARAMETER) @DefaultValue("0") int offset, + @QueryParam(GCatConstants.COUNT_QUERY_PARAMETER) @DefaultValue("false") Boolean countOnly) { if(countOnly) { int count = count(); return createCountJson(count); @@ -60,8 +60,8 @@ public class Group extends REST implements org.gcube.gcat.api.interfa * Not used as REST method, implemented to respect {@link org.gcube.gcat.api.interfaces.Item} interface */ @Override - public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit, - @QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset) { + public String list(@QueryParam(GCatConstants.LIMIT_QUERY_PARAMETER) @DefaultValue("10") int limit, + @QueryParam(GCatConstants.OFFSET_QUERY_PARAMETER) @DefaultValue("0") int offset) { return super.list(limit, offset); } diff --git a/src/main/java/org/gcube/gcat/rest/Item.java b/src/main/java/org/gcube/gcat/rest/Item.java index 6c31c7f..4d3e6d8 100644 --- a/src/main/java/org/gcube/gcat/rest/Item.java +++ b/src/main/java/org/gcube/gcat/rest/Item.java @@ -47,9 +47,9 @@ public class Item extends REST implements org.gcube.gcat.api.interf /* Catalogue-Member is not added to VRE members and is assumed as the default role in the catalogue for the VRE members. So we can't enforce * @AuthorizationControl(allowedRoles={Role.CATALOGUE_MEMBER, Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class) */ - public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit, - @QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset, - @QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) { + public String list(@QueryParam(GCatConstants.LIMIT_QUERY_PARAMETER) @DefaultValue("10") int limit, + @QueryParam(GCatConstants.OFFSET_QUERY_PARAMETER) @DefaultValue("0") int offset, + @QueryParam(GCatConstants.COUNT_QUERY_PARAMETER) @DefaultValue("false") Boolean countOnly) { if(countOnly) { CKANPackage ckan = getInstance(); int count = ckan.count(); @@ -63,8 +63,8 @@ public class Item extends REST implements org.gcube.gcat.api.interf * Not used as REST method, implemented to respect {@link org.gcube.gcat.api.interfaces.Item} interface */ @Override - public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit, - @QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset) { + public String list(@QueryParam(GCatConstants.LIMIT_QUERY_PARAMETER) @DefaultValue("10") int limit, + @QueryParam(GCatConstants.OFFSET_QUERY_PARAMETER) @DefaultValue("0") int offset) { return super.list(limit, offset); } diff --git a/src/main/java/org/gcube/gcat/rest/Organization.java b/src/main/java/org/gcube/gcat/rest/Organization.java index 9387086..e212a81 100644 --- a/src/main/java/org/gcube/gcat/rest/Organization.java +++ b/src/main/java/org/gcube/gcat/rest/Organization.java @@ -46,9 +46,9 @@ public class Organization extends REST @GET @Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) // @AuthorizationControl(allowedRoles={Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class) - public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit, - @QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset, - @QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) { + public String list(@QueryParam(GCatConstants.LIMIT_QUERY_PARAMETER) @DefaultValue("10") int limit, + @QueryParam(GCatConstants.OFFSET_QUERY_PARAMETER) @DefaultValue("0") int offset, + @QueryParam(GCatConstants.COUNT_QUERY_PARAMETER) @DefaultValue("false") Boolean countOnly) { if(countOnly) { int count = count(); return createCountJson(count); @@ -61,8 +61,8 @@ public class Organization extends REST * Not used as REST method, implemented to respect {@link org.gcube.gcat.api.interfaces.Item} interface */ @Override - public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit, - @QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset) { + public String list(@QueryParam(GCatConstants.LIMIT_QUERY_PARAMETER) @DefaultValue("10") int limit, + @QueryParam(GCatConstants.OFFSET_QUERY_PARAMETER) @DefaultValue("0") int offset) { return super.list(limit, offset); } diff --git a/src/main/java/org/gcube/gcat/rest/Profile.java b/src/main/java/org/gcube/gcat/rest/Profile.java index 03a551a..739f9b3 100644 --- a/src/main/java/org/gcube/gcat/rest/Profile.java +++ b/src/main/java/org/gcube/gcat/rest/Profile.java @@ -74,7 +74,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P @GET @Produces(MediaType.APPLICATION_JSON) - public String listOrCount(@QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) { + public String listOrCount(@QueryParam(GCatConstants.COUNT_QUERY_PARAMETER) @DefaultValue("false") Boolean countOnly) { setCalledMethod("GET /" + PROFILES); try { ISProfile isProfile = new ISProfile();