2019-03-22 15:18:23 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.informationsystem.model.reference.relations;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
2019-10-23 16:55:48 +02:00
|
|
|
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
2019-03-22 15:18:23 +01:00
|
|
|
import org.gcube.informationsystem.model.reference.entities.Entity;
|
|
|
|
import org.gcube.informationsystem.model.reference.entities.Resource;
|
|
|
|
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
2019-10-23 15:40:52 +02:00
|
|
|
import org.gcube.informationsystem.types.annotations.Abstract;
|
2019-03-22 15:18:23 +01:00
|
|
|
import org.gcube.informationsystem.types.annotations.ISProperty;
|
|
|
|
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonGetter;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Relations
|
|
|
|
*/
|
2019-10-23 15:40:52 +02:00
|
|
|
@Abstract
|
2019-03-22 15:18:23 +01:00
|
|
|
// @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses
|
2019-10-23 15:40:52 +02:00
|
|
|
public interface Relation<Out extends Entity, In extends Entity> extends BaseRelation<Out,In> {
|
2019-03-22 15:18:23 +01:00
|
|
|
|
|
|
|
public static final String NAME = "Relation"; //Relation.class.getSimpleName();
|
|
|
|
|
2019-10-23 16:55:48 +02:00
|
|
|
public static final String PROPAGATION_CONSTRAINT = "propagationConstraint";
|
|
|
|
|
2019-10-23 15:40:52 +02:00
|
|
|
@JsonIgnoreProperties({Resource.CONSISTS_OF_PROPERTY, Resource.IS_RELATED_TO_PROPERTY})
|
|
|
|
@JsonGetter(value = SOURCE_PROPERTY)
|
2019-03-22 15:18:23 +01:00
|
|
|
public Out getSource();
|
|
|
|
|
|
|
|
@JsonIgnore
|
|
|
|
public void setSource(Out source);
|
|
|
|
|
2019-10-23 15:40:52 +02:00
|
|
|
@JsonGetter(value = TARGET_PROPERTY)
|
2019-03-22 15:18:23 +01:00
|
|
|
public In getTarget();
|
|
|
|
|
|
|
|
@JsonIgnore
|
|
|
|
public void setTarget(In target);
|
|
|
|
|
2019-10-23 15:40:52 +02:00
|
|
|
@ISProperty(name = PROPAGATION_CONSTRAINT)
|
2019-03-22 15:18:23 +01:00
|
|
|
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)
|
2019-10-23 15:40:52 +02:00
|
|
|
public Map<String,Object> getAdditionalProperties();
|
|
|
|
|
2019-03-22 15:18:23 +01:00
|
|
|
/**
|
|
|
|
* Set all properties, replacing existing ones
|
|
|
|
*/
|
2019-10-23 15:40:52 +02:00
|
|
|
public void setAdditionalProperties(Map<String,Object> additionalProperties);
|
|
|
|
|
2019-03-22 15:18:23 +01:00
|
|
|
/**
|
|
|
|
* Return the value of the given property.
|
|
|
|
* @param key the key of the requested property
|
|
|
|
* @return the value of the given property
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
public void setAdditionalProperty(String key, Object value);
|
|
|
|
|
|
|
|
}
|