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 voidaddCondition(Query condition)Allow to add one condition to the current parsed Request Example:protected voidanalyzeRootQuery(com.fasterxml.jackson.databind.JsonNode command){ expression }protected voidfilterParse(com.fasterxml.jackson.databind.JsonNode rootNode)Filter partintgetLastDepth()booleanhintCache()booleanhintNoTimeout()BuilderToken.FILTERARGSmodel()protected voidparseJson(com.fasterxml.jackson.databind.JsonNode jsonRequest)protected voidparseQueryOnly(java.lang.String query)protected voidqueryParse(com.fasterxml.jackson.databind.JsonNode rootNode){ query } if one level onlyjava.lang.StringtoString()-
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:
parseJsonin 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 InvalidParseOperationExceptionFilter 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:
toStringin classjava.lang.Object
-
hintNoTimeout
public boolean hintNoTimeout()
- Specified by:
hintNoTimeoutin classAbstractParser<RequestSingle>- Returns:
- True if the hint contains notimeout
-
getLastDepth
public int getLastDepth()
- Specified by:
getLastDepthin classAbstractParser<RequestSingle>- Returns:
- int the depth of the query
-
model
public BuilderToken.FILTERARGS model()
- Specified by:
modelin classAbstractParser<RequestSingle>- Returns:
- FILTERARGS the filter argument
-
hintCache
public boolean hintCache()
- Specified by:
hintCachein classAbstractParser<RequestSingle>- Returns:
- true if not cache hint
-
-