Interface Context
- All Superinterfaces:
Element,EntityElement,IdentifiableElement,SchemaMixedElement,Serializable
- All Known Implementing Classes:
ContextImpl
@TypeMetadata(name="Context",
description="This type is the used to define a Context",
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. For more details, refer to the gCube Facet Based Resource Model Wiki.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property name for the children relationships.static final StringThe name of the Context entity type.static final StringThe property name for the context's name.static final StringThe property name for the parent relationship.static final StringThe property name for the state of the context.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, TYPE_PROPERTYFields 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.voidaddChild(IsParentOf isParentOf) Adds a child to this context via anIsParentOfrelation.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.getName()Returns the name of the context.Returns the parent of this context.getState()Returns the current state of the context as a string.voidsetAdditionalProperties(Map<String, Object> additionalProperties) Sets the map of additional properties for the element.voidsetAdditionalProperty(String key, Object value) Sets a single additional property.voidSets the name of the context.voidSets the parent of this context by its UUID.voidSets the parent of this context.voidsetParent(IsParentOf isParentOf) Sets the parent of this context via anIsParentOfrelation.voidSets 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:
-
PARENT_PROPERTY
The property name for the parent relationship.- See Also:
-
CHILDREN_PROPERTY
The property name for the children relationships.- 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:
-
-
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.
-
getState
Returns the current state of the context as a string.- Returns:
- The context state.
- See Also:
-
setState
Sets the state of the context.- Parameters:
state- The state to set.
-
getParent
IsParentOf getParent()Returns the parent of this context.- Returns:
- The
IsParentOfrelation to the parent, ornullif 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.
-
setParent
Sets the parent of this context via anIsParentOfrelation.- Parameters:
isParentOf- The relation to the parent.
-
getChildren
List<IsParentOf> getChildren()Returns the children of this context.- Returns:
- A list of
IsParentOfrelations to the children.
-
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.
-
addChild
Adds a child to this context via anIsParentOfrelation.- Parameters:
isParentOf- The relation to the child.
-
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.
-