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 the
RelationElement interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MetadataThe metadata of the relation.protected SThe source of the relation.protected TThe target of the relation.protected UUIDThe UUID of the relation.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.relations.RelationElement
NAME, SOURCE_PROPERTY, TARGET_PROPERTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor.protectedRelationElementImpl(S source, T target) Constructs a new relation with the specified source and target entities. -
Method Summary
Modifier and TypeMethodDescriptiongetID()Returns the unique identifier (UUID) of the element.Returns the metadata associated with the element.Returns the source entity of the relation.Returns the target entity of the relation.voidSets the unique identifier (UUID) for the element.voidsetMetadata(Metadata metadata) Sets the metadata for the element.voidSets the source entity of the relation.voidSets the target entity of the relation.Methods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Field Details
-
uuid
The UUID of the relation. -
metadata
The metadata of the relation. -
source
The source of the relation. -
target
The target of the relation.
-
-
Constructor Details
-
RelationElementImpl
protected RelationElementImpl()Default constructor. -
RelationElementImpl
Constructs a new relation with the specified source and target entities.- Parameters:
source- The source entity of the relation.target- The target entity of the relation.
-
-
Method Details
-
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
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
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
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
Returns the source entity of the relation.- Specified by:
getSourcein interfaceRelationElement<S extends EntityElement,T extends EntityElement> - Returns:
- The source entity.
-
setSource
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
Returns the target entity of the relation.- Specified by:
getTargetin interfaceRelationElement<S extends EntityElement,T extends EntityElement> - Returns:
- The target entity.
-
setTarget
Sets the target entity of the relation.- Specified by:
setTargetin interfaceRelationElement<S extends EntityElement,T extends EntityElement> - Parameters:
target- The target entity to set.
-