Class ContextImpl

    • Field Detail

      • name

        protected String name
        The name of the context.
      • state

        protected String state
        The state of the context.
      • parent

        protected IsParentOf parent
        The parent of the context.
      • children

        protected List<IsParentOf> children
        The children of the context.
      • additionalProperties

        protected Map<String,​Object> additionalProperties
        Additional properties of the context.
      • allowedAdditionalKeys

        protected final Set<String> allowedAdditionalKeys
        A set of keys that are allowed as additional properties, even if they start with '_' or '@'.
    • Constructor Detail

      • ContextImpl

        protected ContextImpl()
        Default constructor.
      • ContextImpl

        public ContextImpl​(UUID uuid)
        Constructs a new context with a given UUID.
        Parameters:
        uuid - The UUID.
      • ContextImpl

        public ContextImpl​(String name)
        Constructs a new context with a given name.
        Parameters:
        name - The name.
      • ContextImpl

        public ContextImpl​(String name,
                           UUID uuid)
        Constructs a new context with a given name and UUID.
        Parameters:
        name - The name.
        uuid - The UUID.
    • Method Detail

      • getName

        public String getName()
        Returns the name of the context.
        Specified by:
        getName in interface Context
        Returns:
        The context name.
      • setName

        public void setName​(String name)
        Sets the name of the context.
        Specified by:
        setName in interface Context
        Parameters:
        name - The name to set.
      • getState

        public String getState()
        Returns the current state of the context as a string.
        Specified by:
        getState in interface Context
        Returns:
        The context state.
        See Also:
        ContextState
      • setState

        public void setState​(String state)
        Sets the state of the context.
        Specified by:
        setState in interface Context
        Parameters:
        state - The state to set.
      • getParent

        public IsParentOf getParent()
        Returns the parent of this context.
        Specified by:
        getParent in interface Context
        Returns:
        The IsParentOf relation to the parent, or null if this is a root context.
      • setParent

        public void setParent​(UUID uuid)
        Sets the parent of this context by its UUID.
        Specified by:
        setParent in interface Context
        Parameters:
        uuid - The UUID of the parent context.
      • setParent

        public void setParent​(Context context)
        Sets the parent of this context.
        Specified by:
        setParent in interface Context
        Parameters:
        context - The parent context.
      • setParentFromJson

        protected void setParentFromJson​(IsParentOf isParentOf)
                                  throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
        Sets the parent from a JSON-deserialized IsParentOf object.
        Parameters:
        isParentOf - The deserialized parent relationship.
        Throws:
        org.gcube.com.fasterxml.jackson.core.JsonProcessingException - if an error occurs during processing.
      • setParent

        public void setParent​(IsParentOf isParentOf)
        Sets the parent of this context via an IsParentOf relation.
        Specified by:
        setParent in interface Context
        Parameters:
        isParentOf - The relation to the parent.
      • setChildrenFromJson

        protected void setChildrenFromJson​(List<IsParentOf> children)
                                    throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
        Sets the children from a JSON-deserialized list of IsParentOf objects.
        Parameters:
        children - The list of deserialized child relationships.
        Throws:
        org.gcube.com.fasterxml.jackson.core.JsonProcessingException - if an error occurs during processing.
      • addChildFromJson

        protected void addChildFromJson​(IsParentOf isParentOf)
                                 throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
        Adds a child from a JSON-deserialized IsParentOf object.
        Parameters:
        isParentOf - The deserialized child relationship.
        Throws:
        org.gcube.com.fasterxml.jackson.core.JsonProcessingException - if an error occurs during processing.
      • addChild

        public void addChild​(UUID uuid)
        Adds a child to this context by its UUID.
        Specified by:
        addChild in interface Context
        Parameters:
        uuid - The UUID of the child context.
      • addChild

        public void addChild​(Context child)
        Adds a child to this context.
        Specified by:
        addChild in interface Context
        Parameters:
        child - The child context.
      • addChild

        public void addChild​(IsParentOf isParentOf)
        Adds a child to this context via an IsParentOf relation.
        Specified by:
        addChild in interface Context
        Parameters:
        isParentOf - The relation to the child.