Class EntityImpl
- All Implemented Interfaces:
Serializable,Element,EntityElement,IdentifiableElement,Entity,ERElement,ModelElement
- Direct Known Subclasses:
FacetImpl,ResourceImpl
Entity interface.
Upon instantiation, a unique, non-reserved identifier (UUID) is automatically generated
and assigned by default, purely as a convenience so that callers are not forced to set
an id explicitly on every instance. This default does not by itself provide
idempotency across retries (e.g. of a PUT): a caller that needs the server to recognize
a retried request as the same logical instance must capture and reuse an explicit UUID
via EntityElementImpl.setID(UUID) — a freshly constructed instance always receives a new random id.
- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe contexts in which the entity exists.protected StringThe expected type.The list of supertypes.Fields inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
metadata, uuidFields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, REDACTED, TYPE_PROPERTY, UNKNOWN_USERFields inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
NAMEFields inherited from interface org.gcube.informationsystem.model.reference.ERElement
CONTEXTS_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTYFields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a map of contexts where this element is present.Returns the name of the expected type.Returns the list of supertypes for this element.protected voidsetContexts(Map<UUID, String> contexts) Sets the contexts in which the entity exists.Methods inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
getID, getMetadata, setID, setMetadataMethods 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
getTypeNameMethods inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
getID, getMetadata, setID, setMetadata
-
Field Details
-
supertypes
The list of supertypes. -
expectedType
The expected type. -
contexts
The contexts in which the entity exists.
-
-
Constructor Details
-
EntityImpl
protected EntityImpl()Default constructor. Initializes the entity with an automatically generated, valid, and non-reserved UUID so that callers are not forced to set one explicitly. The identifier can be overridden using the setter, e.g. when the caller needs idempotency across retries.
-
-
Method Details
-
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
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
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
Sets the contexts in which the entity exists.- Parameters:
contexts- The contexts.
-