Interface Context
-
- All Superinterfaces:
Element,EntityElement,IdentifiableElement,SchemaMixedElement,Serializable
- All Known Implementing Classes:
ContextImpl
@TypeMetadata(name="Context", description="Represents a Context, the hierarchical grouping mechanism for resources; contexts form a tree structure and have a lifecycle managed by their state.", version="1.0.0") @Change(version="1.0.0", description="First Version") public interface Context extends EntityElement, SchemaMixedElement
Represents a context, which is a hierarchical grouping mechanism for resources.Contexts form a tree structure and have a lifecycle managed by their state.
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description static StringCHILDREN_PROPERTYThe property name for the children relationships.static StringEFFECTIVE_STATEThe property name for the effective (inherited) state of the context.static StringHISTORYThe property name for the context history events.static StringNAMEThe name of the Context entity type.static StringNAME_PROPERTYThe property name for the context's name.static StringNAME_REGEXThe regular expression defining valid characters for a Context name.static StringPARENT_PROPERTYThe property name for the parent relationship.static StringPATHThe property name for the computed hierarchical path of the context, e.g.static StringPREVIOUS_PATHSThe property name for the previous hierarchical paths under which this context still resolves.static StringSTATEThe property name for the state of the context.-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, REDACTED, TYPE_PROPERTY, UNKNOWN_USER
-
Fields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddChild(UUID uuid)Adds a child to this context by its UUID.voidaddChild(Context child)Adds a child to this context.Map<String,Object>getAdditionalProperties()Returns a map of all additional properties not defined in the schema.ObjectgetAdditionalProperty(String key)Retrieves a single additional property by its key.List<Context>getChildren()Returns the children of this context.ContextStategetEffectiveState()Returns the current effective state of the context.List<Event>getHistory()Returns the list of history events for this context.StringgetName()Returns the name of the context.ContextgetParent()Returns the parent of this context.StringgetPath()Returns the hierarchical path of the context, e.g.Set<String>getPreviousPaths()Returns the set of historical paths this context still answers to.ContextStategetState()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.voidsetName(String name)Sets the name of the context.voidsetParent(UUID uuid)Sets the parent of this context by its UUID.voidsetParent(Context context)Sets the parent of this context.voidsetPath(String path)Sets 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
getTypeName
-
Methods inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
getID, getMetadata, setID, setMetadata
-
-
-
-
Field Detail
-
NAME
static final String NAME
The name of the Context entity type.- See Also:
- Constant Field Values
-
NAME_PROPERTY
static final String NAME_PROPERTY
The property name for the context's name.- See Also:
- Constant Field Values
-
NAME_REGEX
static final String NAME_REGEX
The regular expression defining valid characters for a Context name.- See Also:
- Constant Field Values
-
PATH
static final String 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:
- Constant Field Values
-
PREVIOUS_PATHS
static final String PREVIOUS_PATHS
The property name for the previous hierarchical paths under which this context still resolves.- See Also:
- Constant Field Values
-
STATE
static final String 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:
- Constant Field Values
-
EFFECTIVE_STATE
static final String 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:
- Constant Field Values
-
PARENT_PROPERTY
static final String PARENT_PROPERTY
The property name for the parent relationship.- See Also:
- Constant Field Values
-
CHILDREN_PROPERTY
static final String CHILDREN_PROPERTY
The property name for the children relationships.- See Also:
- Constant Field Values
-
HISTORY
static final String HISTORY
The property name for the context history events.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
@ISProperty(name="name", mandatory=true) String getName()
Returns the name of the context.- Returns:
- The context name.
-
setName
void setName(String name)
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
void setPath(String path)
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
@ISProperty(name="previousPaths", mandatory=false) Set<String> 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
void setPreviousPaths(Set<String> previousPaths)
Sets the set of historical paths this context still answers to.- Parameters:
previousPaths- The set of previous paths to set.
-
getState
@ISProperty(name="state", mandatory=true) ContextState getState()
Returns the current state of the context.- Returns:
- The context state.
-
setState
void setState(ContextState state)
Sets the state of the context.- Parameters:
state- The state to set.
-
getEffectiveState
@ISProperty(name="effectiveState", mandatory=true) ContextState getEffectiveState()
Returns the current effective state of the context.- Returns:
- The context effective state.
-
setEffectiveState
void setEffectiveState(ContextState state)
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
void setParent(UUID uuid)
Sets the parent of this context by its UUID.- Parameters:
uuid- The UUID of the parent context.
-
setParent
void setParent(Context context)
Sets the parent of this context.- Parameters:
context- The parent context.
-
getChildren
List<Context> getChildren()
Returns the children of this context.- Returns:
- A list of child contexts.
-
addChild
void addChild(UUID uuid)
Adds a child to this context by its UUID.- Parameters:
uuid- The UUID of the child context.
-
addChild
void addChild(Context child)
Adds a child to this context.- Parameters:
child- The child context.
-
getHistory
@ISProperty(name="history", mandatory=false) List<Event> getHistory()
Returns the list of history events for this context.- Returns:
- The history events.
-
setHistory
void setHistory(List<Event> history)
Sets the history events for this context.- Parameters:
history- The history events to set.
-
getAdditionalProperties
Map<String,Object> 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
void setAdditionalProperties(Map<String,Object> additionalProperties)
Sets the map of additional properties for the element.- Specified by:
setAdditionalPropertiesin interfaceSchemaMixedElement- Parameters:
additionalProperties- AMapof additional properties.
-
getAdditionalProperty
Object getAdditionalProperty(String key)
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
void setAdditionalProperty(String key, Object value)
Sets a single additional property.- Specified by:
setAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property.value- The value of the additional property.
-
-