Class RelationElementImpl<S extends EntityElement,T extends EntityElement>
- java.lang.Object
-
- org.gcube.informationsystem.base.impl.ElementImpl
-
- org.gcube.informationsystem.base.impl.relations.RelationElementImpl<S,T>
-
- Type Parameters:
S- The type of the source entity.T- The type of the target entity.
- All Implemented Interfaces:
Serializable,Element,IdentifiableElement,RelationElement<S,T>
- Direct Known Subclasses:
IsParentOfImpl,RelationImpl
public abstract class RelationElementImpl<S extends EntityElement,T extends EntityElement> extends ElementImpl implements RelationElement<S,T>
The default implementation of theRelationElementinterface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected MetadatametadataThe metadata of the relation.protected SsourceThe source of the relation.protected TtargetThe target of the relation.protected UUIDuuidThe UUID of the relation.-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.relations.RelationElement
NAME, SOURCE_PROPERTY, TARGET_PROPERTY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRelationElementImpl()Default constructor.protectedRelationElementImpl(S source, T target)Constructs a new relation with the specified source and target entities.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDgetID()Returns the unique identifier (UUID) of the element.MetadatagetMetadata()Returns the metadata associated with the element.SgetSource()Returns the source entity of the relation.TgetTarget()Returns the target entity of the relation.voidsetID(UUID uuid)Sets the unique identifier (UUID) for the element.voidsetMetadata(Metadata metadata)Sets the metadata for the element.voidsetSource(S source)Sets the source entity of the relation.voidsetTarget(T target)Sets the target entity of the relation.-
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
-
-
-
-
Field Detail
-
uuid
protected UUID uuid
The UUID of the relation.
-
metadata
protected Metadata metadata
The metadata of the relation.
-
source
protected S extends EntityElement source
The source of the relation.
-
target
protected T extends EntityElement target
The target of the relation.
-
-
Method Detail
-
getID
public UUID getID()
Returns the unique identifier (UUID) of the element.This UUID is used to uniquely identify the relation instance. It is read-only, mandatory, and cannot be null.
- Specified by:
getIDin interfaceIdentifiableElement- Specified by:
getIDin interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Returns:
- The
UUIDof the element.
-
setID
public void setID(UUID uuid)
Sets the unique identifier (UUID) for the element.- Specified by:
setIDin interfaceIdentifiableElement- Specified by:
setIDin interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Parameters:
uuid- TheUUIDto set.
-
getMetadata
public Metadata getMetadata()
Returns the metadata associated with the element.The metadata is included in JSON serialization only if it is not null.
Metadata is automatically managed by the system and is mandatory.
- Specified by:
getMetadatain interfaceIdentifiableElement- Specified by:
getMetadatain interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Returns:
- The
Metadataof the element, ornullif none is set.
-
setMetadata
public void setMetadata(Metadata metadata)
Sets the metadata for the element.- Specified by:
setMetadatain interfaceIdentifiableElement- Specified by:
setMetadatain interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Parameters:
metadata- TheMetadatato associate with the element.
-
getSource
public S getSource()
Returns the source entity of the relation.- Specified by:
getSourcein interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Returns:
- The source entity.
-
setSource
public void setSource(S source)
Sets the source entity of the relation.- Specified by:
setSourcein interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Parameters:
source- The source entity to set.
-
getTarget
public T getTarget()
Returns the target entity of the relation.- Specified by:
getTargetin interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Returns:
- The target entity.
-
setTarget
public void setTarget(T target)
Sets the target entity of the relation.- Specified by:
setTargetin interfaceRelationElement<S extends EntityElement,T extends EntityElement>- Parameters:
target- The target entity to set.
-
-