Refactoring
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141534 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
41b112670e
commit
ac2c827022
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.informationsystem.resourceregistry.query;
|
package org.gcube.informationsystem.resourceregistry.query;
|
||||||
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
|
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
|
||||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||||
|
|
|
@ -9,9 +9,9 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
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.query.InvalidQueryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||||
|
|
|
@ -17,7 +17,6 @@ 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.EntityException;
|
|
||||||
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.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;
|
||||||
|
@ -61,7 +60,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 EntityException, ResourceRegistryException {
|
String json) throws 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();
|
||||||
|
|
|
@ -6,9 +6,9 @@ import javax.ws.rs.core.Response.Status;
|
||||||
import javax.ws.rs.ext.ExceptionMapper;
|
import javax.ws.rs.ext.ExceptionMapper;
|
||||||
import javax.ws.rs.ext.Provider;
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ElementAlreadyPresent;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ElementNotFound;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAlreadyPresentException;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -22,9 +22,9 @@ public class ResourceRegistryExceptionMapper implements ExceptionMapper<Resource
|
||||||
String entity = exception.getMessage();
|
String entity = exception.getMessage();
|
||||||
MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
|
MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
|
||||||
|
|
||||||
if(ElementNotFound.class.isAssignableFrom(exception.getClass())){
|
if(ERNotFoundException.class.isAssignableFrom(exception.getClass())){
|
||||||
status = Status.NOT_FOUND;
|
status = Status.NOT_FOUND;
|
||||||
}else if(ElementAlreadyPresent.class.isAssignableFrom(exception.getClass())){
|
}else if(ERAlreadyPresentException.class.isAssignableFrom(exception.getClass())){
|
||||||
status = Status.FORBIDDEN;
|
status = Status.FORBIDDEN;
|
||||||
} else {
|
} else {
|
||||||
status = Status.INTERNAL_SERVER_ERROR;
|
status = Status.INTERNAL_SERVER_ERROR;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.access;
|
package org.gcube.informationsystem.resourceregistry.access;
|
||||||
|
|
||||||
import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.query.QueryImpl;
|
import org.gcube.informationsystem.resourceregistry.query.QueryImpl;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
Loading…
Reference in New Issue