Added SchemaMixedElement interface to identify element supporting
additional properties
This commit is contained in:
parent
9858c50c99
commit
dc2d5cece3
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.informationsystem.base.reference;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This interfaces is an helper to identify elements supporting Schema Mixed.
|
||||
* i.e. elements which instances could have additional properties in respect to the ones defined in the schema
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public interface SchemaMixedElement extends Element {
|
||||
|
||||
public Map<String,Object> getAdditionalProperties();
|
||||
|
||||
public void setAdditionalProperties(Map<String,Object> additionalProperties);
|
||||
|
||||
public Object getAdditionalProperty(String key);
|
||||
|
||||
public void setAdditionalProperty(String key, Object value);
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package org.gcube.informationsystem.model.reference.entities;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.SchemaMixedElement;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
|
||||
|
||||
|
@ -15,40 +16,25 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||
*/
|
||||
@Abstract
|
||||
// @JsonDeserialize(as=FacetImpl.class) Do not uncomment to manage subclasses
|
||||
public interface Facet extends Entity {
|
||||
public interface Facet extends Entity, SchemaMixedElement {
|
||||
|
||||
public static final String NAME = "Facet"; //Facet.class.getSimpleName();
|
||||
public static final String DESCRIPTION = "This is the base class for Facets";
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
/**
|
||||
* Return all properties. The returned Map is a copy of
|
||||
* the internal representation. Any modification to the returned Map MUST
|
||||
* not affect the object
|
||||
* @return a Map containing the properties
|
||||
*/
|
||||
@JsonAnyGetter
|
||||
@JsonSerialize(using = AdditionalPropertiesSerializer.class)
|
||||
@Override
|
||||
public Map<String,Object> getAdditionalProperties();
|
||||
|
||||
/**
|
||||
* Set all properties, replacing existing ones
|
||||
*/
|
||||
@Override
|
||||
public void setAdditionalProperties(Map<String,Object> additionalProperties);
|
||||
|
||||
/**
|
||||
* Return the value of the given property.
|
||||
* @param key the key of the requested property
|
||||
* @return the value of the given property
|
||||
*/
|
||||
@Override
|
||||
public Object getAdditionalProperty(String key);
|
||||
|
||||
/**
|
||||
* Set the value of the given property.
|
||||
* @param key the key of the requested property
|
||||
* @param value the value of the given resource property
|
||||
*/
|
||||
@JsonAnySetter
|
||||
@Override
|
||||
public void setAdditionalProperty(String key, Object value);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.informationsystem.model.reference.relations;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.SchemaMixedElement;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
@ -26,7 +27,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||
*/
|
||||
@Abstract
|
||||
// @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses
|
||||
public interface Relation<S extends Resource, T extends Entity> extends RelationElement<S,T> {
|
||||
public interface Relation<S extends Resource, T extends Entity> extends RelationElement<S,T>, SchemaMixedElement {
|
||||
|
||||
public static final String NAME = "Relation"; //Relation.class.getSimpleName();
|
||||
|
||||
|
@ -34,48 +35,37 @@ public interface Relation<S extends Resource, T extends Entity> extends Relation
|
|||
|
||||
@JsonIgnoreProperties({Resource.CONSISTS_OF_PROPERTY, Resource.IS_RELATED_TO_PROPERTY})
|
||||
@JsonGetter(value = SOURCE_PROPERTY)
|
||||
@Override
|
||||
public S getSource();
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public void setSource(S source);
|
||||
|
||||
@JsonGetter(value = TARGET_PROPERTY)
|
||||
@Override
|
||||
public T getTarget();
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public void setTarget(T target);
|
||||
|
||||
@ISProperty(name = PROPAGATION_CONSTRAINT)
|
||||
public PropagationConstraint getPropagationConstraint();
|
||||
|
||||
/**
|
||||
* Return all properties. The returned Map is a copy of
|
||||
* the internal representation. Any modification to the returned Map MUST
|
||||
* not affect the object
|
||||
* @return a Map containing the properties
|
||||
*/
|
||||
@JsonAnyGetter
|
||||
@JsonSerialize(using = AdditionalPropertiesSerializer.class)
|
||||
@Override
|
||||
public Map<String,Object> getAdditionalProperties();
|
||||
|
||||
/**
|
||||
* Set all properties, replacing existing ones
|
||||
*/
|
||||
@Override
|
||||
public void setAdditionalProperties(Map<String,Object> additionalProperties);
|
||||
|
||||
/**
|
||||
* Return the value of the given property.
|
||||
* @param key the key of the requested property
|
||||
* @return the value of the given property
|
||||
*/
|
||||
@Override
|
||||
public Object getAdditionalProperty(String key);
|
||||
|
||||
/**
|
||||
* Set the value of the given property.
|
||||
* @param key the key of the requested property
|
||||
* @param value the value of the given resource property
|
||||
*/
|
||||
@JsonAnySetter
|
||||
@Override
|
||||
public void setAdditionalProperty(String key, Object value);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue