From 17714db2a7783c984c0a15ccf856456f0fd18561 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 11 Apr 2022 14:15:06 +0200 Subject: [PATCH] Enhancing generated docs --- pom.xml | 15 ++++++++++++++- .../java/org/gcube/gcat/rest/Configuration.java | 8 ++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 351a734..9556d74 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ UTF-8 ${project.basedir}${file.separator}src${file.separator}main${file.separator}webapp${file.separator}WEB-INF + 2.14.0 @@ -215,6 +216,18 @@ + + com.webcohesion.enunciate + enunciate-core-annotations + ${enunciate.version} + provided + + + com.webcohesion.enunciate + enunciate-rt-util + ${enunciate.version} + provided + org.geotoolkit geotk-xml-base @@ -252,7 +265,7 @@ com.webcohesion.enunciate enunciate-maven-plugin - 2.14.0 + ${enunciate.version} assemble diff --git a/src/main/java/org/gcube/gcat/rest/Configuration.java b/src/main/java/org/gcube/gcat/rest/Configuration.java index 447dfe7..f2a122d 100644 --- a/src/main/java/org/gcube/gcat/rest/Configuration.java +++ b/src/main/java/org/gcube/gcat/rest/Configuration.java @@ -37,6 +37,9 @@ import org.gcube.gcat.persistence.ckan.CKANUserCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.webcohesion.enunciate.metadata.rs.ResponseCode; +import com.webcohesion.enunciate.metadata.rs.StatusCodes; + /** * @author Luca Frosini (ISTI - CNR) */ @@ -97,6 +100,11 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf @Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) @Override @AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class) + @StatusCodes ({ + @ResponseCode(code = 200, condition = "Object successfully created"), + @ResponseCode(code = 401, condition = "Only Catalogue-Managers can invoke such a method"), + @ResponseCode(code = 500, condition = "Error while persisting configuration on the information system"), + }) public Response create(String json) throws WebServiceException { try { ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);