Fixing exception management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@144257 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-02-24 11:46:18 +00:00
parent 3e7084ae57
commit 26cde724ad
1 changed files with 5 additions and 4 deletions

View File

@ -17,7 +17,9 @@ import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; 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.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.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.rest.ERPath; import org.gcube.informationsystem.resourceregistry.api.rest.ERPath;
import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
@ -60,7 +62,7 @@ public class ERManager {
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String createFacet(@PathParam(TYPE_PATH_PARAM) String type, 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 {} ", logger.info("requested facet creation for type {} defined by {} ",
type, json); type, json);
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
@ -131,8 +133,7 @@ public class ERManager {
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String createResource(@PathParam(TYPE_PATH_PARAM) String type, public String createResource(@PathParam(TYPE_PATH_PARAM) String type,
String json) throws FacetNotFoundException, String json) throws ResourceAlreadyPresentException, ResourceRegistryException {
ResourceRegistryException {
logger.info("requested resource creation for type {} with json {}", logger.info("requested resource creation for type {} with json {}",
type, json); type, json);
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
@ -146,7 +147,7 @@ public class ERManager {
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String updateResource(@PathParam(ID_PATH_PARAM) String uuid, public String updateResource(@PathParam(ID_PATH_PARAM) String uuid,
String json) throws FacetNotFoundException, String json) throws ResourceNotFoundException,
ResourceRegistryException { ResourceRegistryException {
logger.info("requested resource update for id {} with {}", uuid, json); logger.info("requested resource update for id {} with {}", uuid, json);
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();