Package org.nuxeo.ecm.core.storage.dbs
Class DBSExpressionEvaluator
java.lang.Object
org.nuxeo.ecm.core.storage.ExpressionEvaluator
org.nuxeo.ecm.core.storage.dbs.DBSExpressionEvaluator
Expression evaluator for a
DBSDocument
state.- Since:
- 5.9.4
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static final class
Info about an iterator and how to compute it from a state.protected static final class
Info about a value and how to compute it from the toplevel state or an iterator's state.Nested classes/interfaces inherited from class org.nuxeo.ecm.core.storage.ExpressionEvaluator
ExpressionEvaluator.PathResolver
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<DBSExpressionEvaluator.IterInfo>
List of all iterators, in reversed order.protected Map<String,
DBSExpressionEvaluator.IterInfo> Map of canonical reference prefix to iterator.protected Map<String,
DBSExpressionEvaluator.ValueInfo> Map of canonical reference to value info.protected final Expression
protected boolean
protected final OrderByClause
protected boolean
protected int
protected List<DBSExpressionEvaluator.ValueInfo>
For each encountered reference in traversal order, the corresponding value info.protected SchemaManager
protected final SelectClause
protected State
protected List<DBSExpressionEvaluator.IterInfo>
The toplevel iterators.protected List<DBSExpressionEvaluator.ValueInfo>
The toplevel values, computed without wildcards.protected int
Fields inherited from class org.nuxeo.ecm.core.storage.ExpressionEvaluator
DATE_CAST, fulltextSearchDisabled, hasFulltext, NEG_PHRASE_QUOTE, NXQL_ECM_ANCESTOR_IDS, NXQL_ECM_FULLTEXT_BINARY, NXQL_ECM_FULLTEXT_SIMPLE, NXQL_ECM_PATH, NXQL_ECM_READ_ACL, OR, pathResolver, PHRASE_QUOTE, principals
-
Constructor Summary
ConstructorDescriptionDBSExpressionEvaluator
(DBSSession session, SQLQuery query, String[] principals, boolean fulltextSearchDisabled) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addProjection
(Reference ref, Map<String, Serializable> projection) protected boolean
checkSecurity
(State state) getMixinDocumentTypes
(String mixin) boolean
protected boolean
Increments iterators lexicographically.protected void
init
(Object state, List<DBSExpressionEvaluator.ValueInfo> valueInfos, List<DBSExpressionEvaluator.IterInfo> iterInfos) Initializes values and iterators for a given state.protected void
Initializes toplevel values and iterators for a given state.protected boolean
isNeverPerInstanceMixin
(String mixin) Returns the projection matches for a given state.void
parse()
Initializes parsing datastructures.protected DBSExpressionEvaluator.ValueInfo
protected DBSExpressionEvaluator.ValueInfo
parseReference
(String name, String originalName) Gets the canonical reference and parsed reference for this reference name.protected DBSExpressionEvaluator.ValueInfo
parseReference
(Reference ref) Parses and computes value and iterator information for a reference.toString()
protected Object
traverse
(Object value, Serializable step) Traverses a single step.protected Object
traverse
(Object value, List<Serializable> steps) Traverses an object in a series of steps.protected Map<String,
Serializable> walkAll()
Does one walk of the expression, using the wildcardIndexes currently defined.walkMixinTypes
(List<String> mixins, boolean include) Matches the mixin types against a list of values.walkReference
(Reference ref) Evaluates a reference over the context state.protected DBSExpressionEvaluator.ValueInfo
walkSelectClauseAndOrderBy
(SelectClause selectClause, OrderByClause orderByClause) Walks the select clause and order by clause, and returns the projection.Methods inherited from class org.nuxeo.ecm.core.storage.ExpressionEvaluator
and, bool, checkDateLiteralForCast, cmp, cmp, eq, eqMaybeList, fulltext, fulltext, fulltext1, in, inMaybeList, isMixinTypes, like, likeMaybeList, likeToRegex, not, or, walkAncestorId, walkAnd, walkBetween, walkBooleanLiteral, walkDateLiteral, walkDoubleLiteral, walkEcmFulltext, walkEcmPath, walkEq, walkExpression, walkFunction, walkGt, walkGtEq, walkIn, walkIntegerLiteral, walkIsNotNull, walkIsNull, walkIsTrashed, walkIsTrashed, walkLike, walkLiteral, walkLiteralList, walkLt, walkLtEq, walkMultiExpression, walkNot, walkNotEq, walkOperand, walkOr, walkStartsWith, walkStartsWithNonPath, walkStartsWithPath, walkStringLiteral
-
Field Details
-
selectClause
-
expression
-
orderByClause
-
schemaManager
-
documentTypes
-
state
-
parsing
protected boolean parsing -
referenceValueInfos
For each encountered reference in traversal order, the corresponding value info. -
canonicalReferenceValueInfos
Map of canonical reference to value info. -
canonicalPrefixIterInfos
Map of canonical reference prefix to iterator. -
allIterInfos
List of all iterators, in reversed order. -
toplevelIterInfos
The toplevel iterators. -
toplevelValueInfos
The toplevel values, computed without wildcards. -
hasWildcard
protected boolean hasWildcard -
refCount
protected int refCount
-
-
Constructor Details
-
DBSExpressionEvaluator
public DBSExpressionEvaluator(DBSSession session, SQLQuery query, String[] principals, boolean fulltextSearchDisabled)
-
-
Method Details
-
getSelectClause
-
getExpression
-
getOrderByClause
-
getDocumentTypes
-
getMixinDocumentTypes
-
isNeverPerInstanceMixin
-
parse
public void parse()Initializes parsing datastructures. -
matches
Returns the projection matches for a given state. -
checkSecurity
-
walkAll
Does one walk of the expression, using the wildcardIndexes currently defined. -
walkSelectClauseAndOrderBy
public Map<String,Serializable> walkSelectClauseAndOrderBy(SelectClause selectClause, OrderByClause orderByClause) Walks the select clause and order by clause, and returns the projection. -
addProjection
-
hasWildcardProjection
public boolean hasWildcardProjection() -
walkReference
Description copied from class:ExpressionEvaluator
Evaluates a reference over the context state.- Specified by:
walkReference
in classExpressionEvaluator
- Parameters:
ref
- the reference
-
walkReferenceGetValueInfo
-
parseReference
Parses and computes value and iterator information for a reference. -
parseReference
Gets the canonical reference and parsed reference for this reference name.The parsed reference is a list of components to traverse to get the value:
- String = map key
- Integer = list element
- Long = wildcard correlation number (pos/neg)
- Returns:
- the canonical reference (with resolved uncorrelated wildcards)
-
parseACP
-
initializeValuesAndIterators
Initializes toplevel values and iterators for a given state. -
init
protected void init(Object state, List<DBSExpressionEvaluator.ValueInfo> valueInfos, List<DBSExpressionEvaluator.IterInfo> iterInfos) Initializes values and iterators for a given state. -
traverse
Traverses an object in a series of steps. -
traverse
Traverses a single step. -
incrementIterators
protected boolean incrementIterators()Increments iterators lexicographically.Returns
true
when all iterations are finished. -
walkMixinTypes
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')
ecm:mixinTypes IN ('Foo', 'Bar')
primarytype IN (... types with Foo or Bar ...) OR mixintypes LIKE '%Foo%' OR mixintypes LIKE '%Bar%'
ecm:mixinTypes NOT IN ('Foo', 'Bar')
primarytype IN (... types without Foo nor Bar ...) AND (mixintypes NOT LIKE '%Foo%' AND mixintypes NOT LIKE '%Bar%' OR mixintypes IS NULL)
- Specified by:
walkMixinTypes
in classExpressionEvaluator
- Parameters:
mixins
- the mixin(s) to matchinclude
-true
for = and IN
-
toString
-