Reorganizing model
This commit is contained in:
parent
fa2e3d5983
commit
a9a1ab83ce
|
@ -3,8 +3,11 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.base.impl;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
|
@ -34,4 +37,20 @@ public abstract class ERImpl extends ISManageableImpl implements ER {
|
|||
public void setHeader(Header header){
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
try {
|
||||
ISMapper.marshal(this, stringWriter);
|
||||
return stringWriter.toString();
|
||||
}catch(Exception e){
|
||||
try {
|
||||
ISMapper.marshal(this.header, stringWriter);
|
||||
return stringWriter.toString();
|
||||
} catch(Exception e1){
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.base.impl;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
@ -19,4 +22,15 @@ public class ISManageableImpl implements ISManageable {
|
|||
public ISManageableImpl(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
try {
|
||||
ISMapper.marshal(this, stringWriter);
|
||||
return stringWriter.toString();
|
||||
}catch(Exception e){
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package org.gcube.informationsystem.base.impl.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.ISManageableImpl;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=BaseProperty.NAME)
|
||||
public class BasePropertyImpl extends ISManageableImpl implements Property {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 1396998430221747445L;
|
||||
|
||||
public BasePropertyImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.model.impl.properties;
|
||||
package org.gcube.informationsystem.base.impl.properties;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=Header.NAME)
|
||||
public class HeaderImpl extends PropertyImpl implements Header {
|
||||
public final class HeaderImpl extends BasePropertyImpl implements Header {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
|
@ -1,14 +1,15 @@
|
|||
package org.gcube.informationsystem.base.impl.relations;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.ERImpl;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
|
||||
public abstract class BaseRelationImpl<Out extends BaseEntity, In extends BaseEntity> extends RImpl<Out,In> implements BaseRelation<Out, In> {
|
||||
public abstract class BaseRelationImpl<Out extends BaseEntity, In extends BaseEntity> extends ERImpl implements BaseRelation<Out, In> {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 5789078326714392972L;
|
||||
private static final long serialVersionUID = 28704968813390512L;
|
||||
|
||||
protected Out source;
|
||||
protected In target;
|
||||
|
@ -18,7 +19,29 @@ public abstract class BaseRelationImpl<Out extends BaseEntity, In extends BaseEn
|
|||
}
|
||||
|
||||
protected BaseRelationImpl(Out source, In target) {
|
||||
super(source, target);
|
||||
this();
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Out getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSource(Out source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public In getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTarget(In target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package org.gcube.informationsystem.base.impl.relations;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.ERImpl;
|
||||
import org.gcube.informationsystem.base.reference.entities.E;
|
||||
import org.gcube.informationsystem.base.reference.relations.R;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
|
||||
public abstract class RImpl<Out extends E, In extends E> extends ERImpl implements R<Out, In> {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 28704968813390512L;
|
||||
|
||||
protected Out source;
|
||||
protected In target;
|
||||
|
||||
protected RImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected RImpl(Out source, In target) {
|
||||
this();
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Out getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSource(Out source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public In getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTarget(In target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
try {
|
||||
ISMapper.marshal(this, stringWriter);
|
||||
return stringWriter.toString();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
ISMapper.marshal(this.header, stringWriter);
|
||||
return stringWriter.toString();
|
||||
} catch (Exception e1) {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ package org.gcube.informationsystem.base.reference;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.context.impl.entities.ContextImpl;
|
||||
import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
|
@ -25,6 +24,7 @@ import org.gcube.informationsystem.model.impl.relations.RelationImpl;
|
|||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.informationsystem.base.reference.entities;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
@ -7,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||
@Abstract
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
//@JsonDeserialize(as=BaseEntityImpl.class) Do not uncomment to manage subclasses
|
||||
public interface BaseEntity extends E {
|
||||
public interface BaseEntity extends ER {
|
||||
|
||||
public static final String NAME = "BaseEntity"; //Entity.class.getSimpleName();
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package org.gcube.informationsystem.base.reference.entities;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@Abstract
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
//@JsonDeserialize(as=EImpl.class) Do not uncomment to manage subclasses
|
||||
public interface E extends ER {
|
||||
|
||||
public static final String NAME = "E"; // Entity.class.getSimpleName();
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.informationsystem.base.reference.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
* Root Class for Property types. It creates a base common type, which is useful
|
||||
* for management purpose.
|
||||
*/
|
||||
// @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = ISManageable.CLASS_PROPERTY)
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
public interface BaseProperty extends ISManageable {
|
||||
|
||||
public static final String NAME = "BaseProperty"; //BaseProperty.class.getSimpleName();
|
||||
public static final String DESCRIPTION = "This is the very base class for Property";
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
|
@ -6,8 +6,8 @@ package org.gcube.informationsystem.base.reference.properties;
|
|||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.base.reference.ISConstants;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
@ -18,7 +18,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Header
|
||||
*/
|
||||
@JsonDeserialize(as=HeaderImpl.class)
|
||||
public interface Header extends Property {
|
||||
public interface Header extends BaseProperty {
|
||||
|
||||
public static final String NAME = "Header"; // Header.class.getSimpleName();
|
||||
|
||||
|
|
|
@ -1,12 +1,38 @@
|
|||
package org.gcube.informationsystem.base.reference.relations;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
@Abstract
|
||||
//@JsonDeserialize(as=BaseRelationImpl.class) Do not uncomment to manage subclasses
|
||||
public interface BaseRelation<Out extends BaseEntity, In extends BaseEntity> extends R<Out,In> {
|
||||
public interface BaseRelation<Out extends BaseEntity, In extends BaseEntity> extends ER {
|
||||
|
||||
public static final String NAME = "BaseRelation"; // BaseRelation.class.getSimpleName();
|
||||
|
||||
public static final String SOURCE_PROPERTY = "source";
|
||||
public static final String TARGET_PROPERTY = "target";
|
||||
|
||||
/* Overriding getHeader method to create Header property in type */
|
||||
@ISProperty(name = HEADER_PROPERTY, mandatory = true, nullable = false)
|
||||
@Override
|
||||
public Header getHeader();
|
||||
|
||||
@JsonGetter(value=SOURCE_PROPERTY)
|
||||
public Out getSource();
|
||||
|
||||
@JsonIgnore
|
||||
public void setSource(Out source);
|
||||
|
||||
@JsonGetter(value=TARGET_PROPERTY)
|
||||
public In getTarget();
|
||||
|
||||
@JsonIgnore
|
||||
public void setTarget(In target);
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package org.gcube.informationsystem.base.reference.relations;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.entities.E;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
@Abstract
|
||||
//@JsonDeserialize(as=RImpl.class) Do not uncomment to manage subclasses
|
||||
public interface R<Out extends E, In extends E> extends ER {
|
||||
|
||||
public static final String NAME = "R"; // R.class.getSimpleName();
|
||||
|
||||
public static final String SOURCE_PROPERTY = "source";
|
||||
public static final String TARGET_PROPERTY = "target";
|
||||
|
||||
/* Overriding getHeader method to create Header property in type */
|
||||
@ISProperty(name = HEADER_PROPERTY, mandatory = true, nullable = false)
|
||||
@Override
|
||||
public Header getHeader();
|
||||
|
||||
@JsonGetter(value=SOURCE_PROPERTY)
|
||||
public Out getSource();
|
||||
|
||||
@JsonIgnore
|
||||
public void setSource(Out source);
|
||||
|
||||
@JsonGetter(value=TARGET_PROPERTY)
|
||||
public In getTarget();
|
||||
|
||||
@JsonIgnore
|
||||
public void setTarget(In target);
|
||||
|
||||
}
|
|
@ -8,10 +8,10 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.entities.BaseEntityImpl;
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.informationsystem.model.impl.entities;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.informationsystem.model.impl.entities;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.model.impl.entities;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.entities.BaseEntityImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
|
@ -27,20 +24,4 @@ public abstract class EntityImpl extends BaseEntityImpl implements Entity {
|
|||
this.header = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
try {
|
||||
ISMapper.marshal(this, stringWriter);
|
||||
return stringWriter.toString();
|
||||
}catch(Exception e){
|
||||
try {
|
||||
ISMapper.marshal(this.header, stringWriter);
|
||||
return stringWriter.toString();
|
||||
} catch(Exception e1){
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.model.impl.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
package org.gcube.informationsystem.model.impl.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.ISManageableImpl;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.informationsystem.base.impl.relations.BaseRelationImpl;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.gcube.informationsystem.model.reference.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.model.reference.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.base.reference.properties;
|
||||
package org.gcube.informationsystem.model.reference.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
|
@ -12,10 +12,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||
* Root Class for Property types. It creates a base common type, which is useful
|
||||
* for management purpose.
|
||||
*/
|
||||
|
||||
// @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = ISManageable.CLASS_PROPERTY)
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
public interface Property extends ISManageable {
|
||||
public interface Property extends BaseProperty {
|
||||
|
||||
public static final String NAME = "Property"; //Property.class.getSimpleName();
|
||||
public static final String DESCRIPTION = "This is the base class for Property";
|
|
@ -30,8 +30,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
|
||||
/**
|
||||
* @author Lucio Lelii (ISTI - CNR)
|
||||
|
@ -80,7 +79,7 @@ public class Type {
|
|||
private String stringValue;
|
||||
private int intValue;
|
||||
|
||||
OType(String stringValue, int intValue){
|
||||
OType(String stringValue, int intValue) {
|
||||
this.stringValue = stringValue;
|
||||
this.intValue = intValue;
|
||||
}
|
||||
|
@ -95,9 +94,9 @@ public class Type {
|
|||
|
||||
}
|
||||
|
||||
protected static final Map<Class<?>, OType> TYPES_BY_CLASS = new HashMap<Class<?>, OType>();
|
||||
protected static final Map<Class<?>,OType> TYPES_BY_CLASS = new HashMap<Class<?>,OType>();
|
||||
|
||||
static{
|
||||
static {
|
||||
|
||||
// This is made by hand because not all types should be add.
|
||||
TYPES_BY_CLASS.put(Boolean.TYPE, OType.BOOLEAN);
|
||||
|
@ -140,7 +139,6 @@ public class Type {
|
|||
TYPES_BY_CLASS.put(byte[].class, OType.BYNARY);
|
||||
TYPES_BY_CLASS.put(Byte[].class, OType.BYNARY);
|
||||
|
||||
|
||||
TYPES_BY_CLASS.put(Enum.class, OType.STRING);
|
||||
TYPES_BY_CLASS.put(URI.class, OType.STRING);
|
||||
TYPES_BY_CLASS.put(URL.class, OType.STRING);
|
||||
|
@ -156,19 +154,17 @@ public class Type {
|
|||
* @return OType instance if found, otherwise null
|
||||
*/
|
||||
public static OType getTypeByClass(final Class<?> iClass) {
|
||||
if (iClass == null) {
|
||||
if(iClass == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OType type = TYPES_BY_CLASS.get(iClass);
|
||||
|
||||
if(type==null && Enum.class.isAssignableFrom(iClass)){
|
||||
if(type == null && Enum.class.isAssignableFrom(iClass)) {
|
||||
type = TYPES_BY_CLASS.get(Enum.class);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.types.impl.entities.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
|
@ -18,36 +17,38 @@ public class TypeBinder {
|
|||
|
||||
private final static String NAME = "NAME";
|
||||
|
||||
public static String serializeTypeDefinition(TypeDefinition typeDefinition) throws Exception{
|
||||
public static <ISM extends ISManageable> String serializeTypeDefinition(TypeDefinition<ISM> typeDefinition) throws Exception{
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String json = mapper.writeValueAsString(typeDefinition);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static String serializeType(Class<? extends ISManageable> type) throws Exception{
|
||||
TypeDefinition typeDefinition = createTypeDefinition(type);
|
||||
public static <ISM extends ISManageable> String serializeType(Class<ISM> type) throws Exception{
|
||||
TypeDefinition<ISM> typeDefinition = createTypeDefinition(type);
|
||||
return serializeTypeDefinition(typeDefinition);
|
||||
}
|
||||
|
||||
public static TypeDefinition deserializeTypeDefinition(String json) throws Exception{
|
||||
public static <ISM extends ISManageable> TypeDefinition<ISM> deserializeTypeDefinition(String json) throws Exception{
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
return mapper.readValue(json, TypeDefinition.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
TypeDefinition<ISM> readValue = mapper.readValue(json, TypeDefinition.class);
|
||||
return readValue;
|
||||
}
|
||||
|
||||
public static String serializeTypeDefinitions(List<TypeDefinition> typeDefinitions) throws Exception{
|
||||
public static <ISM extends ISManageable> String serializeTypeDefinitions(List<TypeDefinition<ISM>> typeDefinitions) throws Exception{
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String json = mapper.writeValueAsString(typeDefinitions);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static List<TypeDefinition> deserializeTypeDefinitions(String json) throws Exception{
|
||||
public static <ISM extends ISManageable> List<TypeDefinition<ISM>> deserializeTypeDefinitions(String json) throws Exception{
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, TypeDefinition.class) ;
|
||||
return mapper.readValue(json, type);
|
||||
}
|
||||
|
||||
public static TypeDefinition createTypeDefinition(Class<? extends ISManageable> clz) {
|
||||
TypeDefinition typeDefinition = new TypeDefinitionImpl(clz);
|
||||
public static <ISM extends ISManageable> TypeDefinition<ISM> createTypeDefinition(Class<ISM> clz) {
|
||||
TypeDefinition<ISM> typeDefinition = TypeDefinitionImpl.getInstance(clz);
|
||||
return typeDefinition;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
package org.gcube.informationsystem.types.impl.entities;
|
||||
package org.gcube.informationsystem.types;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.ERImpl;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -24,18 +24,19 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
public class TypeDefinitionImpl implements TypeDefinition {
|
||||
public abstract class TypeDefinitionImpl<ISM extends ISManageable> extends ERImpl implements TypeDefinition<ISM> {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 2698204820689338513L;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(TypeDefinitionImpl.class);
|
||||
|
||||
private static final String EDGE_CLASS_NAME = "E";
|
||||
private static final String VERTEX_CLASS_NAME = "V";
|
||||
|
||||
private final static String DESCRIPTION = "DESCRIPTION";
|
||||
|
||||
protected String name;
|
||||
|
@ -45,12 +46,7 @@ public class TypeDefinitionImpl implements TypeDefinition {
|
|||
protected Set<String> superClasses;
|
||||
protected Set<PropertyDefinition> properties;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
protected String sourceType;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
protected String targetType;
|
||||
|
||||
private static Set<String> retrieveSuperClasses(Class<? extends ISManageable> type, Class<? extends ISManageable> baseClass, String topSuperClass){
|
||||
protected static <ISM extends ISManageable> Set<String> retrieveSuperClasses(Class<? extends ISM> type, Class<ISM> baseClass, String topSuperClass){
|
||||
Set<String> interfaceList = new HashSet<>();
|
||||
|
||||
if(type==baseClass){
|
||||
|
@ -92,14 +88,27 @@ public class TypeDefinitionImpl implements TypeDefinition {
|
|||
return properties;
|
||||
}
|
||||
|
||||
private static Class<?> getGenericClass(java.lang.reflect.Type type){
|
||||
protected static Class<?> getGenericClass(java.lang.reflect.Type type){
|
||||
TypeVariable<?> typeVariable = (TypeVariable<?>) type;
|
||||
java.lang.reflect.Type[] bounds = typeVariable.getBounds();
|
||||
java.lang.reflect.Type t = bounds[0];
|
||||
return (Class<?>) t;
|
||||
}
|
||||
|
||||
public TypeDefinitionImpl(Class<? extends ISManageable> clz) {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static <ISM extends ISManageable> TypeDefinition<ISM> getInstance(Class<ISM> clz) {
|
||||
if(BaseEntity.class.isAssignableFrom(clz)) {
|
||||
return new EntityTypeDefinitionImpl(clz);
|
||||
} else if(BaseRelation.class.isAssignableFrom(clz)){
|
||||
return new RelationTypeDefinitionImpl(clz);
|
||||
} else if(BaseProperty.class.isAssignableFrom(clz)){
|
||||
return new PropertyTypeDefinitionImpl(clz);
|
||||
} else {
|
||||
throw new RuntimeException("Serialization required");
|
||||
}
|
||||
}
|
||||
|
||||
protected TypeDefinitionImpl(Class<ISM> clz) {
|
||||
this.name = TypeBinder.getType(clz);
|
||||
this.description = TypeBinder.getStaticStringFieldByName(clz, DESCRIPTION, "");
|
||||
this.abstractType = false;
|
||||
|
@ -108,40 +117,6 @@ public class TypeDefinitionImpl implements TypeDefinition {
|
|||
this.abstractType = true;
|
||||
}
|
||||
|
||||
if(Entity.class.isAssignableFrom(clz)) {
|
||||
if(Resource.class.isAssignableFrom(clz)){
|
||||
this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME);
|
||||
}else{
|
||||
if(Facet.class.isAssignableFrom(clz)){
|
||||
this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME);
|
||||
} else {
|
||||
this.superClasses = retrieveSuperClasses(clz, Entity.class, VERTEX_CLASS_NAME);
|
||||
}
|
||||
}
|
||||
} else if(Relation.class.isAssignableFrom(clz)){
|
||||
if(IsRelatedTo.class.isAssignableFrom(clz)){
|
||||
this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME);
|
||||
} else if(ConsistsOf.class.isAssignableFrom(clz)) {
|
||||
this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME);
|
||||
} else {
|
||||
this.superClasses = retrieveSuperClasses(clz, Relation.class, EDGE_CLASS_NAME);
|
||||
}
|
||||
|
||||
java.lang.reflect.Type[] typeParameters = clz.getTypeParameters();
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends ISManageable> sourceClass = (Class<? extends ISManageable>) getGenericClass(typeParameters[0]);
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends ISManageable> targetClass = (Class<? extends ISManageable>) getGenericClass(typeParameters[1]);
|
||||
|
||||
this.sourceType = TypeBinder.getType(sourceClass);
|
||||
this.targetType = TypeBinder.getType(targetClass);
|
||||
|
||||
} else if(Property.class.isAssignableFrom(clz)){
|
||||
this.superClasses = retrieveSuperClasses(clz, Property.class, clz == Property.class ? null : Property.NAME);
|
||||
} else {
|
||||
throw new RuntimeException("Serialization required");
|
||||
}
|
||||
|
||||
if(!Resource.class.isAssignableFrom(clz)){
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
}
|
||||
|
@ -150,43 +125,28 @@ public class TypeDefinitionImpl implements TypeDefinition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TypeDefinition ["
|
||||
+ "name=" + name
|
||||
+ (sourceType==null ? "" : "(" + sourceType + "->" + targetType + ")")
|
||||
+ ", description=" + description
|
||||
+ ", abstract=" + abstractType
|
||||
+ ", superClasses=" + superClasses
|
||||
+ ", properties=" + properties
|
||||
+ "]";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbstract() {
|
||||
return abstractType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSuperClasses() {
|
||||
return superClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PropertyDefinition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public String getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.informationsystem.types.impl.entities;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.types.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityDefinition;
|
||||
|
||||
public class EntityTypeDefinitionImpl<E extends BaseEntity> extends TypeDefinitionImpl<E> implements EntityDefinition<E> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2614315845213942880L;
|
||||
|
||||
private static final String VERTEX_CLASS_NAME = "V";
|
||||
|
||||
public EntityTypeDefinitionImpl(Class<E> clz) {
|
||||
super(clz);
|
||||
|
||||
if(Resource.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Class<? extends Resource> c = (Class<? extends Resource>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, Resource.class, Entity.NAME);
|
||||
} else if(Facet.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Class<? extends Facet> c = (Class<? extends Facet>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, Facet.class, Entity.NAME);
|
||||
} else {
|
||||
this.superClasses = retrieveSuperClasses(clz, BaseEntity.class, VERTEX_CLASS_NAME);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -7,12 +7,12 @@ import java.net.URL;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.types.Type;
|
||||
import org.gcube.informationsystem.types.Type.OType;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -23,7 +23,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||
|
||||
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
public class PropertyDefinitionImpl implements PropertyDefinition {
|
||||
public final class PropertyDefinitionImpl implements PropertyDefinition {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = -5925314595659292025L;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(TypeDefinitionImpl.class);
|
||||
|
||||
|
@ -60,6 +65,8 @@ public class PropertyDefinitionImpl implements PropertyDefinition {
|
|||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) {
|
||||
String name = propertyAnnotation.name().isEmpty()?getPropertyNameFromMethodName(method):propertyAnnotation.name();
|
||||
this.name = name;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.gcube.informationsystem.types.impl.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.types.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefiniton;
|
||||
|
||||
public class PropertyTypeDefinitionImpl<P extends BaseProperty> extends TypeDefinitionImpl<P> implements PropertyTypeDefiniton<P> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7532701373450638829L;
|
||||
|
||||
public PropertyTypeDefinitionImpl(Class<P> clz) {
|
||||
super(clz);
|
||||
this.superClasses = retrieveSuperClasses(clz, BaseProperty.class, clz == BaseProperty.class ? null : BaseProperty.NAME);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package org.gcube.informationsystem.types.impl.relations;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
public class RelationTypeDefinitionImpl<Out extends BaseEntity, In extends BaseEntity, Rel extends BaseRelation<Out,In>>
|
||||
extends TypeDefinitionImpl<Rel> implements RelationDefinition<Out,In,Rel> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2221831081869571296L;
|
||||
|
||||
private static final String EDGE_CLASS_NAME = "E";
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
protected String sourceType;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
protected String targetType;
|
||||
|
||||
public RelationTypeDefinitionImpl(Class<Rel> clz) {
|
||||
super(clz);
|
||||
|
||||
if(IsRelatedTo.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Class<? extends IsRelatedTo> c = (Class<? extends IsRelatedTo>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, IsRelatedTo.class, Relation.NAME);
|
||||
} else if(ConsistsOf.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Class<? extends ConsistsOf> c = (Class<? extends ConsistsOf>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, ConsistsOf.class, Relation.NAME);
|
||||
} else {
|
||||
this.superClasses = retrieveSuperClasses(clz, BaseRelation.class, EDGE_CLASS_NAME);
|
||||
}
|
||||
|
||||
java.lang.reflect.Type[] typeParameters = clz.getTypeParameters();
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<Out> sourceClass = (Class<Out>) getGenericClass(typeParameters[0]);
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<In> targetClass = (Class<In>) getGenericClass(typeParameters[1]);
|
||||
|
||||
this.sourceType = TypeBinder.getType(sourceClass);
|
||||
this.targetType = TypeBinder.getType(targetClass);
|
||||
}
|
||||
|
||||
|
||||
public String getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public String getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDefinition<Out> getSource() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSource(EntityDefinition<Out> source) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDefinition<In> getTarget() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTarget(EntityDefinition<In> target) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,9 +2,11 @@ package org.gcube.informationsystem.types.reference;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
||||
public interface TypeDefinition {
|
||||
public interface TypeDefinition<ISM extends ISManageable> extends ER {
|
||||
|
||||
public String getName();
|
||||
|
||||
|
@ -16,8 +18,4 @@ public interface TypeDefinition {
|
|||
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
public String getSourceType();
|
||||
|
||||
public String getTargetType();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package org.gcube.informationsystem.types.reference.entities;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
|
||||
public interface EntityDefinition<E extends BaseEntity> extends TypeDefinition<E>, BaseEntity {
|
||||
|
||||
}
|
|
@ -1,5 +1,17 @@
|
|||
package org.gcube.informationsystem.types.reference.properties;
|
||||
|
||||
public interface PropertyDefinition {
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Header
|
||||
*/
|
||||
@JsonDeserialize(as = PropertyDefinitionImpl.class)
|
||||
public interface PropertyDefinition extends BaseProperty {
|
||||
|
||||
public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package org.gcube.informationsystem.types.reference.properties;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
|
||||
|
||||
public interface PropertyTypeDefiniton<P extends BaseProperty> extends TypeDefinition<P>, BaseProperty {
|
||||
|
||||
public static final String NAME = "PropertyTypeDefiniton"; // PropertyTypeDefiniton.class.getSimpleName();
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.gcube.informationsystem.types.reference.relations;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityDefinition;
|
||||
|
||||
public interface RelationDefinition<Out extends BaseEntity, In extends BaseEntity, Rel extends BaseRelation<Out,In>>
|
||||
extends TypeDefinition<Rel>, BaseRelation<EntityDefinition<Out>,EntityDefinition<In>> {
|
||||
|
||||
public String getSourceType();
|
||||
|
||||
public String getTargetType();
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ package org.gcube.informationsystem.utils;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.utils;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.utils.discovery.SchemaAction;
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.utils.discovery;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.model;
|
||||
package org.gcube.informationsystem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
|
@ -1,11 +1,11 @@
|
|||
package org.gcube.informationsystem.model.impl.properties;
|
||||
package org.gcube.informationsystem.base.impl.properties;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
|
@ -1,14 +1,14 @@
|
|||
package org.gcube.informationsystem.model.impl.properties;
|
||||
package org.gcube.informationsystem.impl.properties;
|
||||
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.KeyGenerator;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.ContextTest;
|
||||
import org.gcube.informationsystem.ContextTest;
|
||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
||||
import org.gcube.informationsystem.model.reference.properties.Encrypted;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.junit.Assert;
|
|
@ -4,8 +4,8 @@
|
|||
package org.gcube.informationsystem.types;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.base.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.junit.Test;
|
||||
|
@ -23,7 +23,7 @@ public class EntitySchemaDefinition {
|
|||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Class<? extends Property> clz = Header.class;
|
||||
Class<? extends BaseProperty> clz = Header.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
logger.trace(json);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue