From c36b950358f0801f667c30ea4e33d20f94349149 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 10 Apr 2024 18:05:03 +0200 Subject: [PATCH] Improved documentation --- .../grsf/publisher/rest/FisheryRESTAPIs.java | 7 ++++- .../grsf/publisher/rest/StockRESTAPIs.java | 30 +++++++++++-------- .../rest/TraceabilityUnitRESTAPIs.java | 30 +++++++++++-------- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/gcube/grsf/publisher/rest/FisheryRESTAPIs.java b/src/main/java/org/gcube/grsf/publisher/rest/FisheryRESTAPIs.java index 2405c40..dffeb0c 100644 --- a/src/main/java/org/gcube/grsf/publisher/rest/FisheryRESTAPIs.java +++ b/src/main/java/org/gcube/grsf/publisher/rest/FisheryRESTAPIs.java @@ -31,7 +31,7 @@ import com.webcohesion.enunciate.metadata.rs.StatusCodes; public class FisheryRESTAPIs extends BaseRESTAPIs { public static final String COLLECTION_PATH = "fishery"; - public static final String GRSF_RECORD_UUID_PARAMETER = "fishery_record_id"; + public static final String GRSF_RECORD_UUID_PARAMETER = "FISHERY_GRSF_RECORD_UUID"; public FisheryRESTAPIs() { super(COLLECTION_PATH, GRSF_RECORD_UUID_PARAMETER, FisheryRecord.class); @@ -201,6 +201,7 @@ public class FisheryRESTAPIs extends BaseRESTAPIs { /** * This API allows to read a fishery record + * @param the GRSF UUID of the fishery record to read * @pathExample /fishery/d0145931-58d3-4561-bf64-363b61df016b * @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/fishery/read-fishery-response.json */ @@ -217,6 +218,7 @@ public class FisheryRESTAPIs extends BaseRESTAPIs { /** * This API allows to update a fishery record + * @param the GRSF UUID of the fishery record to update * @pathExample /fishery/d0145931-58d3-4561-bf64-363b61df016b * @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/fishery/create-fishery-request.json * @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/fishery/create-fishery-response.json @@ -240,6 +242,7 @@ public class FisheryRESTAPIs extends BaseRESTAPIs { * adds tags or groups to the records. * The API does not guarantee that the record is removed from an * old group/tag associated due to the old property value. + * @param the GRSF UUID of the fishery record to patch * @pathExample /fishery/d0145931-58d3-4561-bf64-363b61df016b */ @PATCH @@ -260,6 +263,7 @@ public class FisheryRESTAPIs extends BaseRESTAPIs { * In case of delete, the fishery record is no longer visible, * but it still exists and can be restored. * In case of purge, the record is completely deleted and cannot be restored. + * @param the GRSF UUID of the fishery record to delete/purge * @pathExample /fishery/d0145931-58d3-4561-bf64-363b61df016b?purge=true */ @DELETE @@ -277,6 +281,7 @@ public class FisheryRESTAPIs extends BaseRESTAPIs { /** * This API allows to purge a fishery record. * The record cannot be restored. + * @param the GRSF UUID of the fishery record to purge * @pathExample /fishery/d0145931-58d3-4561-bf64-363b61df016b */ @PURGE diff --git a/src/main/java/org/gcube/grsf/publisher/rest/StockRESTAPIs.java b/src/main/java/org/gcube/grsf/publisher/rest/StockRESTAPIs.java index 40e4d07..29a3953 100644 --- a/src/main/java/org/gcube/grsf/publisher/rest/StockRESTAPIs.java +++ b/src/main/java/org/gcube/grsf/publisher/rest/StockRESTAPIs.java @@ -31,10 +31,10 @@ import com.webcohesion.enunciate.metadata.rs.StatusCodes; public class StockRESTAPIs extends BaseRESTAPIs { public static final String COLLECTION_PATH = "stock"; - public static final String RECORD_ID_PARAMETER = "stock_record_id"; + public static final String GRSF_RECORD_UUID_PARAMETER = "STOCK_GRSF_RECORD_UUID"; public StockRESTAPIs() { - super(COLLECTION_PATH, RECORD_ID_PARAMETER, StockRecord.class); + super(COLLECTION_PATH, GRSF_RECORD_UUID_PARAMETER, StockRecord.class); } /** @@ -185,7 +185,6 @@ public class StockRESTAPIs extends BaseRESTAPIs { /** * This API allows to create a stock record * @pathExample /stock - * * @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/stock/create-stock-request.json * @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/stock/create-stock-response.json */ @@ -201,35 +200,37 @@ public class StockRESTAPIs extends BaseRESTAPIs { /** * This API allows to read a stock record + * @param the GRSF UUID of the stock record to read * @pathExample /stock/23fd6734-b7cd-37eb-8b43-03b1495dd7af * @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/stock/read-stock-response.json */ @GET - @Path("/{" + RECORD_ID_PARAMETER + "}") + @Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}") @Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) @StatusCodes ({ @ResponseCode ( code = 200, condition = "The stock record exists.") }) @Override - public String read(@PathParam(RECORD_ID_PARAMETER) String id) { + public String read(@PathParam(GRSF_RECORD_UUID_PARAMETER) String id) { return super.read(id); } /** * This API allows to update a stock record + * @param the GRSF UUID of the stock record to update * @pathExample /stock/23fd6734-b7cd-37eb-8b43-03b1495dd7af * @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/fishery/create-fishery-request.json * @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/fishery/create-fishery-response.json */ @PUT - @Path("/{" + RECORD_ID_PARAMETER + "}") + @Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}") @Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) @Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) @StatusCodes ({ @ResponseCode ( code = 200, condition = "The stock record has been updated successfully.") }) @Override - public String update(@PathParam(RECORD_ID_PARAMETER) String id, String json) { + public String update(@PathParam(GRSF_RECORD_UUID_PARAMETER) String id, String json) { return super.update(id, json); } @@ -240,17 +241,18 @@ public class StockRESTAPIs extends BaseRESTAPIs { * adds tags or groups to the records. * The API does not guarantee that the record is removed from an * old group/tag associated due to the old property value. + * @param the GRSF UUID of the stock record to patch * @pathExample /stock/23fd6734-b7cd-37eb-8b43-03b1495dd7af */ @PATCH - @Path("/{" + RECORD_ID_PARAMETER + "}") + @Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}") @Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) @Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8) @StatusCodes ({ @ResponseCode ( code = 200, condition = "The stock record has been patched successfully.") }) @Override - public String patch(@PathParam(RECORD_ID_PARAMETER) String id, String json) { + public String patch(@PathParam(GRSF_RECORD_UUID_PARAMETER) String id, String json) { return super.patch(id, json); } @@ -260,16 +262,17 @@ public class StockRESTAPIs extends BaseRESTAPIs { * In case of delete, the stock record is no longer visible, * but it still exists and can be restored. * In case of purge, the record is completely deleted and cannot be restored. + * @param the GRSF UUID of the stock record to delete/purge * @pathExample /stock/23fd6734-b7cd-37eb-8b43-03b1495dd7af */ @DELETE - @Path("/{" + RECORD_ID_PARAMETER + "}") + @Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}") @StatusCodes ({ @ResponseCode ( code = 204, condition = "The stock record has been deleted successfully."), @ResponseCode ( code = 404, condition = "The stock record was not found.") }) @Override - public Response delete(@PathParam(RECORD_ID_PARAMETER) String id, + public Response delete(@PathParam(GRSF_RECORD_UUID_PARAMETER) String id, @QueryParam(GCatConstants.PURGE_QUERY_PARAMETER) @DefaultValue("false") Boolean purge) { return super.delete(id, purge); } @@ -277,16 +280,17 @@ public class StockRESTAPIs extends BaseRESTAPIs { /** * This API allows to purge a stock record. * The record cannot be restored. + * @param the GRSF UUID of the stock record to purge * @pathExample /stock/23fd6734-b7cd-37eb-8b43-03b1495dd7af */ @PURGE - @Path("/{" + RECORD_ID_PARAMETER + "}") + @Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}") @StatusCodes ({ @ResponseCode ( code = 204, condition = "The stock record has been purged successfully."), @ResponseCode ( code = 404, condition = "The stock record was not found.") }) @Override - public Response purge(@PathParam(RECORD_ID_PARAMETER) String id) { + public Response purge(@PathParam(GRSF_RECORD_UUID_PARAMETER) String id) { return super.purge(id); } diff --git a/src/main/java/org/gcube/grsf/publisher/rest/TraceabilityUnitRESTAPIs.java b/src/main/java/org/gcube/grsf/publisher/rest/TraceabilityUnitRESTAPIs.java index fcdc849..919c780 100644 --- a/src/main/java/org/gcube/grsf/publisher/rest/TraceabilityUnitRESTAPIs.java +++ b/src/main/java/org/gcube/grsf/publisher/rest/TraceabilityUnitRESTAPIs.java @@ -31,10 +31,10 @@ import com.webcohesion.enunciate.metadata.rs.StatusCodes; public class TraceabilityUnitRESTAPIs extends BaseRESTAPIs{ public static final String COLLECTION_PATH = "traceability-unit"; - public static final String RECORD_ID_PARAMETER = "traceability_unit_record_id"; + public static final String GRSF_RECORD_UUID_PARAMETER = "TRACEABILITY_UNIT_GRSF_RECORD_UUID"; public TraceabilityUnitRESTAPIs() { - super(COLLECTION_PATH, RECORD_ID_PARAMETER, TraceabilityUnitRecord.class); + super(COLLECTION_PATH, GRSF_RECORD_UUID_PARAMETER, TraceabilityUnitRecord.class); } /** @@ -185,7 +185,6 @@ public class TraceabilityUnitRESTAPIs extends BaseRESTAPIs