Interface TypeProjection
-
- All Superinterfaces:
Element,PropertyElement,Serializable
- All Known Implementing Classes:
TypeProjectionImpl
@TypeMetadata(name="TypeProjection", description="The type used to store a Type\'s instance-list projection.", version="1.0.0") @Change(version="1.0.0", description="First Version") public interface TypeProjection extends PropertyElement
A curated or auto-generated field-selection query, attached to aType, 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 bareProjection: the latter already denotes, generically, the response shape any_emit-bearing query produces (seeappendix/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, notIdentifiableElement: a TypeProjection has noidof its own (it is never addressed by one), but still carriesmetadata, declared directly here rather than inherited.- Author:
- Luca Frosini (ISTI - CNR)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTypeProjection.SourceWhether 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
Fields Modifier and Type Field Description static StringDESCRIPTION_PROPERTYThe property name for the projection's description.static StringMETADATA_PROPERTYThe property name for the projection's metadata.static StringNAMEThe name of the TypeProjection property type.static StringQUERY_PROPERTYThe property name for the projection's query.static StringSOURCE_PROPERTYThe 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
All Methods Instance Methods Abstract 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 interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
-
-
-
Field Detail
-
NAME
static final String NAME
The name of the TypeProjection property type.- See Also:
- Constant Field Values
-
METADATA_PROPERTY
static final String METADATA_PROPERTY
The property name for the projection's metadata.- See Also:
- Constant Field Values
-
QUERY_PROPERTY
static final String QUERY_PROPERTY
The property name for the projection's query.- See Also:
- Constant Field Values
-
DESCRIPTION_PROPERTY
static final String DESCRIPTION_PROPERTY
The property name for the projection's description.- See Also:
- Constant Field Values
-
SOURCE_PROPERTY
static final String SOURCE_PROPERTY
The property name for the projection's source.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void setMetadata(Metadata metadata)
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.JsonProcessingException
Returns 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
void setDescription(String description)
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
void setSource(TypeProjection.Source source)
Sets the source of this projection.- Parameters:
source- the source
-
-