Class JsonQueryERElement

    • Field Detail

      • logger

        protected org.slf4j.Logger logger
      • objectMapper

        protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapper
      • type

        protected final String type
      • jsonNode

        protected final org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode
      • accessType

        protected final org.gcube.informationsystem.base.reference.AccessType accessType
      • fieldNamesToRemove

        protected final Set<String> fieldNamesToRemove
      • direction

        protected org.gcube.informationsystem.base.reference.Direction direction
      • entryPoint

        protected boolean entryPoint
      • projection

        protected boolean projection
        Instruct the JSON query analyzer if it is a projection
      • breadcrumb

        protected List<JsonQueryERElement> breadcrumb
        The chain of callers of this instance analyzer. breadcrumb.get(breadcrumb.size-1) == caller breadcrumb is empty if this instance is an entry point
      • position

        protected int position
        The breadcrumb.size() provide the level of nesting. The position which element number at the same level. E.g. the index of a ConsistsOf when the caller is a Resource. It is used in conjunction with breadcrumb.size() to attach a number to the alias. This allows to generate a predictive not clashing alias instead of using random string/number. This is useful for testing purposes.
      • alias

        protected String alias
        Contains the alias if needed by the class
      • fieldsToEmit

        protected List<String> fieldsToEmit
        This field is used by entry point only. Any class at any level can retrieve the entry point using breadcrumb.get(0);
      • size

        protected int size
        it indicates the number of properties in this.jsonNode This number is manipulated while analyzing the jsonNode to properly create the query.
      • traverseBack

        protected boolean traverseBack
    • Constructor Detail

      • JsonQueryERElement

        public JsonQueryERElement​(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonQuery,
                                  org.gcube.informationsystem.base.reference.AccessType accessType)
                           throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException,
                                  org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • Method Detail

      • validateType

        public static void validateType​(String type,
                                        org.gcube.informationsystem.base.reference.AccessType requiredAccessType)
                                 throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException,
                                        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • getType

        public String getType()
      • getDirection

        public org.gcube.informationsystem.base.reference.Direction getDirection()
      • setDirection

        public void setDirection​(org.gcube.informationsystem.base.reference.Direction direction)
      • isEntryPoint

        public boolean isEntryPoint()
      • setEntryPoint

        public void setEntryPoint​(boolean entryPoint)
      • isProjection

        public boolean isProjection()
      • setProjection

        public void setProjection​(boolean projection)
      • getPosition

        public int getPosition()
      • setPosition

        public void setPosition​(int position)
      • getAlias

        public String getAlias()
      • getAlias

        public String getAlias​(boolean generateifNull)
      • addFieldToEmit

        protected void addFieldToEmit​(String fieldToEmit)
        Add a field to emit only if this instance is the entry point
        Parameters:
        fieldToEmit -
      • isTraverseBack

        public boolean isTraverseBack()
      • setTraverseBack

        public void setTraverseBack​(boolean traverseBack)
      • createQuery

        public StringBuffer createQuery​(StringBuffer stringBuffer)
                                 throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException,
                                        org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException,
                                        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException,
                                        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • createTraversalQuery

        public abstract StringBuffer createTraversalQuery​(StringBuffer stringBuffer)
                                                   throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException,
                                                          org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException,
                                                          org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException,
                                                          org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • addConstraints

        protected StringBuffer addConstraints​(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode,
                                              LogicalOperator queryLogicalOperator,
                                              String fieldNamePrefix)
                                       throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
      • evaluateNode

        protected StringBuffer evaluateNode​(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode,
                                            String fieldName,
                                            String fieldNamePrefix)
                                     throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
      • getValue

        protected String getValue​(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)
      • wrapMatchQuery

        protected StringBuffer wrapMatchQuery​(StringBuffer buffer)
                                       throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException
      • getSpecificMatchQuery

        protected abstract StringBuffer getSpecificMatchQuery​(List<JsonQueryERElement> childrenBreadcrumb)
                                                       throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException,
                                                              org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • createMatchQuery

        public StringBuffer createMatchQuery​(StringBuffer stringBuffer)
                                      throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException,
                                             org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException