Interface Context
- All Superinterfaces:
Element,EntityElement,IdentifiableElement,SchemaMixedElement,Serializable
- All Known Implementing Classes:
ContextImpl
Contexts form a tree structure and have a lifecycle managed by their state.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property name for the children relationships.static final StringThe property name for the effective (inherited) state of the context.static final StringThe property name for the context history events.static final StringThe name of the Context entity type.static final StringThe property name for the context's name.static final StringThe regular expression defining valid characters for a Context name.static final StringThe property name for the parent relationship.static final StringThe property name for the computed hierarchical path of the context, e.g.static final StringThe property name for the previous hierarchical paths under which this context still resolves.static final StringThe property name for the state of the context.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, REDACTED, TYPE_PROPERTY, UNKNOWN_USERFields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child to this context by its UUID.voidAdds a child to this context.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.voidsetEffectiveState(ContextState state) 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.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 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 entity type.- See Also:
-
NAME_PROPERTY
The property name for the context's name.- See Also:
-
NAME_REGEX
The regular expression defining valid characters for a Context name.- See Also:
-
PATH
The property name for the computed hierarchical path of the context, e.g./gcube/devsec/devVRE.This value is persisted by the resource-registry at creation, rename, and reparent time so that deleted (cemetery) contexts retain their last known path even after the
ChildOfedges have been severed.- See Also:
-
PREVIOUS_PATHS
The property name for the previous hierarchical paths under which this context still resolves.- See Also:
-
STATE
The property name for the state of the context.The resource-registry manages the following states:
- created: A newly created context.
- active: An operational context.
- deleted: A context marked for deletion.
- See Also:
-
EFFECTIVE_STATE
The property name for the effective (inherited) state of the context.The effective state is derived from the context's own
STATEand the effective state of its parent chain. A context isSUSPENDEDwhen any ancestor isCREATEDorSUSPENDED, regardless of the context's own local state.- See Also:
-
PARENT_PROPERTY
The property name for the parent relationship.- See Also:
-
CHILDREN_PROPERTY
The property name for the children relationships.- See Also:
-
HISTORY
The property name for the context history events.- See Also:
-
-
Method Details
-
getName
Returns the name of the context.- Returns:
- The context name.
-
setName
Sets the name of the context.- Parameters:
name- The name to set.
-
getPath
String getPath()Returns the hierarchical path of the context, e.g./gcube/devsec/devVRE.- Returns:
- The path of the context.
-
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.
- Parameters:
path- The path to set.
-
getPreviousPaths
Returns the set of historical paths this context still answers to.- Returns:
- The set of previous paths, never
null(empty set by default).
-
setPreviousPaths
Sets the set of historical paths this context still answers to.- Parameters:
previousPaths- The set of previous paths to set.
-
getState
Returns the current state of the context.- Returns:
- The context state.
-
setState
Sets the state of the context.- Parameters:
state- The state to set.
-
getEffectiveState
Returns the current effective state of the context.- Returns:
- The context effective state.
-
setEffectiveState
Sets the effective state of the context.The effective state is derived from the context's own
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.- Parameters:
state- The effective state to set.
-
getParent
Context getParent()Returns the parent of this context.- Returns:
- The parent context, or
nullif this is a root context.
-
setParent
Sets the parent of this context by its UUID.- Parameters:
uuid- The UUID of the parent context.
-
setParent
Sets the parent of this context.- Parameters:
context- The parent context.
-
getChildren
Returns the children of this context.- Returns:
- A list of child contexts.
-
addChild
Adds a child to this context by its UUID.- Parameters:
uuid- The UUID of the child context.
-
addChild
Adds a child to this context.- Parameters:
child- The child context.
-
getHistory
Returns the list of history events for this context.- Returns:
- The history events.
-
setHistory
Sets the history events for this context.- Parameters:
history- The history events to set.
-
getAdditionalProperties
Returns a map of all additional properties not defined in the schema.- 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 interfaceSchemaMixedElement- Parameters:
additionalProperties- AMapof additional properties.
-
getAdditionalProperty
Retrieves a single additional property by its key.- 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 interfaceSchemaMixedElement- Parameters:
key- The name of the additional property.value- The value of the additional property.
-