Class EntityImpl
- java.lang.Object
-
- org.gcube.informationsystem.base.impl.ElementImpl
-
- org.gcube.informationsystem.base.impl.entities.EntityElementImpl
-
- org.gcube.informationsystem.model.impl.entities.EntityImpl
-
- All Implemented Interfaces:
Serializable,Element,EntityElement,IdentifiableElement,Entity,ERElement,ModelElement
- Direct Known Subclasses:
FacetImpl,ResourceImpl
public abstract class EntityImpl extends EntityElementImpl implements Entity
The default abstract implementation of theEntityinterface.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<UUID,String>contextsThe contexts in which the entity exists.protected StringexpectedTypeThe expected type.protected List<String>supertypesThe list of supertypes.-
Fields inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
metadata, uuid
-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, REDACTED, TYPE_PROPERTY, UNKNOWN_USER
-
Fields inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
NAME
-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEntityImpl()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<UUID,String>getContexts()Returns a map of contexts where this element is present.StringgetExpectedType()Returns the name of the expected type.List<String>getSupertypes()Returns the list of supertypes for this element, serialized asModelElement.SUPERTYPES_PROPERTY, which explains the spelling of the name.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, setMetadata
-
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.base.reference.entities.EntityElement
getID, getMetadata, setID, setMetadata
-
-
-
-
Constructor Detail
-
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 Detail
-
getSupertypes
public List<String> getSupertypes()
Returns the list of supertypes for this element, serialized asModelElement.SUPERTYPES_PROPERTY, which explains the spelling of the name.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.
-
-