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-api@167867 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-06-04 13:31:13 +00:00
parent a1f5d18c71
commit 6912d0cd47
18 changed files with 51 additions and 72 deletions

View File

@ -4,22 +4,22 @@ package org.gcube.informationsystem.resourceregistry.api.exceptions;
* @author Luca Frosini (ISTI - CNR)
*
*/
public class ERAlreadyPresentException extends ERException {
public class AlreadyPresentException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 1129094888903457750L;
public ERAlreadyPresentException(String message) {
public AlreadyPresentException(String message) {
super(message);
}
public ERAlreadyPresentException(Throwable cause) {
public AlreadyPresentException(Throwable cause) {
super(cause);
}
public ERAlreadyPresentException(String message, Throwable cause) {
public AlreadyPresentException(String message, Throwable cause) {
super(message, cause);
}

View File

@ -4,22 +4,22 @@ package org.gcube.informationsystem.resourceregistry.api.exceptions;
* @author Luca Frosini (ISTI - CNR)
*
*/
public class ERAvailableInAnotherContextException extends ERException {
public class AvailableInAnotherContextException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -7499131763751652582L;
public ERAvailableInAnotherContextException(String message) {
public AvailableInAnotherContextException(String message) {
super(message);
}
public ERAvailableInAnotherContextException(Throwable cause) {
public AvailableInAnotherContextException(Throwable cause) {
super(cause);
}
public ERAvailableInAnotherContextException(String message, Throwable cause) {
public AvailableInAnotherContextException(String message, Throwable cause) {
super(message, cause);
}

View File

@ -4,22 +4,22 @@ package org.gcube.informationsystem.resourceregistry.api.exceptions;
* @author Luca Frosini (ISTI - CNR)
*
*/
public class ERCreationException extends ERException {
public class CreationException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -6223557776095431118L;
public ERCreationException(String message) {
public CreationException(String message) {
super(message);
}
public ERCreationException(Throwable cause) {
public CreationException(Throwable cause) {
super(cause);
}
public ERCreationException(String message, Throwable cause) {
public CreationException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -1,29 +0,0 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.api.exceptions;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class ERException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -2231802464980906972L;
public ERException(String message) {
super(message);
}
public ERException(Throwable cause) {
super(cause);
}
public ERException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -4,22 +4,22 @@ package org.gcube.informationsystem.resourceregistry.api.exceptions;
* @author Luca Frosini (ISTI - CNR)
*
*/
public class ERNotFoundException extends ERException {
public class NotFoundException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -1687373446724146351L;
public ERNotFoundException(String message) {
public NotFoundException(String message) {
super(message);
}
public ERNotFoundException(Throwable cause) {
public NotFoundException(Throwable cause) {
super(cause);
}
public ERNotFoundException(String message, Throwable cause) {
public NotFoundException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -1,9 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class ContextAlreadyPresentException extends ContextException {
public class ContextAlreadyPresentException extends AlreadyPresentException {
/**
* Generated Serial Version UID

View File

@ -1,10 +1,12 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class ContextNotFoundException extends ContextException {
public class ContextNotFoundException extends NotFoundException {
/**
* Generated Serial Version UID

View File

@ -1,12 +1,12 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class EntityAlreadyPresentException extends ERAlreadyPresentException {
public class EntityAlreadyPresentException extends AlreadyPresentException {
/**
* Generated Serial Version UID

View File

@ -1,11 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class EntityAvailableInAnotherContextException extends ERAvailableInAnotherContextException {
public class EntityAvailableInAnotherContextException extends AvailableInAnotherContextException {
/**
* Generated Serial Version UID

View File

@ -1,12 +1,12 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERCreationException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.CreationException;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class EntityCreationException extends ERCreationException {
public class EntityCreationException extends CreationException {
/**
* Generated Serial Version UID

View File

@ -1,12 +1,12 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class EntityNotFoundException extends ERNotFoundException {
public class EntityNotFoundException extends NotFoundException {
/**
* Generated Serial Version UID

View File

@ -1,11 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class RelationAlreadyPresentException extends ERAlreadyPresentException {
public class RelationAlreadyPresentException extends AlreadyPresentException {
/**
* Generated Serial Version UID

View File

@ -1,11 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class RelationAvailableInAnotherContextException extends ERAvailableInAnotherContextException {
public class RelationAvailableInAnotherContextException extends AvailableInAnotherContextException {
/**
* Generated Serial Version UID

View File

@ -1,12 +1,12 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERCreationException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.CreationException;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class RelationCreationException extends ERCreationException {
public class RelationCreationException extends CreationException {
/**
* Generated Serial Version UID

View File

@ -1,11 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class RelationNotFoundException extends ERNotFoundException {
public class RelationNotFoundException extends NotFoundException {
/**
* Generated Serial Version UID

View File

@ -1,9 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.relation.isparentof;
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationAlreadyPresentException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class IsParentOfAlreadyPresentException extends IsParentOfException {
public class IsParentOfAlreadyPresentException extends RelationAlreadyPresentException {
/**
* Generated Serial Version UID

View File

@ -1,9 +1,11 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.relation.isparentof;
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class IsParentOfNotFoundException extends IsParentOfException {
public class IsParentOfNotFoundException extends RelationNotFoundException {
/**
* Generated Serial Version UID

View File

@ -20,8 +20,8 @@ import org.gcube.informationsystem.model.ISManageable;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ERNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ExceptionMapper;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAvailableInAnotherContextException;
@ -181,8 +181,8 @@ public class HTTPCall {
return result;
}
protected <C> ERNotFoundException getElementNotFoundException(Class<C> clz)
throws ERNotFoundException, ResourceRegistryException {
protected <C> NotFoundException getElementNotFoundException(Class<C> clz)
throws NotFoundException, ResourceRegistryException {
String error = String.format("Requested %s instance was not found", clz.getSimpleName());
if (Resource.class.isAssignableFrom(clz)) {
return new ResourceNotFoundException(error);
@ -191,10 +191,10 @@ public class HTTPCall {
} else if (Relation.class.isAssignableFrom(clz)) {
return new RelationNotFoundException(error);
}
return new ERNotFoundException(error);
return new NotFoundException(error);
}
protected <C> ERAvailableInAnotherContextException getElementAvailableInAnotherContextException(Class<C> clz) {
protected <C> AvailableInAnotherContextException getElementAvailableInAnotherContextException(Class<C> clz) {
String error = String.format("Requested %s instance was not found", clz.getSimpleName());
if (Resource.class.isAssignableFrom(clz)) {
return new ResourceAvailableInAnotherContextException(error);
@ -203,7 +203,7 @@ public class HTTPCall {
} else if (Relation.class.isAssignableFrom(clz)) {
return new RelationAvailableInAnotherContextException(error);
}
return new ERAvailableInAnotherContextException(error);
return new AvailableInAnotherContextException(error);
}
public <C> C call(Class<C> clz, String path, HTTPMETHOD method) throws Exception {