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 interfaceExpressionEvaluator.PathResolverInterface for a class that knows how to resolve a path into an id.
-
Field Summary
Fields Modifier and Type Field Description protected static StringDATE_CASTbooleanfulltextSearchDisabledbooleanhasFulltextprotected static StringNEG_PHRASE_QUOTEstatic StringNXQL_ECM_ANCESTOR_IDSpseudo NXQL to resolve ancestor ids.static StringNXQL_ECM_FULLTEXT_BINARYstatic StringNXQL_ECM_FULLTEXT_SIMPLEstatic StringNXQL_ECM_PATHpseudo NXQL to resolve internal path.static StringNXQL_ECM_READ_ACLpseudo NXQL to resolve read acls.protected static StringORExpressionEvaluator.PathResolverpathResolverprotected static StringPHRASE_QUOTESet<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 Booleanand(Boolean left, Boolean right)protected Booleanbool(Object value)protected voidcheckDateLiteralForCast(Operand value, String name)protected Integercmp(Object left, Object right)protected Integercmp(Operand lvalue, Operand rvalue)protected Booleaneq(Object left, Object right)protected BooleaneqMaybeList(Object left, Object right)protected static Booleanfulltext(String string1, String string2, String queryString)Checks if the fulltext combination of string1 and string2 matches the query expression.protected static booleanfulltext(Set<String> fulltext, List<String> query)protected static booleanfulltext1(Set<String> fulltext, List<String> query)protected Booleanin(Object left, List<Object> right)protected BooleaninMaybeList(Object left, List<Object> right)protected booleanisMixinTypes(Operand op)protected Booleanlike(Object left, String right, boolean caseInsensitive)protected BooleanlikeMaybeList(Object left, String right, boolean positive, boolean caseInsensitive)static StringlikeToRegex(String like)Turns a NXQL LIKE pattern into a regex.protected Booleannot(Boolean value)protected Booleanor(Boolean left, Boolean right)protected BooleanwalkAncestorId(Operator op, Operand rvalue)BooleanwalkAnd(Operand lvalue, Operand rvalue)ObjectwalkBetween(Operand lvalue, Operand rvalue, boolean positive)BooleanwalkBooleanLiteral(BooleanLiteral lit)CalendarwalkDateLiteral(DateLiteral lit)DoublewalkDoubleLiteral(DoubleLiteral lit)protected BooleanwalkEcmFulltext(String name, Operator op, Operand rvalue)protected BooleanwalkEcmPath(Operator op, Operand rvalue)BooleanwalkEq(Operand lvalue, Operand rvalue)ObjectwalkExpression(Expression expr)ObjectwalkFunction(Function func)BooleanwalkGt(Operand lvalue, Operand rvalue)BooleanwalkGtEq(Operand lvalue, Operand rvalue)BooleanwalkIn(Operand lvalue, Operand rvalue, boolean positive)LongwalkIntegerLiteral(IntegerLiteral lit)BooleanwalkIsNotNull(Operand value)BooleanwalkIsNull(Operand value)protected BooleanwalkIsTrashed(Operator op, Operand rvalue)protected BooleanwalkIsTrashed(Reference ref, Operator op, Operand initialRvalue, Literal deletedRvalue)BooleanwalkLike(Operand lvalue, Operand rvalue, boolean positive, boolean caseInsensitive)ObjectwalkLiteral(Literal lit)List<Object>walkLiteralList(LiteralList litList)BooleanwalkLt(Operand lvalue, Operand rvalue)BooleanwalkLtEq(Operand lvalue, Operand rvalue)abstract BooleanwalkMixinTypes(List<String> mixins, boolean include)Matches the mixin types against a list of values.BooleanwalkMultiExpression(MultiExpression expr)BooleanwalkNot(Operand value)BooleanwalkNotEq(Operand lvalue, Operand rvalue)ObjectwalkOperand(Operand op)BooleanwalkOr(Operand lvalue, Operand rvalue)abstract ObjectwalkReference(Reference ref)Evaluates a reference over the context state.BooleanwalkStartsWith(Operand lvalue, Operand rvalue)protected BooleanwalkStartsWithNonPath(Operand lvalue, String path)protected BooleanwalkStartsWithPath(String path)StringwalkStringLiteral(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-truefor = 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.
-
-