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
The default implementation of the
TypeProjection interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gcube.informationsystem.types.reference.properties.TypeProjection
TypeProjection.Source -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe description of this projection.protected MetadataThe metadata of this projection.protected org.gcube.com.fasterxml.jackson.databind.ObjectMapperThe object mapper, used to convertqueryto/from its string form.protected org.gcube.com.fasterxml.jackson.databind.JsonNodeThe query defining this projection.protected TypeProjection.SourceWhether this projection is auto-generated or custom.Fields inherited from class org.gcube.informationsystem.base.impl.properties.PropertyElementImpl
additionalProperties, allowedAdditionalKeys, expectedType, supertypesFields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, REDACTED, TYPE_PROPERTY, UNKNOWN_USERFields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTYFields inherited from interface org.gcube.informationsystem.model.reference.properties.Property
NAMEFields inherited from interface org.gcube.informationsystem.types.reference.properties.TypeProjection
DESCRIPTION_PROPERTY, METADATA_PROPERTY, NAME, QUERY_PROPERTY, SOURCE_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the description of this projection — which fields/columns it returns and why.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.Returns the query body as a string.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.voidSets 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, setAdditionalPropertyMethods 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
getTypeName
-
Field Details
-
objectMapper
protected org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapperThe object mapper, used to convertqueryto/from its string form. -
metadata
The metadata of this projection. -
query
protected org.gcube.com.fasterxml.jackson.databind.JsonNode queryThe query defining this projection. -
description
The description of this projection. -
source
Whether this projection is auto-generated or custom.
-
-
Constructor Details
-
TypeProjectionImpl
public TypeProjectionImpl()Default constructor.
-
-
Method Details
-
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
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.JsonProcessingExceptionReturns 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
Returns the description of this projection — which fields/columns it returns and why.- Specified by:
getDescriptionin interfaceTypeProjection- Returns:
- the description
-
setDescription
Sets the description of this projection.- Specified by:
setDescriptionin interfaceTypeProjection- Parameters:
description- the description
-
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
Sets the source of this projection.- Specified by:
setSourcein interfaceTypeProjection- Parameters:
source- the source
-