Improving documentation

This commit is contained in:
Luca Frosini 2022-09-27 17:36:56 +02:00
parent 3b2f91a9ee
commit 2253c4445a
12 changed files with 118 additions and 43 deletions

View File

@ -95,48 +95,84 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
}
}
/**
* Creates the catalogue configuration for the current context using the json
* provided as request body.
*
* Let consider the following example:
*
* <pre>
* {
* "context": "/gcube/devsec/devVRE",
* "defaultOrganization": "devvre",
* "supportedOrganizations": [ "devvre" "nextnext" ],
* "sysAdminToken": "SYS_ADMIN_TOKEN_HERE",
* "ckanURL": "https://ckan-d-d4s.d4science.org",
* "solrURL": "https://ckan-d-d4s.d4science.org/solr/",
* "socialPostEnabled": false,
* "notificationToUsersEnabled": true,
* "moderationEnabled": true,
* "ckanDB": {
* "url": "jdbc:postgresql://ckan-d-d4s.d4science.org:5432/ckan_dev",
* "username": "ckan",
* "password": "PWD_HERE"
* }
* }
* </pre>
*
* We have the following properties:
*
* <dl>
* <dt>context (string)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">defaultOrganization (string)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">supportedOrganizations (array of string)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">sysAdminToken (string)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">ckanURL (string)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">solrURL (string)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">socialPostEnabled (bool)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">notificationToUsersEnabled (bool)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">moderationEnabled (bool)</dt>
* <dd>;</dd>
*
* <dt style="margin-top: 5px;">ckanDB (object)</dt>
* <dd>
* </dd>
*
* </dl>
*
* @param json the configuration representation
* @return the created configuration
* @throws WebServiceException when the request fails
*
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/configuration/create-configuration-request.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/configuration/create-configuration-response.json
*/
@POST
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
@Override
// @AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
@StatusCodes ({
@ResponseCode(code = 201, condition = "Catalogue configuration successfully created."),
@ResponseCode(code = 401, condition = "Only Catalogue-Managers can create catalogue configuration."),
@ResponseCode(code = 500, condition = "Error while persisting catalogue configuration."),
})
/**
* Creates the catalogue configuration for the current context using the json provided as parameter
* @param json the configuration representation
*
* {
* "id": "584b8503-a490-4a89-8372-e21830fa716c",
* "context": "/gcube/devsec/devVRE",
* "defaultOrganization": "devvre",
* "supportedOrganizations": [ "devvre" ],
* "ckanURL": "https://ckan-d-d4s.d4science.org",
* "solrURL": "https://ckan-d-d4s.d4science.org/solr/",
* "socialPostEnabled": false,
* "notificationToUsersEnabled": true,
* "moderationEnabled": true
* }
*
* @return the created configuration
*
* {
* "id": "584b8503-a490-4a89-8372-e21830fa716c",
* "context": "/gcube/devsec/devVRE",
* "defaultOrganization": "devvre",
* "supportedOrganizations": [ "devvre" ],
* "ckanURL": "https://ckan-d-d4s.d4science.org",
* "solrURL": "https://ckan-d-d4s.d4science.org/solr/",
* "socialPostEnabled": false,
* "notificationToUsersEnabled": true,
* "moderationEnabled": true
* }
*
* @throws WebServiceException
*/
@Override
// @AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
public Response create(String json) throws WebServiceException {
try {
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);

View File

@ -321,7 +321,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
* <h3>Parameter automatically managed:</h3>
* <dl>
*
* <dt style="margin-top: 5px;">author (string)</dt>
* <dt>author (string)</dt>
* <dd>the name of the items author (the owner of the gcube-token);</dd>
*
* <dt style="margin-top: 5px;">author_email (string)</dt>
@ -389,8 +389,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
* Some operation could continue in background such as the social post creation.
*
* @pathExample /items?social_post=true
* @requestExample application/json;charset=UTF-8 classpath:/create-item-request.json
* @responseExample application/json;charset=UTF-8 classpath:/create-item-response.json
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/create-item-request.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/create-item-response.json
*
*/
@POST
@ -407,7 +407,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
/**
* @pathExample /items/my_test_item
* @responseExample application/json;charset=UTF-8 classpath:/read-item-response.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/read-item-response.json
*/
@GET
@Path("/{" + ITEM_ID_PARAMETER + "}")
@ -425,8 +425,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
/**
* @pathExample /items/my_test_item
* @requestExample application/json;charset=UTF-8 classpath:/update-item-request.json
* @responseExample application/json;charset=UTF-8 classpath:/update-item-response.json
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/update-item-request.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/update-item-response.json
*/
@PUT
@Path("/{" + ITEM_ID_PARAMETER + "}")
@ -443,8 +443,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
/**
* @pathExample /items/my_test_item
* @requestExample application/json;charset=UTF-8 classpath:/patch-item-request.json
* @responseExample application/json;charset=UTF-8 classpath:/patch-item-response.json
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/patch-item-request.json
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/patch-item-response.json
*/
@PATCH
@Path("/{" + ITEM_ID_PARAMETER + "}")
@ -643,7 +643,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
* The operation will continue in background.
*
* @pathExample /items/my_test_item
* @requestExample application/json;charset=UTF-8 classpath:/reject.json
* @requestExample application/json;charset=UTF-8 classpath:/api-docs-examples/item/reject.json
*/
@POST
@Path("/{" + ITEM_ID_PARAMETER + "}")

View File

@ -0,0 +1,19 @@
{
"context": "/gcube/devsec/devVRE",
"defaultOrganization": "devvre",
"supportedOrganizations": [
"nextnext",
"devvre"
],
"sysAdminToken": "SYS_ADMIN_TOKEN_HERE",
"ckanURL": "https://ckan-d-d4s.d4science.org",
"solrURL": "https://ckan-d-d4s.d4science.org/solr/",
"socialPostEnabled": false,
"notificationToUsersEnabled": true,
"moderationEnabled": false,
"ckanDB": {
"url": "jdbc:postgresql://ckan-d-d4s.d4science.org:5432/ckan_dev",
"username": "ckan",
"password": "PWD_HERE"
}
}

View File

@ -0,0 +1,20 @@
{
"id": "584b8503-a490-4a89-8372-e21830fa716c",
"context": "/gcube/devsec/devVRE",
"defaultOrganization": "devvre",
"supportedOrganizations": [
"nextnext",
"devvre"
],
"sysAdminToken": "SYS_ADMIN_TOKEN",
"ckanURL": "https://ckan-d-d4s.d4science.org",
"solrURL": "https://ckan-d-d4s.d4science.org/solr/",
"socialPostEnabled": false,
"notificationToUsersEnabled": true,
"moderationEnabled": false,
"ckanDB": {
"url": "jdbc:postgresql://ckan-d-d4s.d4science.org:5432/ckan_dev",
"username": "ckan",
"password": "PWD"
}
}