Class MongoDBAbstractQueryBuilder
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.mongodb.MongoDBAbstractQueryBuilder
-
- Direct Known Subclasses:
MongoDBRepositoryQueryBuilder
,MongoDBSession.MongoDBDirectoryQueryBuilder
public abstract class MongoDBAbstractQueryBuilder extends Object
Abstract query builder for a MongoDB query from anExpression
.Must be customized by defining an implementation for the
walkReference(String)
method.- Since:
- 5.9.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MongoDBAbstractQueryBuilder.FieldInfo
-
Field Summary
Fields Modifier and Type Field Description protected MongoDBConverter
converter
protected static String
DATE_CAST
protected String
elemMatchPrefix
Prefix to remove for $elemMatch (including final dot), ornull
if there's no current prefix to remove.protected Expression
expression
protected static String
LIKE_ANCHORED_PROP
protected boolean
likeAnchored
static Long
LONG_ONE
static Long
LONG_ZERO
static Double
MINUS_ONE
static Double
ONE
protected org.bson.Document
query
protected static Pattern
SLASH_WILDCARD_SLASH
-
Constructor Summary
Constructors Constructor Description MongoDBAbstractQueryBuilder(MongoDBConverter converter, Expression expression)
-
Method Summary
-
-
-
Field Detail
-
LONG_ZERO
public static final Long LONG_ZERO
-
LONG_ONE
public static final Long LONG_ONE
-
ONE
public static final Double ONE
-
MINUS_ONE
public static final Double MINUS_ONE
-
DATE_CAST
protected static final String DATE_CAST
- See Also:
- Constant Field Values
-
LIKE_ANCHORED_PROP
protected static final String LIKE_ANCHORED_PROP
- See Also:
- Constant Field Values
-
converter
protected final MongoDBConverter converter
-
expression
protected final Expression expression
-
query
protected org.bson.Document query
-
elemMatchPrefix
protected String elemMatchPrefix
Prefix to remove for $elemMatch (including final dot), ornull
if there's no current prefix to remove.
-
likeAnchored
protected boolean likeAnchored
-
SLASH_WILDCARD_SLASH
protected static final Pattern SLASH_WILDCARD_SLASH
-
-
Constructor Detail
-
MongoDBAbstractQueryBuilder
public MongoDBAbstractQueryBuilder(MongoDBConverter converter, Expression expression)
-
-
Method Detail
-
walk
public void walk()
-
getQuery
public org.bson.Document getQuery()
-
walkExpression
public org.bson.Document walkExpression(Expression expr)
-
checkDateLiteralForCast
protected void checkDateLiteralForCast(Operator op, Operand value, String name)
-
walkNot
public org.bson.Document walkNot(Operand value)
-
newDocumentWithField
protected org.bson.Document newDocumentWithField(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, Object value)
-
walkIsNull
public org.bson.Document walkIsNull(Operand value)
-
walkIsNotNull
public org.bson.Document walkIsNotNull(Operand value)
-
walkAndOrMultiExpression
public org.bson.Document walkAndOrMultiExpression(MultiExpression expr)
-
walkAndOr
public org.bson.Document walkAndOr(Expression expr)
-
walkAndOr
protected org.bson.Document walkAndOr(Expression expr, List<? extends Operand> values)
-
getMongoDBPrefix
protected String getMongoDBPrefix(String prefix)
Computes the MongoDB prefix from the DBS common prefix.foo/bar/*1 -> foo.bar. ecm:acp/*1/acl/*1 -> ecm:acp.acl.
-
walkEq
public org.bson.Document walkEq(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, Operand rvalue)
-
walkNotEq
public org.bson.Document walkNotEq(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, Operand rvalue)
-
walkIn
public org.bson.Document walkIn(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, Operand rvalue, boolean positive)
-
walkLike
public org.bson.Document walkLike(Operand lvalue, Operand rvalue, boolean positive, boolean caseInsensitive)
-
walkOperand
public Object walkOperand(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, Operand op)
-
walkLiteral
public Object walkLiteral(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, Literal lit)
-
walkBooleanLiteral
public Object walkBooleanLiteral(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, BooleanLiteral lit)
-
walkDateLiteral
public Date walkDateLiteral(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, DateLiteral lit)
-
walkDoubleLiteral
public Double walkDoubleLiteral(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, DoubleLiteral lit)
-
walkIntegerLiteral
public Object walkIntegerLiteral(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, IntegerLiteral lit)
-
walkStringLiteral
public Object walkStringLiteral(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, StringLiteral lit)
-
walkLiteralList
public List<Object> walkLiteralList(MongoDBAbstractQueryBuilder.FieldInfo fieldInfo, LiteralList litList)
-
walkReference
protected MongoDBAbstractQueryBuilder.FieldInfo walkReference(Operand value)
-
walkReference
public MongoDBAbstractQueryBuilder.FieldInfo walkReference(Reference ref)
Returns the MongoDB field for this reference.
-
walkReference
protected abstract MongoDBAbstractQueryBuilder.FieldInfo walkReference(String name)
Walks a reference, and returns field info about it.
-
-