Interface TypeProjection
- All Superinterfaces:
Element,PropertyElement,Serializable
- All Known Implementing Classes:
TypeProjectionImpl
Type, used to shape the list
view of that Type's instances. Unlike a Query Template, a TypeProjection is
unparameterized (no variables) and has no independent identity of its own — it is
always reached through the Type it belongs to, never addressed on its own.
Named TypeProjection, not the bare Projection: the latter already
denotes, generically, the response shape any _emit-bearing query produces
(see appendix/07-json-query-syntax-reference.md's "Response Projection
(`_emit`)"), so it would collide with that pre-existing usage. This type is one
specific, canonical, always-present projection rule attached to a Type — not any
arbitrary `_emit`-shaped query result.
Deliberately extends PropertyElement, not
IdentifiableElement: a
TypeProjection has no id of its own (it is never addressed by one), but
still carries metadata, declared directly here rather than inherited.
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumWhether aTypeProjectionwas computed by the auto-generation algorithm, defined by an admin, or is the minimal safety-net fallback used when the full auto-generation computation itself fails. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property name for the projection's description.static final StringThe property name for the projection's metadata.static final StringThe name of the TypeProjection property type.static final StringThe property name for the projection's query.static final StringThe property name for the projection's source.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, REDACTED, TYPE_PROPERTY, UNKNOWN_USER -
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 interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Field Details
-
NAME
The name of the TypeProjection property type.- See Also:
-
METADATA_PROPERTY
The property name for the projection's metadata.- See Also:
-
QUERY_PROPERTY
The property name for the projection's query.- See Also:
-
DESCRIPTION_PROPERTY
The property name for the projection's description.- See Also:
-
SOURCE_PROPERTY
The property name for the projection's source.- See Also:
-
-
Method Details
-
getMetadata
@ISProperty(name="metadata", description="Who generated or last changed this projection, and when.", readonly=true, mandatory=true) 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.- Returns:
- the metadata
-
setMetadata
Sets the metadata associated with this projection.- Parameters:
metadata- the metadata
-
getQueryAsString
@ISProperty(name="query", description="The QBE (Query By Example) query defining this projection. Unlike a Query Template, it is unparameterized: it never contains variables.", readonly=false, mandatory=true) String getQueryAsString() throws org.gcube.com.fasterxml.jackson.core.JsonProcessingExceptionReturns the query body as a string.- Returns:
- the query as a string
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if an error occurs during serialization
-
setQuery
void setQuery(String query) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException Sets the query body from a string.- Parameters:
query- the query as a string- Throws:
IOException- if an error occurs during parsingorg.gcube.com.fasterxml.jackson.core.JsonProcessingException- if an error occurs during JSON processing
-
setQuery
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.- Parameters:
query- the query as aJsonNode
-
getQuery
org.gcube.com.fasterxml.jackson.databind.JsonNode getQuery()Returns the query body as aJsonNode.- Returns:
- the query as a
JsonNode
-
getDescription
@ISProperty(name="description", description="Which fields/columns this projection returns, and why.", readonly=false, mandatory=true) String getDescription()Returns the description of this projection — which fields/columns it returns and why.- Returns:
- the description
-
setDescription
Sets the description of this projection.- Parameters:
description- the description
-
getSource
@ISProperty(name="source", description="Whether this projection is auto-generated or custom (admin-defined). Server-assigned, never client-submittable.", readonly=true, mandatory=true) 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.- Returns:
- the source
-
setSource
Sets the source of this projection.- Parameters:
source- the source
-