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
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
ConstructorDescriptionConstructor for Internal APIRequestParserSingle
(VarNameAdapter adapter) Constructor for Masterdata -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
boolean
boolean
model()
protected void
parseJson
(com.fasterxml.jackson.databind.JsonNode jsonRequest) protected void
parseQueryOnly
(String query) protected void
queryParse
(com.fasterxml.jackson.databind.JsonNode rootNode) { query } if one level onlytoString()
Methods inherited from class fr.gouv.vitam.common.database.parser.request.AbstractParser
analyzeOneCommand, getAdapter, getNewRequest, getRequest, getRootNode, getSource, hasFullTextQuery, parse, parseOrderByFilter
-
Constructor Details
-
RequestParserSingle
public RequestParserSingle()Constructor for Internal API -
RequestParserSingle
Constructor for Masterdata- Parameters:
adapter
- VarNameAdapter
-
-
Method Details
-
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
- 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
-
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
- 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
-