Class ContextImpl
java.lang.Object
org.gcube.informationsystem.base.impl.ElementImpl
org.gcube.informationsystem.base.impl.entities.EntityElementImpl
org.gcube.informationsystem.contexts.impl.entities.ContextImpl
- All Implemented Interfaces:
Serializable,Element,EntityElement,IdentifiableElement,SchemaMixedElement,Context
The default implementation of the
Context interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionAdditional properties of the context.A set of keys that are allowed as additional properties, even if they start with '_' or '@'.protected List<IsParentOf>The children of the context.protected StringThe name of the context.protected IsParentOfThe parent of the context.protected StringThe state of the context.Fields inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
metadata, uuidFields inherited from interface org.gcube.informationsystem.contexts.reference.entities.Context
CHILDREN_PROPERTY, NAME, NAME_PROPERTY, PARENT_PROPERTY, STATEFields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
NAMEFields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor.ContextImpl(String name) Constructs a new context with a given name.ContextImpl(String name, UUID uuid) Constructs a new context with a given name and UUID.ContextImpl(UUID uuid) Constructs a new context with a given UUID. -
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.protected voidaddChildFromJson(IsParentOf isParentOf) Adds a child from a JSON-deserializedIsParentOfobject.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.protected voidsetChildrenFromJson(List<IsParentOf> children) Sets the children from a JSON-deserialized list ofIsParentOfobjects.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.protected voidsetParentFromJson(IsParentOf isParentOf) Sets the parent from a JSON-deserializedIsParentOfobject.voidSets the state of the context.Methods inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
getID, getMetadata, setID, setMetadataMethods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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. -
state
The state of the context. -
parent
The parent of the context. -
children
The children of the context. -
additionalProperties
Additional properties of the context. -
allowedAdditionalKeys
A set of keys that are allowed as additional properties, even if they start with '_' or '@'.
-
-
Constructor Details
-
ContextImpl
protected ContextImpl()Default constructor. -
ContextImpl
Constructs a new context with a given UUID.- Parameters:
uuid- The UUID.
-
ContextImpl
Constructs a new context with a given name.- Parameters:
name- The name.
-
ContextImpl
Constructs a new context with a given name and UUID.- Parameters:
name- The name.uuid- The UUID.
-
-
Method Details
-
getName
Returns the name of the context. -
setName
Sets the name of the context. -
getState
Returns the current state of the context as a string. -
setState
Sets the state of the context. -
getParent
Returns the parent of this context.- Specified by:
getParentin interfaceContext- Returns:
- The
IsParentOfrelation to the parent, ornullif this is a root context.
-
setParent
Sets the parent of this context by its UUID. -
setParent
Sets the parent of this context. -
setParentFromJson
protected void setParentFromJson(IsParentOf isParentOf) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException Sets the parent from a JSON-deserializedIsParentOfobject.- Parameters:
isParentOf- The deserialized parent relationship.- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if an error occurs during processing.
-
setParent
Sets the parent of this context via anIsParentOfrelation. -
getChildren
Returns the children of this context.- Specified by:
getChildrenin interfaceContext- Returns:
- A list of
IsParentOfrelations to the children.
-
setChildrenFromJson
protected void setChildrenFromJson(List<IsParentOf> children) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException Sets the children from a JSON-deserialized list ofIsParentOfobjects.- 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-deserializedIsParentOfobject.- Parameters:
isParentOf- The deserialized child relationship.- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if an error occurs during processing.
-
addChild
Adds a child to this context by its UUID. -
addChild
Adds a child to this context. -
addChild
Adds a child to this context via anIsParentOfrelation. -
getAdditionalProperties
Returns a map of all additional properties not defined in the schema.- Specified by:
getAdditionalPropertiesin interfaceContext- 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 interfaceContext- Specified by:
setAdditionalPropertiesin interfaceSchemaMixedElement- Parameters:
additionalProperties- AMapof additional properties.
-
getAdditionalProperty
Retrieves a single additional property by its key.- Specified by:
getAdditionalPropertyin interfaceContext- 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 interfaceContext- Specified by:
setAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property.value- The value of the additional property.
-