java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.queries.ProjectionValueSerializer

public class ProjectionValueSerializer extends Object
Serializes the embedded Property values projected by an _emit query as a read does.

An embedded value is serialized by PropertyElementManagement.getJsonNode(ODocument): an Encrypted value is therefore returned encrypted with the key of the Context of the request. When the caller reads the sensitive metadata identity fields redacted, a projected Metadata value is redacted too. A projected value holding no embedded value is left to the query executor.

Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • objectMapper

      protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapper
      In-use Jackson object mapper.
    • maskMetadata

      protected final boolean maskMetadata
      Whether the caller reads the sensitive metadata identity fields redacted.
  • Constructor Details

    • ProjectionValueSerializer

      public ProjectionValueSerializer(boolean maskMetadata)
      Parameters:
      maskMetadata - true if the caller reads the sensitive metadata identity fields redacted
  • Method Details

    • serialize

      public org.gcube.com.fasterxml.jackson.databind.JsonNode serialize(Object value) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Serializes a projected value that is, or holds, an embedded Property value.
      Parameters:
      value - the projected value
      Returns:
      the JSON representation, or null if the value neither is nor holds an embedded value
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the value is a record instead of a property value
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the value cannot be serialized