From 3a20b401697600e3474746385c20773fb0ef987b Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Tue, 12 Jun 2018 18:04:54 +0000 Subject: [PATCH] Refs #11288: Made resource-registry more RESTful Task-Url: https://support.d4science.org/issues/11288 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@169104 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../resourceregistry/rest/ContextManager.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java index 24e2a66..950ae1a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java @@ -15,7 +15,6 @@ import javax.ws.rs.core.MediaType; import org.gcube.informationsystem.model.entity.Context; import org.gcube.informationsystem.resourceregistry.ResourceInitializer; -import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; @@ -105,19 +104,7 @@ public class ContextManager { ContextManagement contextManagement = new ContextManagement(); contextManagement.setUUID(UUID.fromString(uuid)); - boolean create = false; - try { - contextManagement.read(); - } catch(NotFoundException e) { - create = true; - } - - contextManagement.setJSON(json); - if(create) { - return contextManagement.create(); - } - - return contextManagement.update(); + return contextManagement.createOrUpdate(); } /*