Fixed URL path

This commit is contained in:
Luca Frosini 2020-11-24 15:39:09 +01:00
parent 251d239773
commit 64b0c49771
1 changed files with 46 additions and 46 deletions

View File

@ -30,30 +30,28 @@ public class SharingManagement {
private static Logger logger = LoggerFactory.getLogger(SharingManagement.class); private static Logger logger = LoggerFactory.getLogger(SharingManagement.class);
/* /*
protected void setRESTCalledMethod(HTTPMETHOD httpMethod, String type) { * protected void setRESTCalledMethod(HTTPMETHOD httpMethod, String type) {
List<String> list = new ArrayList<>(); * List<String> list = new ArrayList<>();
list.add(SharingPath.SHARING_PATH_PART); * list.add(SharingPath.SHARING_PATH_PART); list.add(type); list.add("{" +
list.add(type); * AccessPath.UUID_PATH_PARAM + "}"); list.add(SharingPath.CONTEXTS_PATH_PART);
list.add("{" + AccessPath.UUID_PATH_PARAM + "}"); * list.add("{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}");
list.add(SharingPath.CONTEXTS_PATH_PART); * Access.setRESTCalledMethod(httpMethod, list, null); }
list.add("{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}");
Access.setRESTCalledMethod(httpMethod, list, null);
}
*/ */
/* /*
* GET /sharing/{TYPE_NAME}/{UUID}/contexts/ * GET /sharing/{TYPE_NAME}/{UUID}/contexts/ e.g GET
* e.g GET /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/contexts * /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/
* Where 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID * contexts Where 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID
* *
* Return a list of UUID identifying the context the instance belongs to. * Return a list of UUID identifying the context the instance belongs to.
*/ */
@GET @GET
@Path("{" + AccessPath.TYPE_PATH_PARAM + "}" + "/{" + AccessPath.UUID_PATH_PARAM + "}" + @Path("{" + AccessPath.TYPE_PATH_PARAM + "}" + "/{" + AccessPath.UUID_PATH_PARAM + "}/"
SharingPath.CONTEXTS_PATH_PART ) + SharingPath.CONTEXTS_PATH_PART)
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String getInstanceContexts(@PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId, public String getInstanceContexts(@PathParam(AccessPath.TYPE_PATH_PARAM) String type,
@PathParam(AccessPath.TYPE_PATH_PARAM) String type, @PathParam(AccessPath.UUID_PATH_PARAM) String instanceId) @PathParam(AccessPath.UUID_PATH_PARAM) String instanceId,
@PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to get contexts of {} with UUID {}", type, instanceId); logger.info("Requested to get contexts of {} with UUID {}", type, instanceId);
CalledMethodProvider.instance.set("getInstanceContexts"); CalledMethodProvider.instance.set("getInstanceContexts");
@ -64,19 +62,19 @@ public class SharingManagement {
return erManagement.getContexts(); return erManagement.getContexts();
} }
/* /*
* PUT /sharing/{TYPE_NAME}/{UUID}/contexts/{CONTEXT_UUID} * PUT /sharing/{TYPE_NAME}/{UUID}/contexts/{CONTEXT_UUID} e.g PUT
* e.g PUT * /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/
* /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/contexts/67062c11-9c3a-4906-870d-7df6a43408b0 * contexts/67062c11-9c3a-4906-870d-7df6a43408b0 Where
* Where 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID * 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID and
* and 67062c11-9c3a-4906-870d-7df6a43408b0/ is the Context UUID * 67062c11-9c3a-4906-870d-7df6a43408b0/ is the Context UUID
* *
*/ */
@PUT @PUT
@Path("{" + AccessPath.TYPE_PATH_PARAM + "}" + "/{" + AccessPath.UUID_PATH_PARAM + "}" + @Path("{" + AccessPath.TYPE_PATH_PARAM + "}" + "/{" + AccessPath.UUID_PATH_PARAM + "}/"
SharingPath.CONTEXTS_PATH_PART + "/{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}" ) + SharingPath.CONTEXTS_PATH_PART + "/{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}")
public boolean add(@PathParam(AccessPath.TYPE_PATH_PARAM) String type, @PathParam(AccessPath.UUID_PATH_PARAM) String instanceId, public boolean add(@PathParam(AccessPath.TYPE_PATH_PARAM) String type,
@PathParam(AccessPath.UUID_PATH_PARAM) String instanceId,
@PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId) @PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
@ -91,20 +89,22 @@ public class SharingManagement {
} }
/* /*
* DELETE /sharing/{TYPE_NAME}/{UUID}/contexts/{CONTEXT_UUID} * DELETE /sharing/{TYPE_NAME}/{UUID}/contexts/{CONTEXT_UUID} e.g DELETE
* e.g DELETE * /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/
* /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/contexts/67062c11-9c3a-4906-870d-7df6a43408b0 * contexts/67062c11-9c3a-4906-870d-7df6a43408b0 Where
* Where 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID * 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID and
* and 67062c11-9c3a-4906-870d-7df6a43408b0 is the Context UUID * 67062c11-9c3a-4906-870d-7df6a43408b0 is the Context UUID
* *
*/ */
@DELETE @DELETE
@Path("{" + AccessPath.TYPE_PATH_PARAM + "}" + "/{" + AccessPath.UUID_PATH_PARAM + "}" + @Path("{" + AccessPath.TYPE_PATH_PARAM + "}" + "/{" + AccessPath.UUID_PATH_PARAM + "}/"
SharingPath.CONTEXTS_PATH_PART + "/{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}" ) + SharingPath.CONTEXTS_PATH_PART + "/{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}")
public Response remove(@PathParam(AccessPath.TYPE_PATH_PARAM) String type, @PathParam(AccessPath.UUID_PATH_PARAM) String instanceId, public Response remove(@PathParam(AccessPath.TYPE_PATH_PARAM) String type,
@PathParam(AccessPath.UUID_PATH_PARAM) String instanceId,
@PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId) @PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to remove {} with UUID {} to {} with UUID {}", type, instanceId, Context.NAME, contextId); logger.info("Requested to remove {} with UUID {} to {} with UUID {}", type, instanceId, Context.NAME,
contextId);
// setRESTCalledMethod(HTTPMETHOD.DELETE, type); // setRESTCalledMethod(HTTPMETHOD.DELETE, type);
CalledMethodProvider.instance.set("removeFromContext"); CalledMethodProvider.instance.set("removeFromContext");