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 Details

    • NAME

      static final String NAME
      The name of the Context entity type.
      See Also:
    • NAME_PROPERTY

      static final String NAME_PROPERTY
      The property name for the context's name.
      See Also:
    • PARENT_PROPERTY

      static final String PARENT_PROPERTY
      The property name for the parent relationship.
      See Also:
    • CHILDREN_PROPERTY

      static final String CHILDREN_PROPERTY
      The property name for the children relationships.
      See Also:
    • 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.
      Other states can be defined and managed by a Manager.
      See Also:
  • Method Details

    • 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:
    • 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 IsParentOf relation to the parent, or null if 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 an IsParentOf relation.
      Parameters:
      isParentOf - The relation to the parent.
    • getChildren

      List<IsParentOf> getChildren()
      Returns the children of this context.
      Returns:
      A list of IsParentOf relations 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 an IsParentOf relation.
      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:
      getAdditionalProperties in interface SchemaMixedElement
      Returns:
      A Map containing 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:
      setAdditionalProperties in interface SchemaMixedElement
      Parameters:
      additionalProperties - A Map of additional properties.
    • getAdditionalProperty

      Object getAdditionalProperty(String key)
      Retrieves a single additional property by its key.
      Specified by:
      getAdditionalProperty in interface SchemaMixedElement
      Parameters:
      key - The name of the additional property to retrieve.
      Returns:
      The value of the property, or null if the key is not found.
    • setAdditionalProperty

      void setAdditionalProperty(String key, Object value)
      Sets a single additional property.
      Specified by:
      setAdditionalProperty in interface SchemaMixedElement
      Parameters:
      key - The name of the additional property.
      value - The value of the additional property.