Class ContextImpl
- All Implemented Interfaces:
Serializable,Element,EntityElement,IdentifiableElement,SchemaMixedElement,Context
Context interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionAdditional properties of the context.A set of keys that are allowed as additional properties, even if they start with '_' or '@'.The children of the context.protected ContextStateThe effective (inherited) state of the context.The history events of the context.protected StringThe name of the context.protected ContextThe parent of the context.protected StringThe hierarchical path of the context, e.g.The previous hierarchical paths under which this context still resolves.protected ContextStateThe state of the context.Fields inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
metadata, uuidFields inherited from interface org.gcube.informationsystem.contexts.reference.entities.Context
CHILDREN_PROPERTY, EFFECTIVE_STATE, HISTORY, NAME, NAME_PROPERTY, NAME_REGEX, PARENT_PROPERTY, PATH, PREVIOUS_PATHS, STATEFields 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.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor.ContextImpl(String name) Constructs a new context with a given name.ContextImpl(String name, UUID uuid) Constructs a new context with a given name and UUID.ContextImpl(UUID uuid) Constructs a new context with a given UUID. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child to this context by its UUID.voidAdds a child to this context.protected voidaddChildFromJson(Context child) Adds a child from a JSON-deserialized context object.Returns a map of all additional properties not defined in the schema.Retrieves a single additional property by its key.Returns the children of this context.Returns the current effective state of the context.Returns the list of history events for this context.getName()Returns the name of the context.Returns the parent of this context.getPath()Returns the hierarchical path of the context, e.g.Returns the set of historical paths this context still answers to.getState()Returns the current state of the context.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 voidsetChildrenFromJson(List<Context> children) Sets the children from a JSON-deserialized list of contexts.voidsetEffectiveState(ContextState effectiveState) Sets the effective state of the context.voidsetHistory(List<Event> history) Sets the history events for this context.voidSets the name of the context.voidSets the parent of this context by its UUID.voidSets the parent of this context.protected voidsetParentFromJson(Context context) Sets the parent from a JSON-deserialized context object.voidSets the hierarchical path of the context.voidsetPreviousPaths(Set<String> previousPaths) Sets the set of historical paths this context still answers to.voidsetState(ContextState state) Sets the state of the context.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
-
name
The name of the context. -
parent
The parent of the context. -
children
The children of the context. -
history
The history events of the context. -
path
The hierarchical path of the context, e.g./gcube/devsec/devVRE. -
previousPaths
The previous hierarchical paths under which this context still resolves. -
state
The state of the context. -
effectiveState
The effective (inherited) state of the context. -
additionalProperties
Additional properties of the context. -
allowedAdditionalKeys
A set of keys that are allowed as additional properties, even if they start with '_' or '@'.
-
-
Constructor Details
-
ContextImpl
protected ContextImpl()Default constructor. -
ContextImpl
Constructs a new context with a given UUID.- Parameters:
uuid- The UUID.
-
ContextImpl
Constructs a new context with a given name.- Parameters:
name- The name.
-
ContextImpl
Constructs a new context with a given name and UUID.- Parameters:
name- The name.uuid- The UUID.
-
-
Method Details
-
getName
Returns the name of the context. -
setName
Sets the name of the context. -
getPath
Returns the hierarchical path of the context, e.g./gcube/devsec/devVRE. -
setPath
Sets the hierarchical path of the context.This method is intended for internal use by the resource-registry to persist the path at creation, rename, and reparent time. It is not expected to be called by external clients, and may not perform any path validation or recomputation.
-
getPreviousPaths
Returns the set of historical paths this context still answers to.- Specified by:
getPreviousPathsin interfaceContext- Returns:
- The set of previous paths, never
null(empty set by default).
-
setPreviousPaths
Sets the set of historical paths this context still answers to.- Specified by:
setPreviousPathsin interfaceContext- Parameters:
previousPaths- The set of previous paths to set.
-
getState
Returns the current state of the context. -
setState
Sets the state of the context. -
getEffectiveState
Returns the current effective state of the context.- Specified by:
getEffectiveStatein interfaceContext- Returns:
- The context effective state.
-
setEffectiveState
Sets the effective state of the context.The effective state is derived from the context's own
Context.STATEand the effective state of its parent chain. A context isSUSPENDEDwhen any ancestor isCREATEDorSUSPENDED, regardless of the context's own local state. This method is intended for internal use by the resource-registry to persist the effective state at creation, rename, reparent, and state change time. It is not expected to be called by external clients, and may not perform any effective state recomputation based on the parent chain.- Specified by:
setEffectiveStatein interfaceContext- Parameters:
effectiveState- The effective state to set.
-
getParent
Returns the parent of this context. -
setParent
Sets the parent of this context by its UUID. -
setParent
Sets the parent of this context. -
setParentFromJson
Sets the parent from a JSON-deserialized context object.- Parameters:
context- The deserialized parent context.
-
getChildren
Returns the children of this context.- Specified by:
getChildrenin interfaceContext- Returns:
- A list of child contexts.
-
setChildrenFromJson
Sets the children from a JSON-deserialized list of contexts.- Parameters:
children- The list of deserialized child contexts.
-
addChildFromJson
Adds a child from a JSON-deserialized context object.- Parameters:
child- The deserialized child context.
-
addChild
Adds a child to this context by its UUID. -
addChild
Adds a child to this context. -
getHistory
Returns the list of history events for this context.- Specified by:
getHistoryin interfaceContext- Returns:
- The history events.
-
setHistory
Sets the history events for this context.- Specified by:
setHistoryin interfaceContext- Parameters:
history- The history events to set.
-
getAdditionalProperties
Returns a map of all additional properties not defined in the schema.- Specified by:
getAdditionalPropertiesin interfaceContext- 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
Sets the map of additional properties for the element.- Specified by:
setAdditionalPropertiesin interfaceContext- Specified by:
setAdditionalPropertiesin interfaceSchemaMixedElement- Parameters:
additionalProperties- AMapof additional properties.
-
getAdditionalProperty
Retrieves a single additional property by its key.- Specified by:
getAdditionalPropertyin interfaceContext- 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
Sets a single additional property.- Specified by:
setAdditionalPropertyin interfaceContext- Specified by:
setAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property.value- The value of the additional property.
-