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 a 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)
  • Field Details

  • 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 from IdentifiableElement, since a TypeProjection has no id of 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 parsing
      org.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 a JsonNode.

      Deliberately typed as JsonNode, not a polymorphic Element reference — 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 plain JsonNode keeps Element's @JsonTypeInfo-driven polymorphic resolution from being triggered on that embedded discriminator — the exact same reason QueryTemplate.setTemplate(JsonNode) is typed the same way.

      Parameters:
      query - the query as a JsonNode
    • getQuery

      org.gcube.com.fasterxml.jackson.databind.JsonNode getQuery()
      Returns the query body as a JsonNode.
      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 is TypeProjection.Source.AUTO_GENERATED or TypeProjection.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