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
Fields Modifier and Type Field Description static StringCHILDREN_PROPERTYThe property name for the children relationships.static StringNAMEThe name of the Context entity type.static StringNAME_PROPERTYThe property name for the context's name.static StringPARENT_PROPERTYThe property name for the parent relationship.static StringSTATEThe property name for the state of the context.-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, TYPE_PROPERTY
-
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.voidaddChild(IsParentOf isParentOf)Adds a child to this context via anIsParentOfrelation.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<IsParentOf>getChildren()Returns the children of this context.StringgetName()Returns the name of the context.IsParentOfgetParent()Returns the parent of this context.StringgetState()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.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.voidsetParent(IsParentOf isParentOf)Sets the parent of this context via anIsParentOfrelation.voidsetState(String 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
-
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
-
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
-
-
Method Detail
-
getName
@ISProperty(name="name", mandatory=true, nullable=false) 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.
-
getState
@ISProperty(name="state", mandatory=true, nullable=false, regexpr="[a-z]+") String getState()
Returns the current state of the context as a string.- Returns:
- The context state.
- See Also:
ContextState
-
setState
void setState(String state)
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
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.
-
setParent
void setParent(IsParentOf isParentOf)
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
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.
-
addChild
void addChild(IsParentOf isParentOf)
Adds a child to this context via anIsParentOfrelation.- Parameters:
isParentOf- The relation to the child.
-
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.
-
-