Fixed imports and class names due to IS Model refactoring
This commit is contained in:
parent
45f7cbbf6a
commit
6e08fb1caa
|
@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.publisher;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
|
@ -21,28 +21,28 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour
|
|||
*/
|
||||
public interface ResourceRegistryPublisher {
|
||||
|
||||
public <E extends ER> E create(E er)
|
||||
public <IE extends IdentifiableElement> IE create(IE er)
|
||||
throws AlreadyPresentException, ResourceRegistryException;
|
||||
|
||||
public String create(String er) throws AlreadyPresentException, ResourceRegistryException;
|
||||
public String create(String json) throws AlreadyPresentException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <E extends ER> E read(E er) throws NotFoundException, ResourceRegistryException;
|
||||
public <IE extends IdentifiableElement> IE read(IE identifiableElement) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public String read(String erType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
public String read(String identifiableElementTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <E extends ER> E update(E er)
|
||||
public <IE extends IdentifiableElement> IE update(IE identifiableElement)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public String update(String erType, String er) throws NotFoundException, ResourceRegistryException;
|
||||
public String update(String identifiableElementTypeName, String json) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public String update(String er) throws NotFoundException, ResourceRegistryException;
|
||||
public String update(String json) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <E extends ER> boolean delete(E er) throws NotFoundException, ResourceRegistryException;
|
||||
public <IE extends IdentifiableElement> boolean delete(IE identifiableElement) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean delete(String erType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
public boolean delete(String identifiableElementTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
/* ----- */
|
||||
|
@ -56,7 +56,7 @@ public interface ResourceRegistryPublisher {
|
|||
|
||||
public <F extends Facet> F readFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
|
||||
|
||||
public String readFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
||||
public String readFacet(String facetTypeName, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <F extends Facet> F updateFacet(F facet)
|
||||
|
@ -67,7 +67,7 @@ public interface ResourceRegistryPublisher {
|
|||
|
||||
public <F extends Facet> boolean deleteFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean deleteFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
||||
public boolean deleteFacet(String facetTypeName, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
/* ----- */
|
||||
|
@ -82,7 +82,7 @@ public interface ResourceRegistryPublisher {
|
|||
public <R extends Resource> R readResource(R resource)
|
||||
throws ResourceNotFoundException, ResourceRegistryException;
|
||||
|
||||
public String readResource(String resourceType, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
||||
public String readResource(String resourceTypeName, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <R extends Resource> R updateResource(R resource)
|
||||
|
@ -95,7 +95,7 @@ public interface ResourceRegistryPublisher {
|
|||
public <R extends Resource> boolean deleteResource(R resource)
|
||||
throws ResourceNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean deleteResource(String resourceType, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
||||
public boolean deleteResource(String resourceTypeName, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
/* ----- */
|
||||
|
@ -111,7 +111,7 @@ public interface ResourceRegistryPublisher {
|
|||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C readConsistsOf(
|
||||
C consistsOf) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public String readConsistsOf(String consistsOfType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
public String readConsistsOf(String consistsOfTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C updateConsistsOf(C consistsOf)
|
||||
|
@ -124,7 +124,7 @@ public interface ResourceRegistryPublisher {
|
|||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(C consistsOf)
|
||||
throws ResourceRegistryException;
|
||||
|
||||
public boolean deleteConsistsOf(String consistsOfType, UUID uuid) throws ResourceRegistryException;
|
||||
public boolean deleteConsistsOf(String consistsOfTypeName, UUID uuid) throws ResourceRegistryException;
|
||||
|
||||
|
||||
/* ----- */
|
||||
|
@ -140,7 +140,7 @@ public interface ResourceRegistryPublisher {
|
|||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I readIsRelatedTo(
|
||||
I isRelatedTo) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public String readIsRelatedTo(String isRelatedToType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
public String readIsRelatedTo(String isRelatedToTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I updateIsRelatedTo(I isRelatedTo)
|
||||
|
@ -153,41 +153,41 @@ public interface ResourceRegistryPublisher {
|
|||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo)
|
||||
throws ResourceRegistryException;
|
||||
|
||||
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid) throws ResourceRegistryException;
|
||||
public boolean deleteIsRelatedTo(String isRelatedToTypeName, UUID uuid) throws ResourceRegistryException;
|
||||
|
||||
|
||||
/* ----- */
|
||||
|
||||
|
||||
public boolean addToContext(UUID contextUUID, String erType, UUID instanceUUID)
|
||||
public boolean addToContext(UUID contextUUID, String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public <E extends ER> boolean addToContext(UUID contextUUID, E er)
|
||||
public <IE extends IdentifiableElement> boolean addToContext(UUID contextUUID, IE identifiableElement)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean addToCurrentContext(String erType, UUID instanceUUID)
|
||||
public boolean addToCurrentContext(String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public <E extends ER> boolean addToCurrentContext(E er)
|
||||
public <IE extends IdentifiableElement> boolean addToCurrentContext(IE identifiableElement)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean removeFromContext(UUID contextUUID, String erType, UUID instanceUUID)
|
||||
public boolean removeFromContext(UUID contextUUID, String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public <E extends ER> boolean removeFromContext(UUID contextUUID, E er)
|
||||
public <IE extends IdentifiableElement> boolean removeFromContext(UUID contextUUID, IE identifiableElement)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean removeFromCurrentContext(String erType, UUID instanceUUID)
|
||||
public boolean removeFromCurrentContext(String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <E extends ER> boolean removeFromCurrentContext(E er)
|
||||
public <IE extends IdentifiableElement> boolean removeFromCurrentContext(IE identifiableElement)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
|
||||
/* ----- */
|
||||
|
||||
|
||||
public boolean addResourceToContext(UUID contextUUID, String resourceType, UUID resourceUUID)
|
||||
public boolean addResourceToContext(UUID contextUUID, String resourceTypeName, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <R extends Resource> boolean addResourceToContext(UUID contextUUID, R resource)
|
||||
|
@ -199,7 +199,7 @@ public interface ResourceRegistryPublisher {
|
|||
public <R extends Resource> boolean addResourceToCurrentContext(R resource)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean removeResourceFromContext(UUID contextUUID, String resourceType, UUID resourceUUID)
|
||||
public boolean removeResourceFromContext(UUID contextUUID, String resourceTypeName, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <R extends Resource> boolean removeResourceFromContext(UUID contextUUID, R resource)
|
||||
|
@ -215,25 +215,25 @@ public interface ResourceRegistryPublisher {
|
|||
/* ----- */
|
||||
|
||||
|
||||
public boolean addFacetToContext(UUID contextUUID, String facetType, UUID facetUUID)
|
||||
public boolean addFacetToContext(UUID contextUUID, String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <F extends Facet> boolean addFacetToContext(UUID contextUUID, F facet)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean addFacetToCurrentContext(String facetType, UUID facetUUID)
|
||||
public boolean addFacetToCurrentContext(String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <F extends Facet> boolean addFacetToCurrentContext(F facet)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean removeFacetFromContext(UUID contextUUID, String facetType, UUID facetUUID)
|
||||
public boolean removeFacetFromContext(UUID contextUUID, String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <F extends Facet> boolean removeFacetFromContext(UUID contextUUID, F facet)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID)
|
||||
public boolean removeFacetFromCurrentContext(String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <F extends Facet> boolean removeFacetFromCurrentContext(F facet)
|
||||
|
|
|
@ -9,7 +9,8 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|||
import org.gcube.common.gxhttp.reference.GXConnection;
|
||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
|
@ -29,7 +30,7 @@ import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
|||
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.informationsystem.utils.Utility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -69,7 +70,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
Context context = HTTPUtility.getResponse(Context.class, httpURLConnection);
|
||||
|
||||
logger.debug("Got Context is {}", ISMapper.marshal(context));
|
||||
logger.debug("Got Context is {}", ElementMapper.marshal(context));
|
||||
return context.getHeader().getUUID();
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error while getting {} schema for {}", polymorphic ?
|
||||
|
@ -84,19 +85,19 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
}
|
||||
|
||||
protected String create(String erType, String er, UUID uuid)
|
||||
protected String create(String identifiableElementTypeName, String json, UUID uuid)
|
||||
throws AlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to create {} : {}", erType, er);
|
||||
logger.trace("Going to create {} : {}", identifiableElementTypeName, json);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryPublisher.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(InstancePath.INSTANCES_PATH_PART);
|
||||
gxHTTPStringRequest.path(erType);
|
||||
gxHTTPStringRequest.path(identifiableElementTypeName);
|
||||
gxHTTPStringRequest.path(uuid.toString());
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.put(er);
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.put(json);
|
||||
String ret = HTTPUtility.getResponse(String.class, httpURLConnection);
|
||||
|
||||
logger.trace("{} successfully created", ret);
|
||||
|
@ -111,17 +112,17 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
}
|
||||
|
||||
public <E extends ER> String internalCreate(E er) throws AlreadyPresentException, ResourceRegistryException {
|
||||
public <IE extends IdentifiableElement> String internalCreate(IE identifiableElement) throws AlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getType(er);
|
||||
String erString = ISMapper.marshal(er);
|
||||
Header header = er.getHeader();
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
|
||||
String json = ElementMapper.marshal(identifiableElement);
|
||||
Header header = identifiableElement.getHeader();
|
||||
if(header==null) {
|
||||
header = new HeaderImpl(UUID.randomUUID());
|
||||
er.setHeader(header);
|
||||
identifiableElement.setHeader(header);
|
||||
}
|
||||
UUID uuid = er.getHeader().getUUID();
|
||||
return create(erType, erString, uuid);
|
||||
UUID uuid = identifiableElement.getHeader().getUUID();
|
||||
return create(identifiableElementTypeName, json, uuid);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -134,10 +135,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <E extends ER> E create(E er) throws AlreadyPresentException, ResourceRegistryException {
|
||||
public <IE extends IdentifiableElement> IE create(IE identifiableElement) throws AlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
String ret = internalCreate(er);
|
||||
return (E) ISMapper.unmarshal(ER.class, ret);
|
||||
String ret = internalCreate(identifiableElement);
|
||||
return (IE) ElementMapper.unmarshal(IdentifiableElement.class, ret);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -148,9 +149,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String create(String er) throws AlreadyPresentException, ResourceRegistryException {
|
||||
public String create(String identifiableElement) throws AlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
ER e = ISMapper.unmarshal(ER.class, er);
|
||||
IdentifiableElement e = ElementMapper.unmarshal(IdentifiableElement.class, identifiableElement);
|
||||
return internalCreate(e);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
|
@ -163,12 +164,12 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <E extends ER> E read(E er) throws NotFoundException, ResourceRegistryException {
|
||||
public <IE extends IdentifiableElement> IE read(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getType(er);
|
||||
UUID uuid = er.getHeader().getUUID();
|
||||
String ret = read(erType, uuid);
|
||||
return (E) ISMapper.unmarshal(ER.class, ret);
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
|
||||
UUID uuid = identifiableElement.getHeader().getUUID();
|
||||
String ret = read(identifiableElementTypeName, uuid);
|
||||
return (IE) ElementMapper.unmarshal(IdentifiableElement.class, ret);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -179,20 +180,20 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String read(String erType, UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
public String read(String identifiableElementTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to read {} with UUID {}", erType, uuid);
|
||||
logger.trace("Going to read {} with UUID {}", identifiableElementTypeName, uuid);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryPublisher.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(InstancePath.INSTANCES_PATH_PART);
|
||||
gxHTTPStringRequest.path(erType);
|
||||
gxHTTPStringRequest.path(identifiableElementTypeName);
|
||||
gxHTTPStringRequest.path(uuid.toString());
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
String ret = HTTPUtility.getResponse(String.class, httpURLConnection);
|
||||
|
||||
logger.debug("Got {} with UUID {} is {}", erType, uuid, ret);
|
||||
logger.debug("Got {} with UUID {} is {}", identifiableElementTypeName, uuid, ret);
|
||||
return ret;
|
||||
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
@ -204,22 +205,22 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
}
|
||||
|
||||
protected String update(String erType, String er, UUID uuid)
|
||||
protected String update(String identifiableElementTypeName, String json, UUID uuid)
|
||||
throws AlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to create {} : {}", erType, er);
|
||||
logger.trace("Going to create {} : {}", identifiableElementTypeName, json);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryPublisher.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(InstancePath.INSTANCES_PATH_PART);
|
||||
gxHTTPStringRequest.path(erType);
|
||||
gxHTTPStringRequest.path(identifiableElementTypeName);
|
||||
gxHTTPStringRequest.path(uuid.toString());
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.put(er);
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.put(json);
|
||||
String ret = HTTPUtility.getResponse(String.class, httpURLConnection);
|
||||
|
||||
logger.trace("{} with UUID {} successfully created : {}", erType, uuid, ret);
|
||||
logger.trace("{} with UUID {} successfully created : {}", identifiableElementTypeName, uuid, ret);
|
||||
return ret;
|
||||
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
@ -233,13 +234,13 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <E extends ER> E update(E er) throws NotFoundException, ResourceRegistryException {
|
||||
public <IE extends IdentifiableElement> IE update(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getType(er);
|
||||
String erString = ISMapper.marshal(er);
|
||||
UUID uuid = er.getHeader().getUUID();
|
||||
String ret = update(erType, erString, uuid);
|
||||
return (E) ISMapper.unmarshal(ER.class, ret);
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
|
||||
String json = ElementMapper.marshal(identifiableElement);
|
||||
UUID uuid = identifiableElement.getHeader().getUUID();
|
||||
String ret = update(identifiableElementTypeName, json, uuid);
|
||||
return (IE) ElementMapper.unmarshal(Element.class, ret);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -250,10 +251,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String update(String erType, String er) throws NotFoundException, ResourceRegistryException {
|
||||
public String update(String identifiableElementTypeName, String json) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
UUID uuid = Utility.getUUIDFromJSONString(er);
|
||||
return update(erType, er, uuid);
|
||||
UUID uuid = Utility.getUUIDFromJSONString(json);
|
||||
return update(identifiableElementTypeName, json, uuid);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -264,10 +265,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String update(String er) throws NotFoundException, ResourceRegistryException {
|
||||
public String update(String json) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getClassFromJsonString(er);
|
||||
return update(erType, er);
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getClassFromJsonString(json);
|
||||
return update(identifiableElementTypeName, json);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -278,11 +279,11 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public <E extends ER> boolean delete(E er) throws NotFoundException, ResourceRegistryException {
|
||||
public <IE extends IdentifiableElement> boolean delete(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getType(er);
|
||||
UUID uuid = er.getHeader().getUUID();
|
||||
return delete(erType, uuid);
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
|
||||
UUID uuid = identifiableElement.getHeader().getUUID();
|
||||
return delete(identifiableElementTypeName, uuid);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -293,14 +294,14 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(String erType, UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
public boolean delete(String identifiableElementTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to delete {} with UUID {}", erType, uuid);
|
||||
logger.trace("Going to delete {} with UUID {}", identifiableElementTypeName, uuid);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryPublisher.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(InstancePath.INSTANCES_PATH_PART);
|
||||
gxHTTPStringRequest.path(erType);
|
||||
gxHTTPStringRequest.path(identifiableElementTypeName);
|
||||
gxHTTPStringRequest.path(uuid.toString());
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.delete();
|
||||
|
@ -308,7 +309,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
|
||||
boolean deleted = true;
|
||||
|
||||
logger.info("{} with UUID {} {}", erType, uuid, deleted ? " successfully deleted" : "was NOT deleted");
|
||||
logger.info("{} with UUID {} {}", identifiableElementTypeName, uuid, deleted ? " successfully deleted" : "was NOT deleted");
|
||||
return deleted;
|
||||
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
@ -336,8 +337,8 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String readFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException {
|
||||
return read(facetType, uuid);
|
||||
public String readFacet(String facetTypeName, UUID uuid) throws FacetNotFoundException, ResourceRegistryException {
|
||||
return read(facetTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -356,8 +357,8 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException {
|
||||
return delete(facetType, uuid);
|
||||
public boolean deleteFacet(String facetTypeName, UUID uuid) throws FacetNotFoundException, ResourceRegistryException {
|
||||
return delete(facetTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -377,9 +378,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String readResource(String resourceType, UUID uuid)
|
||||
public String readResource(String resourceTypeName, UUID uuid)
|
||||
throws ResourceNotFoundException, ResourceRegistryException {
|
||||
return read(resourceType, uuid);
|
||||
return read(resourceTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -400,9 +401,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteResource(String resourceType, UUID uuid)
|
||||
public boolean deleteResource(String resourceTypeName, UUID uuid)
|
||||
throws ResourceNotFoundException, ResourceRegistryException {
|
||||
return delete(resourceType, uuid);
|
||||
return delete(resourceTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -423,8 +424,8 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String readConsistsOf(String consistsOfType, UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
return read(consistsOfType, uuid);
|
||||
public String readConsistsOf(String consistsOfTypeName, UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
return read(consistsOfTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -445,8 +446,8 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteConsistsOf(String consistsOfType, UUID uuid) throws ResourceRegistryException {
|
||||
return delete(consistsOfType, uuid);
|
||||
public boolean deleteConsistsOf(String consistsOfTypeName, UUID uuid) throws ResourceRegistryException {
|
||||
return delete(consistsOfTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -467,9 +468,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public String readIsRelatedTo(String isRelatedToType, UUID uuid)
|
||||
public String readIsRelatedTo(String isRelatedToTypeName, UUID uuid)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
return read(isRelatedToType, uuid);
|
||||
return read(isRelatedToTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -490,28 +491,28 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid) throws ResourceRegistryException {
|
||||
return delete(isRelatedToType, uuid);
|
||||
public boolean deleteIsRelatedTo(String isRelatedToTypeName, UUID uuid) throws ResourceRegistryException {
|
||||
return delete(isRelatedToTypeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addToContext(UUID contextUUID, String erType, UUID instanceUUID)
|
||||
public boolean addToContext(UUID contextUUID, String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", erType, instanceUUID, Context.NAME,
|
||||
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", identifiableElementTypeName, instanceUUID, Context.NAME,
|
||||
contextUUID);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryPublisher.class.getSimpleName());
|
||||
gxHTTPStringRequest.path(SharingPath.SHARING_PATH_PART);
|
||||
gxHTTPStringRequest.path(SharingPath.CONTEXTS_PATH_PART);
|
||||
gxHTTPStringRequest.path(contextUUID.toString());
|
||||
gxHTTPStringRequest.path(erType);
|
||||
gxHTTPStringRequest.path(identifiableElementTypeName);
|
||||
gxHTTPStringRequest.path(instanceUUID.toString());
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.put();
|
||||
boolean added = HTTPUtility.getResponse(Boolean.class, httpURLConnection);
|
||||
|
||||
logger.info("{} with UUID {} {} to {} with UUID {}", erType, instanceUUID,
|
||||
logger.info("{} with UUID {} {} to {} with UUID {}", identifiableElementTypeName, instanceUUID,
|
||||
added ? " successfully added" : "was NOT added", Context.NAME, contextUUID);
|
||||
return added;
|
||||
|
||||
|
@ -525,12 +526,12 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public <E extends ER> boolean addToContext(UUID contextUUID, E er)
|
||||
public <IE extends IdentifiableElement> boolean addToContext(UUID contextUUID, IE identifiableElement)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getType(er);
|
||||
UUID instanceUUID = er.getHeader().getUUID();
|
||||
return addToContext(contextUUID, erType, instanceUUID);
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
|
||||
UUID instanceUUID = identifiableElement.getHeader().getUUID();
|
||||
return addToContext(contextUUID, identifiableElementTypeName, instanceUUID);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -541,36 +542,36 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addToCurrentContext(String erType, UUID instanceUUID)
|
||||
public boolean addToCurrentContext(String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
UUID contextUUID = getCurrentContextUUID();
|
||||
return addToContext(contextUUID, erType, instanceUUID);
|
||||
return addToContext(contextUUID, identifiableElementTypeName, instanceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends ER> boolean addToCurrentContext(E er) throws NotFoundException, ResourceRegistryException {
|
||||
public <IE extends IdentifiableElement> boolean addToCurrentContext(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
|
||||
UUID contextUUID = getCurrentContextUUID();
|
||||
return addToContext(contextUUID, er);
|
||||
return addToContext(contextUUID, identifiableElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFromContext(UUID contextUUID, String erType, UUID instanceUUID)
|
||||
public boolean removeFromContext(UUID contextUUID, String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", erType, instanceUUID, Context.NAME,
|
||||
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", identifiableElementTypeName, instanceUUID, Context.NAME,
|
||||
contextUUID);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryPublisher.class.getSimpleName());
|
||||
gxHTTPStringRequest.path(SharingPath.SHARING_PATH_PART);
|
||||
gxHTTPStringRequest.path(SharingPath.CONTEXTS_PATH_PART);
|
||||
gxHTTPStringRequest.path(contextUUID.toString());
|
||||
gxHTTPStringRequest.path(erType);
|
||||
gxHTTPStringRequest.path(identifiableElementTypeName);
|
||||
gxHTTPStringRequest.path(instanceUUID.toString());
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.delete();
|
||||
boolean removed = HTTPUtility.getResponse(Boolean.class, httpURLConnection);
|
||||
|
||||
logger.info("{} with UUID {} {} to {} with UUID {}", erType, instanceUUID,
|
||||
logger.info("{} with UUID {} {} to {} with UUID {}", identifiableElementTypeName, instanceUUID,
|
||||
removed ? " successfully removed" : "was NOT removed", Context.NAME, contextUUID);
|
||||
return removed;
|
||||
|
||||
|
@ -584,12 +585,12 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public <E extends ER> boolean removeFromContext(UUID contextUUID, E er)
|
||||
public <IE extends IdentifiableElement> boolean removeFromContext(UUID contextUUID, IE identifiableElement)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String erType = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getType(er);
|
||||
UUID instanceUUID = er.getHeader().getUUID();
|
||||
return removeFromContext(contextUUID, erType, instanceUUID);
|
||||
String identifiableElementTypeName = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
|
||||
UUID instanceUUID = identifiableElement.getHeader().getUUID();
|
||||
return removeFromContext(contextUUID, identifiableElementTypeName, instanceUUID);
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error Creating {}", facet, e);
|
||||
throw e;
|
||||
|
@ -600,23 +601,23 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFromCurrentContext(String erType, UUID instanceUUID)
|
||||
public boolean removeFromCurrentContext(String identifiableElementTypeName, UUID instanceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
UUID contextUUID = getCurrentContextUUID();
|
||||
return removeFromContext(contextUUID, erType, instanceUUID);
|
||||
return removeFromContext(contextUUID, identifiableElementTypeName, instanceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends ER> boolean removeFromCurrentContext(E er)
|
||||
public <IE extends IdentifiableElement> boolean removeFromCurrentContext(IE identifiableElement)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
UUID contextUUID = getCurrentContextUUID();
|
||||
return removeFromContext(contextUUID, er);
|
||||
return removeFromContext(contextUUID, identifiableElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addResourceToContext(UUID contextUUID, String resourceType, UUID resourceUUID)
|
||||
public boolean addResourceToContext(UUID contextUUID, String resourceTypeName, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return addToContext(contextUUID, resourceType, resourceUUID);
|
||||
return addToContext(contextUUID, resourceTypeName, resourceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -626,9 +627,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addResourceToCurrentContext(String resourceType, UUID resourceUUID)
|
||||
public boolean addResourceToCurrentContext(String resourceTypeName, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return addToCurrentContext(resourceType, resourceUUID);
|
||||
return addToCurrentContext(resourceTypeName, resourceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -638,9 +639,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removeResourceFromContext(UUID contextUUID, String resourceType, UUID resourceUUID)
|
||||
public boolean removeResourceFromContext(UUID contextUUID, String resourceTypeName, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return removeFromContext(contextUUID, resourceType, resourceUUID);
|
||||
return removeFromContext(contextUUID, resourceTypeName, resourceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -650,9 +651,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removeResourceFromCurrentContext(String resourceType, UUID resourceUUID)
|
||||
public boolean removeResourceFromCurrentContext(String resourceTypeName, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return removeFromCurrentContext(resourceType, resourceUUID);
|
||||
return removeFromCurrentContext(resourceTypeName, resourceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -662,9 +663,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addFacetToContext(UUID contextUUID, String facetType, UUID facetUUID)
|
||||
public boolean addFacetToContext(UUID contextUUID, String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return addToContext(contextUUID, facetType, facetUUID);
|
||||
return addToContext(contextUUID, facetTypeName, facetUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -674,9 +675,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addFacetToCurrentContext(String facetType, UUID facetUUID)
|
||||
public boolean addFacetToCurrentContext(String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return addToCurrentContext(facetType, facetUUID);
|
||||
return addToCurrentContext(facetTypeName, facetUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -686,9 +687,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFacetFromContext(UUID contextUUID, String facetType, UUID facetUUID)
|
||||
public boolean removeFacetFromContext(UUID contextUUID, String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return removeFromContext(contextUUID, facetType, facetUUID);
|
||||
return removeFromContext(contextUUID, facetTypeName, facetUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -698,9 +699,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID)
|
||||
public boolean removeFacetFromCurrentContext(String facetTypeName, UUID facetUUID)
|
||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||
return removeFromCurrentContext(facetType, facetUUID);
|
||||
return removeFromCurrentContext(facetTypeName, facetUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
|
|||
import org.gcube.informationsystem.resourceregistry.client.Direction;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.EventFacetImpl;
|
||||
|
@ -91,16 +91,16 @@ public class ERManagementTest extends ContextTest {
|
|||
UUID eServiceUUID = receivedEservice.getHeader().getUUID();
|
||||
UUID facetUUID = receivedFacet.getHeader().getUUID();
|
||||
|
||||
logger.debug("Created {} : {}", EService.NAME, ISMapper.marshal(receivedEservice));
|
||||
logger.debug("Created {} : {}", EService.NAME, ElementMapper.marshal(receivedEservice));
|
||||
|
||||
for(int i=0; i<10; i++) {
|
||||
try {
|
||||
if(i%2==0) {
|
||||
receivedEservice = resourceRegistryPublisher.update(receivedEservice);
|
||||
logger.debug("Updated {} : {}", EService.NAME, ISMapper.marshal(receivedEservice));
|
||||
logger.debug("Updated {} : {}", EService.NAME, ElementMapper.marshal(receivedEservice));
|
||||
}else {
|
||||
receivedEservice = resourceRegistryPublisher.read(receivedEservice);
|
||||
logger.debug("Read {} : {}", EService.NAME, ISMapper.marshal(receivedEservice));
|
||||
logger.debug("Read {} : {}", EService.NAME, ElementMapper.marshal(receivedEservice));
|
||||
}
|
||||
UUID receivedEServiceUUID = receivedEservice.getHeader().getUUID();
|
||||
Assert.assertTrue(eServiceUUID.compareTo(receivedEServiceUUID)==0);
|
||||
|
@ -234,11 +234,11 @@ public class ERManagementTest extends ContextTest {
|
|||
new URL("https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
|
||||
eService.addFacet(licenseFacet);
|
||||
|
||||
String json = ISMapper.marshal(eService);
|
||||
String json = ElementMapper.marshal(eService);
|
||||
|
||||
String createdString = resourceRegistryPublisher.createResource(json);
|
||||
|
||||
EService created = ISMapper.unmarshal(EService.class, createdString);
|
||||
EService created = ElementMapper.unmarshal(EService.class, createdString);
|
||||
|
||||
boolean deleted = resourceRegistryPublisher.deleteResource(created);
|
||||
Assert.assertTrue(deleted);
|
||||
|
@ -487,7 +487,7 @@ public class ERManagementTest extends ContextTest {
|
|||
/* Getting all instances of created specific Resources */
|
||||
for(String key : resources.keySet()) {
|
||||
String instances = resourceRegistryClient.getInstances(key, false);
|
||||
List<Resource> list = ISMapper.unmarshalList(Resource.class, instances);
|
||||
List<Resource> list = ElementMapper.unmarshalList(Resource.class, instances);
|
||||
logger.debug("{} are {} : {} ", key, list.size(), list);
|
||||
Assert.assertTrue(list.size() == MAX);
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ public class ERManagementTest extends ContextTest {
|
|||
activates = resourceRegistryPublisher.createIsRelatedTo(activates);
|
||||
hostingNode.attachResource(activates);
|
||||
|
||||
logger.debug("Created {} is {}", Activates.NAME, ISMapper.marshal(activates));
|
||||
logger.debug("Created {} is {}", Activates.NAME, ElementMapper.marshal(activates));
|
||||
|
||||
boolean deleted = resourceRegistryPublisher.deleteResource(hostingNode);
|
||||
Assert.assertTrue(deleted);
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.UUID;
|
|||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
|
||||
|
@ -84,9 +84,9 @@ public class EntityManagementTest extends ContextTest {
|
|||
cpuFacet.setModel("Opteron");
|
||||
cpuFacet.setVendor("AMD");
|
||||
|
||||
String createdCpuFacetString = resourceRegistryPublisher.createFacet(ISMapper.marshal(cpuFacet));
|
||||
String createdCpuFacetString = resourceRegistryPublisher.createFacet(ElementMapper.marshal(cpuFacet));
|
||||
|
||||
CPUFacet createdCpuFacet = ISMapper.unmarshal(CPUFacet.class, createdCpuFacetString);
|
||||
CPUFacet createdCpuFacet = ElementMapper.unmarshal(CPUFacet.class, createdCpuFacetString);
|
||||
|
||||
Assert.assertTrue(cpuFacet.getClockSpeed().compareTo(createdCpuFacet.getClockSpeed())==0);
|
||||
Assert.assertTrue(cpuFacet.getModel().compareTo(createdCpuFacet.getModel())==0);
|
||||
|
@ -103,9 +103,9 @@ public class EntityManagementTest extends ContextTest {
|
|||
String additionPropertyValue = "Test";
|
||||
createdCpuFacet.setAdditionalProperty(additionPropertyKey, additionPropertyValue);
|
||||
|
||||
String updatedCpuFacetString = resourceRegistryPublisher.updateFacet(ISMapper.marshal(createdCpuFacet));
|
||||
String updatedCpuFacetString = resourceRegistryPublisher.updateFacet(ElementMapper.marshal(createdCpuFacet));
|
||||
|
||||
CPUFacet updatedCpuFacet = ISMapper.unmarshal(CPUFacet.class, updatedCpuFacetString);
|
||||
CPUFacet updatedCpuFacet = ElementMapper.unmarshal(CPUFacet.class, updatedCpuFacetString);
|
||||
Assert.assertTrue(createdCpuFacet.getClockSpeed().compareTo(updatedCpuFacet.getClockSpeed())==0);
|
||||
Assert.assertTrue(createdCpuFacet.getModel().compareTo(updatedCpuFacet.getModel())==0);
|
||||
Assert.assertTrue(createdCpuFacet.getVendor().compareTo(updatedCpuFacet.getVendor())==0);
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
|
|||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.ContainerStateFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.MemoryFacetImpl;
|
||||
|
@ -77,7 +77,7 @@ public class SmartgearResourcesTest extends ContextTest {
|
|||
|
||||
@Test
|
||||
public void testHostingNode() throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException{
|
||||
HostingNode hostingNode = ISMapper.unmarshal(HostingNode.class, HOSTING_NODE);
|
||||
HostingNode hostingNode = ElementMapper.unmarshal(HostingNode.class, HOSTING_NODE);
|
||||
logger.debug("Going to create {}", hostingNode);
|
||||
|
||||
hostingNode = resourceRegistryPublisher.createResource(hostingNode);
|
||||
|
@ -93,7 +93,7 @@ public class SmartgearResourcesTest extends ContextTest {
|
|||
|
||||
@Test
|
||||
public void testEService() throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException{
|
||||
EService eService = ISMapper.unmarshal(EService.class, ESERVICE);
|
||||
EService eService = ElementMapper.unmarshal(EService.class, ESERVICE);
|
||||
logger.debug("Going to create {}", eService);
|
||||
|
||||
eService = resourceRegistryPublisher.createResource(eService);
|
||||
|
|
Loading…
Reference in New Issue