Class JsonQueryERElement
java.lang.Object
org.gcube.informationsystem.resourceregistry.queries.json.base.JsonQueryERElement
- Direct Known Subclasses:
JsonQueryEntity,JsonQueryRelation
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.gcube.informationsystem.base.reference.AccessTypeprotected StringContains the alias if needed by the classprotected List<JsonQueryERElement>The chain of callers of this instance analyzer.protected org.gcube.informationsystem.base.reference.Directionprotected booleanThis field is used by entry point only.protected final org.gcube.com.fasterxml.jackson.databind.JsonNodeprotected org.slf4j.Loggerprotected final org.gcube.com.fasterxml.jackson.databind.ObjectMapperprotected intThe breadcrumb.size() provide the level of nesting.protected booleanInstruct the JSON query analyzer if it is a projectionprotected intit indicates the number of properties in this.jsonNode This number is manipulated while analyzing the jsonNode to properly create the query.protected booleanprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionJsonQueryERElement(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonQuery, org.gcube.informationsystem.base.reference.AccessType accessType) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringBufferaddConstraints(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode, LogicalOperator queryLogicalOperator, String fieldNamePrefix) protected voidaddFieldToEmit(String fieldToEmit) Add a field to emit only if this instance is the entry pointcreateMatchQuery(StringBuffer stringBuffer) createQuery(StringBuffer stringBuffer) abstract StringBuffercreateTraversalQuery(StringBuffer stringBuffer) protected StringBufferevaluateNode(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode, String fieldName, String fieldNamePrefix) protected StringBuffergetAlias()getAlias(boolean generateifNull) protected List<JsonQueryERElement>org.gcube.informationsystem.base.reference.Directionprotected Stringintprotected abstract StringBuffergetSpecificMatchQuery(List<JsonQueryERElement> childrenBreadcrumb) getType()protected StringgetValue(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) booleanbooleanbooleanvoidsetBreadcrumb(List<JsonQueryERElement> breadcrumb) voidsetDirection(org.gcube.informationsystem.base.reference.Direction direction) voidsetEntryPoint(boolean entryPoint) voidsetPosition(int position) voidsetProjection(boolean projection) voidsetTraverseBack(boolean traverseBack) static voidvalidateType(String type, org.gcube.informationsystem.base.reference.AccessType requiredAccessType) protected StringBufferwrapMatchQuery(StringBuffer buffer)
-
Field Details
-
logger
protected org.slf4j.Logger logger -
objectMapper
protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapper -
type
-
jsonNode
protected final org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode -
accessType
protected final org.gcube.informationsystem.base.reference.AccessType accessType -
fieldNamesToRemove
-
direction
protected org.gcube.informationsystem.base.reference.Direction direction -
entryPoint
protected boolean entryPoint -
projection
protected boolean projectionInstruct the JSON query analyzer if it is a projection -
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 positionThe 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
Contains the alias if needed by the class -
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 sizeit 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 Details
-
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.SchemaExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
-
Method Details
-
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.SchemaExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
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) -
getBreadcrumb
-
setBreadcrumb
-
getPosition
public int getPosition() -
setPosition
public void setPosition(int position) -
getAlias
-
getAlias
-
generateAlias
-
addFieldToEmit
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.SchemaNotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaExceptionorg.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.SchemaNotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaExceptionorg.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
-
getKey
-
getValue
-
getChildrenBreadcrumb
-
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.SchemaExceptionorg.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.SchemaExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-