From 26cde724adb528aef8503ae1887c44daccd9fc35 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Fri, 24 Feb 2017 11:46:18 +0000 Subject: [PATCH] Fixing exception management git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@144257 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../resourceregistry/rest/ERManager.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java index ad39e4f..fe18948 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java @@ -17,7 +17,9 @@ import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; +import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; +import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.ERPath; import org.gcube.informationsystem.resourceregistry.context.ContextUtility; @@ -60,7 +62,7 @@ public class ERManager { @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) public String createFacet(@PathParam(TYPE_PATH_PARAM) String type, - String json) throws ResourceRegistryException { + String json) throws FacetAlreadyPresentException, ResourceRegistryException { logger.info("requested facet creation for type {} defined by {} ", type, json); FacetManagement facetManagement = new FacetManagement(); @@ -131,8 +133,7 @@ public class ERManager { @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) public String createResource(@PathParam(TYPE_PATH_PARAM) String type, - String json) throws FacetNotFoundException, - ResourceRegistryException { + String json) throws ResourceAlreadyPresentException, ResourceRegistryException { logger.info("requested resource creation for type {} with json {}", type, json); ResourceManagement resourceManagement = new ResourceManagement(); @@ -146,7 +147,7 @@ public class ERManager { @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) public String updateResource(@PathParam(ID_PATH_PARAM) String uuid, - String json) throws FacetNotFoundException, + String json) throws ResourceNotFoundException, ResourceRegistryException { logger.info("requested resource update for id {} with {}", uuid, json); ResourceManagement resourceManagement = new ResourceManagement();