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(); } /*