- java.lang.Object
-
- org.gcube.informationsystem.base.impl.ElementImpl
-
- org.gcube.informationsystem.base.impl.relations.RelationElementImpl<S,T>
-
- org.gcube.informationsystem.model.impl.relations.RelationImpl<S,T>
-
- All Implemented Interfaces:
Serializable,Element,IdentifiableElement,RelationElement<S,T>,SchemaMixedElement,ERElement,ModelElement,Relation<S,T>
- Direct Known Subclasses:
ConsistsOfImpl,IsRelatedToImpl
public abstract class RelationImpl<S extends Resource,T extends Entity> extends RelationElementImpl<S,T> implements Relation<S,T>
The default abstract implementation of theRelationinterface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>additionalPropertiesThe additional properties of the relation.protected Set<String>allowedAdditionalKeysA set of keys that are allowed as additional properties, even if they start with '_' or '@'.protected Map<UUID,String>contextsThe contexts of the relation.protected StringexpectedtypeThe expected type of the relation.protected PropagationConstraintpropagationConstraintThe propagation constraint of the relation.protected List<String>supertypesThe supertypes of the relation.-
Fields inherited from class org.gcube.informationsystem.base.impl.relations.RelationElementImpl
metadata, source, target, uuid
-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.model.reference.ERElement
CONTEXTS_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.model.reference.relations.Relation
NAME, PROPAGATION_CONSTRAINT_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.relations.RelationElement
NAME, SOURCE_PROPERTY, TARGET_PROPERTY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRelationImpl()Default constructor.protectedRelationImpl(S source, T target, PropagationConstraint propagationConstraint)Constructs a newRelationImplwith the given source, target, and propagation constraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>getAdditionalProperties()Returns a map of all additional properties not defined in the schema.ObjectgetAdditionalProperty(String key)Retrieves a single additional property by its key.Map<UUID,String>getContexts()Returns a map of contexts where this element is present.StringgetExpectedtype()Returns the name of the expected type.PropagationConstraintgetPropagationConstraint()Returns the propagation constraint for this relation.List<String>getSupertypes()Returns the list of supertypes for this element.voidsetAdditionalProperties(Map<String,Object> additionalProperties)Sets the map of additional properties for the element.voidsetAdditionalProperty(String key, Object value)Sets a single additional property.protected voidsetContexts(Map<UUID,String> contexts)Sets the contexts of the relation.voidsetPropagationConstraint(PropagationConstraint propagationConstraint)Sets the propagation constraint for this relation.-
Methods inherited from class org.gcube.informationsystem.base.impl.relations.RelationElementImpl
getID, getMetadata, getSource, getTarget, setID, setMetadata, setSource, setTarget
-
Methods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Methods inherited from interface org.gcube.informationsystem.model.reference.relations.Relation
getSource, getTarget, setSource, setTarget
-
Methods inherited from interface org.gcube.informationsystem.base.reference.relations.RelationElement
getID, getMetadata, setID, setMetadata
-
-
-
-
Field Detail
-
expectedtype
protected String expectedtype
The expected type of the relation.
-
propagationConstraint
protected PropagationConstraint propagationConstraint
The propagation constraint of the relation.
-
additionalProperties
protected Map<String,Object> additionalProperties
The additional properties of the relation.
-
-
Constructor Detail
-
RelationImpl
protected RelationImpl()
Default constructor.
-
RelationImpl
protected RelationImpl(S source, T target, PropagationConstraint propagationConstraint)
Constructs a newRelationImplwith the given source, target, and propagation constraint.- Parameters:
source- The source of the relation.target- The target of the relation.propagationConstraint- The propagation constraint of the relation.
-
-
Method Detail
-
getSupertypes
public List<String> getSupertypes()
Returns the list of supertypes for this element.This list is included in JSON serialization only if it is not empty.
- Specified by:
getSupertypesin interfaceModelElement- Returns:
- A
Listof supertype names.
-
getExpectedtype
public String getExpectedtype()
Returns the name of the expected type.This is used during deserialization to indicate the original type when a fallback to a supertype was necessary. It is included in JSON serialization only if it is not empty.
- Specified by:
getExpectedtypein interfaceModelElement- Returns:
- The expected type name.
-
getContexts
public Map<UUID,String> getContexts()
Returns a map of contexts where this element is present.The map keys are the context UUIDs, and the values are the context names. This property is included in JSON serialization only if it is not null.
- Specified by:
getContextsin interfaceERElement- Returns:
- A
Mapof context UUIDs to context names, ornull.
-
setContexts
protected void setContexts(Map<UUID,String> contexts)
Sets the contexts of the relation.- Parameters:
contexts- The contexts to set.
-
getPropagationConstraint
public PropagationConstraint getPropagationConstraint()
Returns the propagation constraint for this relation.- Specified by:
getPropagationConstraintin interfaceRelation<S extends Resource,T extends Entity>- Returns:
- The
PropagationConstraint.
-
setPropagationConstraint
public void setPropagationConstraint(PropagationConstraint propagationConstraint)
Sets the propagation constraint for this relation.- Specified by:
setPropagationConstraintin interfaceRelation<S extends Resource,T extends Entity>- Parameters:
propagationConstraint- ThePropagationConstraintto set.
-
getAdditionalProperties
public Map<String,Object> getAdditionalProperties()
Returns a map of all additional properties not defined in the schema.- Specified by:
getAdditionalPropertiesin interfaceRelation<S extends Resource,T extends Entity>- Specified by:
getAdditionalPropertiesin interfaceSchemaMixedElement- Returns:
- A
Mapcontaining the additional properties, where the key is the property name and the value is the property value.
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> additionalProperties)
Sets the map of additional properties for the element.- Specified by:
setAdditionalPropertiesin interfaceRelation<S extends Resource,T extends Entity>- Specified by:
setAdditionalPropertiesin interfaceSchemaMixedElement- Parameters:
additionalProperties- AMapof additional properties.
-
getAdditionalProperty
public Object getAdditionalProperty(String key)
Retrieves a single additional property by its key.- Specified by:
getAdditionalPropertyin interfaceRelation<S extends Resource,T extends Entity>- Specified by:
getAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property to retrieve.- Returns:
- The value of the property, or
nullif the key is not found.
-
setAdditionalProperty
public void setAdditionalProperty(String key, Object value)
Sets a single additional property.- Specified by:
setAdditionalPropertyin interfaceRelation<S extends Resource,T extends Entity>- Specified by:
setAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property.value- The value of the additional property.
-
-