Class TypeProjectionImpl
- java.lang.Object
-
- org.gcube.informationsystem.base.impl.ElementImpl
-
- org.gcube.informationsystem.base.impl.properties.PropertyElementImpl
-
- org.gcube.informationsystem.types.impl.properties.TypeProjectionImpl
-
- All Implemented Interfaces:
Serializable,Element,PropertyElement,SchemaMixedElement,ModelElement,Property,TypeProjection
public class TypeProjectionImpl extends PropertyElementImpl implements TypeProjection
The default implementation of theTypeProjectioninterface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.gcube.informationsystem.types.reference.properties.TypeProjection
TypeProjection.Source
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdescriptionThe description of this projection.protected MetadatametadataThe metadata of this projection.protected org.gcube.com.fasterxml.jackson.databind.ObjectMapperobjectMapperThe object mapper, used to convertqueryto/from its string form.protected org.gcube.com.fasterxml.jackson.databind.JsonNodequeryThe query defining this projection.protected TypeProjection.SourcesourceWhether this projection is auto-generated or custom.-
Fields inherited from class org.gcube.informationsystem.base.impl.properties.PropertyElementImpl
additionalProperties, allowedAdditionalKeys, expectedType, supertypes
-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, REDACTED, TYPE_PROPERTY, UNKNOWN_USER
-
Fields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.model.reference.properties.Property
NAME
-
Fields inherited from interface org.gcube.informationsystem.types.reference.properties.TypeProjection
DESCRIPTION_PROPERTY, METADATA_PROPERTY, NAME, QUERY_PROPERTY, SOURCE_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description TypeProjectionImpl()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescription()Returns the description of this projection — which fields/columns it returns and why.MetadatagetMetadata()Returns the metadata associated with this projection (who generated or last changed it, and when).org.gcube.com.fasterxml.jackson.databind.JsonNodegetQuery()Returns the query body as aJsonNode.StringgetQueryAsString()Returns the query body as a string.TypeProjection.SourcegetSource()Returns whether this projection isTypeProjection.Source.AUTO_GENERATEDorTypeProjection.Source.CUSTOM.voidsetDescription(String description)Sets the description of this projection.voidsetMetadata(Metadata metadata)Sets the metadata associated with this projection.voidsetQuery(String query)Sets the query body from a string.voidsetQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode query)Sets the query body from aJsonNode.voidsetSource(TypeProjection.Source source)Sets the source of this projection.-
Methods inherited from class org.gcube.informationsystem.base.impl.properties.PropertyElementImpl
addAllowedAdditionalKey, getAdditionalProperties, getAdditionalProperty, getExpectedType, getSupertypes, setAdditionalProperties, setAdditionalProperty
-
Methods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
-
-
-
Field Detail
-
objectMapper
protected org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapper
The object mapper, used to convertqueryto/from its string form.
-
metadata
protected Metadata metadata
The metadata of this projection.
-
query
protected org.gcube.com.fasterxml.jackson.databind.JsonNode query
The query defining this projection.
-
description
protected String description
The description of this projection.
-
source
protected TypeProjection.Source source
Whether this projection is auto-generated or custom.
-
-
Method Detail
-
getMetadata
public Metadata getMetadata()
Returns the metadata associated with this projection (who generated or last changed it, and when). Declared directly here, not inherited fromIdentifiableElement, since a TypeProjection has noidof its own.- Specified by:
getMetadatain interfaceTypeProjection- Returns:
- the metadata
-
setMetadata
public void setMetadata(Metadata metadata)
Sets the metadata associated with this projection.- Specified by:
setMetadatain interfaceTypeProjection- Parameters:
metadata- the metadata
-
getQueryAsString
public String getQueryAsString() throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
Returns the query body as a string.- Specified by:
getQueryAsStringin interfaceTypeProjection- Returns:
- the query as a string
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if an error occurs during serialization
-
setQuery
public void setQuery(String query) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException
Sets the query body from a string.- Specified by:
setQueryin interfaceTypeProjection- Parameters:
query- the query as a string- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if an error occurs during JSON processingIOException- if an error occurs during parsing
-
getQuery
public org.gcube.com.fasterxml.jackson.databind.JsonNode getQuery()
Returns the query body as aJsonNode.- Specified by:
getQueryin interfaceTypeProjection- Returns:
- the query as a
JsonNode
-
setQuery
public void setQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode query)
Sets the query body from aJsonNode.Deliberately typed as
JsonNode, not a polymorphicElementreference — the query's content embeds its own"type"(e.g."EService"), which describes what it queries, not a real instance to deserialize. Typing it as a plainJsonNodekeepsElement's@JsonTypeInfo-driven polymorphic resolution from being triggered on that embedded discriminator — the exact same reasonQueryTemplate.setTemplate(JsonNode)is typed the same way.- Specified by:
setQueryin interfaceTypeProjection- Parameters:
query- the query as aJsonNode
-
getDescription
public String getDescription()
Returns the description of this projection — which fields/columns it returns and why.- Specified by:
getDescriptionin interfaceTypeProjection- Returns:
- the description
-
setDescription
public void setDescription(String description)
Sets the description of this projection.- Specified by:
setDescriptionin interfaceTypeProjection- Parameters:
description- the description
-
getSource
public TypeProjection.Source getSource()
Returns whether this projection isTypeProjection.Source.AUTO_GENERATEDorTypeProjection.Source.CUSTOM. Never client-submittable: assigned by the server depending on whether the owning Type has an admin-defined projection.- Specified by:
getSourcein interfaceTypeProjection- Returns:
- the source
-
setSource
public void setSource(TypeProjection.Source source)
Sets the source of this projection.- Specified by:
setSourcein interfaceTypeProjection- Parameters:
source- the source
-
-