Fixed imports and class name due to IS Model refactoring
This commit is contained in:
parent
81785941f2
commit
62b11a4691
|
@ -21,7 +21,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationAvailableInAnotherContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class HTTPUtility {
|
|||
if(Boolean.class.isAssignableFrom(clz)) {
|
||||
return (C) ((Boolean) Boolean.valueOf(res));
|
||||
} else if(Element.class.isAssignableFrom(clz)) {
|
||||
return (C) ISMapper.unmarshal((Class<Element>) clz, res);
|
||||
return (C) ElementMapper.unmarshal((Class<Element>) clz, res);
|
||||
}
|
||||
|
||||
return (C) res;
|
||||
|
|
|
@ -3,10 +3,10 @@ package org.gcube.informationsystem.resourceregistry.api.utils;
|
|||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
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.types.TypeBinder;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
@ -19,12 +19,12 @@ public abstract class Utility {
|
|||
}
|
||||
|
||||
public static String getClassFromJsonString(String json) throws JsonProcessingException, IOException{
|
||||
JsonNode jsonNode = ISMapper.getObjectMapper().readTree(json);
|
||||
JsonNode jsonNode = ElementMapper.getObjectMapper().readTree(json);
|
||||
return getClassFromJsonNode(jsonNode);
|
||||
}
|
||||
|
||||
public static String getUUIDStringFromJsonNode(JsonNode jsonNode){
|
||||
return jsonNode.get(ER.HEADER_PROPERTY).get(Element.CLASS_PROPERTY).asText();
|
||||
return jsonNode.get(IdentifiableElement.HEADER_PROPERTY).get(Element.CLASS_PROPERTY).asText();
|
||||
}
|
||||
public static UUID getUUIDFromJsonNode(JsonNode jsonNode){
|
||||
String uuidString = getUUIDStringFromJsonNode(jsonNode);
|
||||
|
@ -32,20 +32,23 @@ public abstract class Utility {
|
|||
}
|
||||
|
||||
public static String getUUIDStringFromJsonString(String json) throws JsonProcessingException, IOException{
|
||||
JsonNode jsonNode = ISMapper.getObjectMapper().readTree(json);
|
||||
JsonNode jsonNode = ElementMapper.getObjectMapper().readTree(json);
|
||||
return getUUIDStringFromJsonNode(jsonNode);
|
||||
}
|
||||
|
||||
public static UUID getUUIDFromJsonString(String json) throws JsonProcessingException, IOException{
|
||||
JsonNode jsonNode = ISMapper.getObjectMapper().readTree(json);
|
||||
JsonNode jsonNode = ElementMapper.getObjectMapper().readTree(json);
|
||||
return getUUIDFromJsonNode(jsonNode);
|
||||
}
|
||||
|
||||
public static String getType(Element isManageable){
|
||||
return getType(isManageable.getClass());
|
||||
|
||||
// TODO move somewhere else, probably in Element
|
||||
|
||||
public static String getTypeName(Element element){
|
||||
return getTypeName(element.getClass());
|
||||
}
|
||||
|
||||
public static String getType(Class<? extends Element> clz){
|
||||
public static <E extends Element> String getTypeName(Class<E> clz){
|
||||
if(!clz.isInterface()){
|
||||
return clz.getAnnotation(JsonTypeName.class).value();
|
||||
}else {
|
||||
|
|
Loading…
Reference in New Issue