Class RequestParserSingle
- java.lang.Object
-
- fr.gouv.vitam.common.database.parser.request.AbstractParser<RequestSingle>
-
- fr.gouv.vitam.common.database.parser.request.single.RequestParserSingle
-
- Direct Known Subclasses:
DeleteParserSingle
,InsertParserSingle
,SelectParserSingle
,UpdateParserSingle
public abstract class RequestParserSingle extends AbstractParser<RequestSingle>
Single Request Parser (common base) { $query : query, $filter : filter }
-
-
Field Summary
-
Fields inherited from class fr.gouv.vitam.common.database.parser.request.AbstractParser
adapter, hasFullTextCurrentQuery, hasFullTextQuery, request, rootNode, sourceRequest
-
-
Constructor Summary
Constructors Constructor Description RequestParserSingle()
Constructor for Internal APIRequestParserSingle(VarNameAdapter adapter)
Constructor for Masterdata
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCondition(Query condition)
Allow to add one condition to the current parsed Request Example:protected void
analyzeRootQuery(com.fasterxml.jackson.databind.JsonNode command)
{ expression }protected void
filterParse(com.fasterxml.jackson.databind.JsonNode rootNode)
Filter partint
getLastDepth()
boolean
hintCache()
boolean
hintNoTimeout()
BuilderToken.FILTERARGS
model()
protected void
parseJson(com.fasterxml.jackson.databind.JsonNode jsonRequest)
protected void
parseQueryOnly(java.lang.String query)
protected void
queryParse(com.fasterxml.jackson.databind.JsonNode rootNode)
{ query } if one level onlyjava.lang.String
toString()
-
Methods inherited from class fr.gouv.vitam.common.database.parser.request.AbstractParser
analyzeOneCommand, getAdapter, getNewRequest, getRequest, getRootNode, getSource, hasFullTextQuery, parse, parseOrderByFilter
-
-
-
-
Constructor Detail
-
RequestParserSingle
public RequestParserSingle()
Constructor for Internal API
-
RequestParserSingle
public RequestParserSingle(VarNameAdapter adapter)
Constructor for Masterdata- Parameters:
adapter
- VarNameAdapter
-
-
Method Detail
-
parseJson
protected void parseJson(com.fasterxml.jackson.databind.JsonNode jsonRequest) throws InvalidParseOperationException
- Overrides:
parseJson
in classAbstractParser<RequestSingle>
- Parameters:
jsonRequest
- containing a parsed JSON as { $query : query, $filter : filter }- Throws:
InvalidParseOperationException
- if jsonRequest could not parse to JSON
-
parseQueryOnly
protected void parseQueryOnly(java.lang.String query) throws InvalidParseOperationException
- Parameters:
query
- containing only the JSON query part (no filter)- Throws:
InvalidParseOperationException
- if query could not parse to JSON or sanity check to query is in error
-
filterParse
protected void filterParse(com.fasterxml.jackson.databind.JsonNode rootNode) throws InvalidParseOperationException
Filter part- Parameters:
rootNode
- JsonNode- Throws:
InvalidParseOperationException
- if rootNode could not parse to JSON
-
queryParse
protected void queryParse(com.fasterxml.jackson.databind.JsonNode rootNode) throws InvalidParseOperationException
{ query } if one level only- Parameters:
rootNode
- JsonNode- Throws:
InvalidParseOperationException
- if rootNode could not parse to JSON
-
analyzeRootQuery
protected void analyzeRootQuery(com.fasterxml.jackson.databind.JsonNode command) throws InvalidParseOperationException, InvalidCreateOperationException
{ expression }- Parameters:
command
- JsonNode- Throws:
InvalidParseOperationException
- if command is null or command could not parse to JSONInvalidCreateOperationException
- if could not set query to request or analyzeOneCommand is in error
-
addCondition
public void addCondition(Query condition) throws InvalidCreateOperationException, InvalidParseOperationException
Allow to add one condition to the current parsed Request Example:SelectParserSingle parser = new SelectParserSingle(...); parser.parse(jsonQuery); parser.addCondition(eq(FieldName, value)); JsonNode newJsonQuery = parser.getRootNode();
- Parameters:
condition
- the condition to add- Throws:
InvalidCreateOperationException
- when invalid create query exception occurredInvalidParseOperationException
- hen invalid parse data to create query
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hintNoTimeout
public boolean hintNoTimeout()
- Specified by:
hintNoTimeout
in classAbstractParser<RequestSingle>
- Returns:
- True if the hint contains notimeout
-
getLastDepth
public int getLastDepth()
- Specified by:
getLastDepth
in classAbstractParser<RequestSingle>
- Returns:
- int the depth of the query
-
model
public BuilderToken.FILTERARGS model()
- Specified by:
model
in classAbstractParser<RequestSingle>
- Returns:
- FILTERARGS the filter argument
-
hintCache
public boolean hintCache()
- Specified by:
hintCache
in classAbstractParser<RequestSingle>
- Returns:
- true if not cache hint
-
-