Fixed path parameters on AddToContext and RemoveFromContexts

This commit is contained in:
Luca Frosini 2020-10-30 21:10:37 +01:00
parent 6793b16856
commit f8ec6b9084
1 changed files with 16 additions and 14 deletions

View File

@ -30,25 +30,25 @@ public class SharingManagement {
protected void setRESTCalledMethod(HTTPMETHOD httpMethod, String type) {
List<String> list = new ArrayList<>();
list.add(SharingPath.SHARING_PATH_PART);
list.add(SharingPath.CONTEXTS_PATH_PART);
list.add("{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}");
list.add(type);
list.add("{" + AccessPath.UUID_PATH_PARAM + "}");
list.add(SharingPath.CONTEXTS_PATH_PART);
list.add("{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}");
Access.setRESTCalledMethod(httpMethod, list, null);
}
*/
/*
* PUT /sharing/{CONTEXT_UUID}/{TYPE_NAME}/{UUID}
* PUT /sharing/{TYPE_NAME}/{UUID}/contexts/{CONTEXT_UUID}
* e.g PUT
* /resource-registry/sharing/67062c11-9c3a-4906-870d-7df6a43408b0/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8
* Where 67062c11-9c3a-4906-870d-7df6a43408b0/ is the context UUID
* and 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID
* /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/contexts/67062c11-9c3a-4906-870d-7df6a43408b0
* Where 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID
* and 67062c11-9c3a-4906-870d-7df6a43408b0/ is the Context UUID
*
*/
@PUT
@Path(SharingPath.CONTEXTS_PATH_PART + "/{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}" + "/{"
+ 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 + "}" )
public boolean add(@PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId,
@PathParam(AccessPath.TYPE_PATH_PARAM) String type, @PathParam(AccessPath.UUID_PATH_PARAM) String id)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
@ -78,16 +78,16 @@ public class SharingManagement {
}
/*
* DELETE /sharing/{CONTEXT_UUID}/{TYPE_NAME}/{UUID}
* DELETE /sharing/{TYPE_NAME}/{UUID}/contexts/{CONTEXT_UUID}
* e.g DELETE
* /resource-registry/sharing/contexts/67062c11-9c3a-4906-870d-7df6a43408b0/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8
* Where 67062c11-9c3a-4906-870d-7df6a43408b0 is the Context UUID
* and 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID
* /resource-registry/sharing/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8/contexts/67062c11-9c3a-4906-870d-7df6a43408b0
* Where 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID
* and 67062c11-9c3a-4906-870d-7df6a43408b0 is the Context UUID
*
*/
@DELETE
@Path(SharingPath.CONTEXTS_PATH_PART + "/{" + AccessPath.CONTEXT_UUID_PATH_PARAM + "}" + "/{"
+ 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 + "}" )
public Response remove(@PathParam(AccessPath.CONTEXT_UUID_PATH_PARAM) String contextId,
@PathParam(AccessPath.TYPE_PATH_PARAM) String type, @PathParam(AccessPath.UUID_PATH_PARAM) String id)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
@ -98,6 +98,8 @@ public class SharingManagement {
@SuppressWarnings("rawtypes")
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
UUID uuid = null;
try {
uuid = UUID.fromString(id);
} catch(Exception e) {