Package org.nuxeo.ecm.core.storage
Class ExpressionEvaluator
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.ExpressionEvaluator
-
- Direct Known Subclasses:
DBSExpressionEvaluator
,MapExpressionEvaluator
public abstract class ExpressionEvaluator extends Object
Evaluator for anExpression
.- Since:
- 5.9.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ExpressionEvaluator.PathResolver
Interface for a class that knows how to resolve a path into an id.
-
Field Summary
Fields Modifier and Type Field Description protected static String
DATE_CAST
boolean
fulltextSearchDisabled
boolean
hasFulltext
protected static String
NEG_PHRASE_QUOTE
static String
NXQL_ECM_ANCESTOR_IDS
pseudo NXQL to resolve ancestor ids.static String
NXQL_ECM_FULLTEXT_BINARY
static String
NXQL_ECM_FULLTEXT_SIMPLE
static String
NXQL_ECM_PATH
pseudo NXQL to resolve internal path.static String
NXQL_ECM_READ_ACL
pseudo NXQL to resolve read acls.protected static String
OR
ExpressionEvaluator.PathResolver
pathResolver
protected static String
PHRASE_QUOTE
Set<String>
principals
-
Constructor Summary
Constructors Constructor Description ExpressionEvaluator(ExpressionEvaluator.PathResolver pathResolver, String[] principals, boolean fulltextSearchDisabled)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Boolean
and(Boolean left, Boolean right)
protected Boolean
bool(Object value)
protected void
checkDateLiteralForCast(Operand value, String name)
protected Integer
cmp(Object left, Object right)
protected Integer
cmp(Operand lvalue, Operand rvalue)
protected Boolean
eq(Object left, Object right)
protected Boolean
eqMaybeList(Object left, Object right)
protected static Boolean
fulltext(String string1, String string2, String queryString)
Checks if the fulltext combination of string1 and string2 matches the query expression.protected static boolean
fulltext(Set<String> fulltext, List<String> query)
protected static boolean
fulltext1(Set<String> fulltext, List<String> query)
protected Boolean
in(Object left, List<Object> right)
protected Boolean
inMaybeList(Object left, List<Object> right)
protected boolean
isMixinTypes(Operand op)
protected Boolean
like(Object left, String right, boolean caseInsensitive)
protected Boolean
likeMaybeList(Object left, String right, boolean positive, boolean caseInsensitive)
static String
likeToRegex(String like)
Turns a NXQL LIKE pattern into a regex.protected Boolean
not(Boolean value)
protected Boolean
or(Boolean left, Boolean right)
protected Boolean
walkAncestorId(Operator op, Operand rvalue)
Boolean
walkAnd(Operand lvalue, Operand rvalue)
Object
walkBetween(Operand lvalue, Operand rvalue, boolean positive)
Boolean
walkBooleanLiteral(BooleanLiteral lit)
Calendar
walkDateLiteral(DateLiteral lit)
Double
walkDoubleLiteral(DoubleLiteral lit)
protected Boolean
walkEcmFulltext(String name, Operator op, Operand rvalue)
protected Boolean
walkEcmPath(Operator op, Operand rvalue)
Boolean
walkEq(Operand lvalue, Operand rvalue)
Object
walkExpression(Expression expr)
Object
walkFunction(Function func)
Boolean
walkGt(Operand lvalue, Operand rvalue)
Boolean
walkGtEq(Operand lvalue, Operand rvalue)
Boolean
walkIn(Operand lvalue, Operand rvalue, boolean positive)
Long
walkIntegerLiteral(IntegerLiteral lit)
Boolean
walkIsNotNull(Operand value)
Boolean
walkIsNull(Operand value)
protected Boolean
walkIsTrashed(Operator op, Operand rvalue)
protected Boolean
walkIsTrashed(Reference ref, Operator op, Operand initialRvalue, Literal deletedRvalue)
Boolean
walkLike(Operand lvalue, Operand rvalue, boolean positive, boolean caseInsensitive)
Object
walkLiteral(Literal lit)
List<Object>
walkLiteralList(LiteralList litList)
Boolean
walkLt(Operand lvalue, Operand rvalue)
Boolean
walkLtEq(Operand lvalue, Operand rvalue)
abstract Boolean
walkMixinTypes(List<String> mixins, boolean include)
Matches the mixin types against a list of values.Boolean
walkMultiExpression(MultiExpression expr)
Boolean
walkNot(Operand value)
Boolean
walkNotEq(Operand lvalue, Operand rvalue)
Object
walkOperand(Operand op)
Boolean
walkOr(Operand lvalue, Operand rvalue)
abstract Object
walkReference(Reference ref)
Evaluates a reference over the context state.Boolean
walkStartsWith(Operand lvalue, Operand rvalue)
protected Boolean
walkStartsWithNonPath(Operand lvalue, String path)
protected Boolean
walkStartsWithPath(String path)
String
walkStringLiteral(StringLiteral lit)
-
-
-
Field Detail
-
NXQL_ECM_ANCESTOR_IDS
public static final String NXQL_ECM_ANCESTOR_IDS
pseudo NXQL to resolve ancestor ids.- See Also:
- Constant Field Values
-
NXQL_ECM_PATH
public static final String NXQL_ECM_PATH
pseudo NXQL to resolve internal path.- See Also:
- Constant Field Values
-
NXQL_ECM_READ_ACL
public static final String NXQL_ECM_READ_ACL
pseudo NXQL to resolve read acls.- See Also:
- Constant Field Values
-
NXQL_ECM_FULLTEXT_SIMPLE
public static final String NXQL_ECM_FULLTEXT_SIMPLE
- See Also:
- Constant Field Values
-
NXQL_ECM_FULLTEXT_BINARY
public static final String NXQL_ECM_FULLTEXT_BINARY
- See Also:
- Constant Field Values
-
DATE_CAST
protected static final String DATE_CAST
- See Also:
- Constant Field Values
-
PHRASE_QUOTE
protected static final String PHRASE_QUOTE
- See Also:
- Constant Field Values
-
NEG_PHRASE_QUOTE
protected static final String NEG_PHRASE_QUOTE
- See Also:
- Constant Field Values
-
OR
protected static final String OR
- See Also:
- Constant Field Values
-
pathResolver
public final ExpressionEvaluator.PathResolver pathResolver
-
fulltextSearchDisabled
public final boolean fulltextSearchDisabled
-
hasFulltext
public boolean hasFulltext
-
-
Constructor Detail
-
ExpressionEvaluator
public ExpressionEvaluator(ExpressionEvaluator.PathResolver pathResolver, String[] principals, boolean fulltextSearchDisabled)
-
-
Method Detail
-
walkExpression
public Object walkExpression(Expression expr)
-
walkIsTrashed
protected Boolean walkIsTrashed(Reference ref, Operator op, Operand initialRvalue, Literal deletedRvalue)
-
walkMultiExpression
public Boolean walkMultiExpression(MultiExpression expr)
-
walkBooleanLiteral
public Boolean walkBooleanLiteral(BooleanLiteral lit)
-
walkDateLiteral
public Calendar walkDateLiteral(DateLiteral lit)
-
walkDoubleLiteral
public Double walkDoubleLiteral(DoubleLiteral lit)
-
walkIntegerLiteral
public Long walkIntegerLiteral(IntegerLiteral lit)
-
walkStringLiteral
public String walkStringLiteral(StringLiteral lit)
-
walkLiteralList
public List<Object> walkLiteralList(LiteralList litList)
-
walkLike
public Boolean walkLike(Operand lvalue, Operand rvalue, boolean positive, boolean caseInsensitive)
-
walkReference
public abstract Object walkReference(Reference ref)
Evaluates a reference over the context state.- Parameters:
ref
- the reference
-
isMixinTypes
protected boolean isMixinTypes(Operand op)
-
likeToRegex
public static String likeToRegex(String like)
Turns a NXQL LIKE pattern into a regex.% and _ are standard wildcards, and \ escapes them.
- Since:
- 7.4
-
likeMaybeList
protected Boolean likeMaybeList(Object left, String right, boolean positive, boolean caseInsensitive)
-
walkMixinTypes
public abstract Boolean walkMixinTypes(List<String> mixins, boolean include)
Matches the mixin types against a list of values.Used for:
- ecm:mixinTypes = 'foo'
- ecm:mixinTypes != 'foo'
- ecm:mixinTypes IN ('foo', 'bar')
- ecm:mixinTypes NOT IN ('foo', 'bar')
- Parameters:
mixins
- the mixin(s) to matchinclude
-true
for = and IN- Since:
- 7.4
-
fulltext
protected static Boolean fulltext(String string1, String string2, String queryString)
Checks if the fulltext combination of string1 and string2 matches the query expression.
-
-