Improved documentation

This commit is contained in:
Luca Frosini 2024-04-10 18:05:03 +02:00
parent d7fa344b7d
commit c36b950358
3 changed files with 40 additions and 27 deletions

View File

@ -31,7 +31,7 @@ import com.webcohesion.enunciate.metadata.rs.StatusCodes;
public class FisheryRESTAPIs extends BaseRESTAPIs<FisheryRecord> {
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<FisheryRecord> {
/**
* 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<FisheryRecord> {
/**
* 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<FisheryRecord> {
* 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<FisheryRecord> {
* 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<FisheryRecord> {
/**
* 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

View File

@ -31,10 +31,10 @@ import com.webcohesion.enunciate.metadata.rs.StatusCodes;
public class StockRESTAPIs extends BaseRESTAPIs<StockRecord> {
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<StockRecord> {
/**
* 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<StockRecord> {
/**
* 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<StockRecord> {
* 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<StockRecord> {
* 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<StockRecord> {
/**
* 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);
}

View File

@ -31,10 +31,10 @@ import com.webcohesion.enunciate.metadata.rs.StatusCodes;
public class TraceabilityUnitRESTAPIs extends BaseRESTAPIs<TraceabilityUnitRecord>{
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<TraceabilityUnitRecor
/**
* This API allows to create a traceability unit record
* @pathExample /traceability-unit
*
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/traceability-unit/create-traceability-unit-request.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/traceability-unit/create-traceability-unit-response.json
*/
@ -201,35 +200,37 @@ public class TraceabilityUnitRESTAPIs extends BaseRESTAPIs<TraceabilityUnitRecor
/**
* This API allows to read a traceability unit record
* @param the GRSF UUID of the traceability unit record to read
* @pathExample /traceability-unit/00454650-b66c-32f9-ae32-eff038dd1e1d
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/traceability-unit/read-traceability-unit-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 traceability unit 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 traceability unit record
* @param the GRSF UUID of the traceability unit record to update
* @pathExample /traceability-unit/00454650-b66c-32f9-ae32-eff038dd1e1d
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/traceability-unit/create-traceability-unit-request.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/traceability-unit/create-traceability-unit-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 traceability unit 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 TraceabilityUnitRESTAPIs extends BaseRESTAPIs<TraceabilityUnitRecor
* 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 traceability unit record to patch
* @pathExample /traceability-unit/00454650-b66c-32f9-ae32-eff038dd1e1d
*/
@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 traceability unit 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 TraceabilityUnitRESTAPIs extends BaseRESTAPIs<TraceabilityUnitRecor
* In case of delete, the traceability unit 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 traceability unit record to delete/purge
* @pathExample /traceability-unit/00454650-b66c-32f9-ae32-eff038dd1e1d
*/
@DELETE
@Path("/{" + RECORD_ID_PARAMETER + "}")
@Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}")
@StatusCodes ({
@ResponseCode ( code = 204, condition = "The traceability unit record has been deleted successfully."),
@ResponseCode ( code = 404, condition = "The traceability unit 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 TraceabilityUnitRESTAPIs extends BaseRESTAPIs<TraceabilityUnitRecor
/**
* This API allows to purge a traceability unit record.
* The record cannot be restored.
* @param the GRSF UUID of the traceability unit record to purge
* @pathExample /traceability-unit/00454650-b66c-32f9-ae32-eff038dd1e1d
*/
@PURGE
@Path("/{" + RECORD_ID_PARAMETER + "}")
@Path("/{" + GRSF_RECORD_UUID_PARAMETER + "}")
@StatusCodes ({
@ResponseCode ( code = 204, condition = "The traceability unit record has been purged successfully."),
@ResponseCode ( code = 404, condition = "The traceability unit 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);
}