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
-
public class DBSExpressionEvaluator extends ExpressionEvaluator
Expression evaluator for aDBSDocument
state.- Since:
- 5.9.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DBSExpressionEvaluator.DBSPathResolver
protected static class
DBSExpressionEvaluator.IterInfo
Info about an iterator and how to compute it from a state.protected static class
DBSExpressionEvaluator.ValueInfo
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
Fields Modifier and Type Field Description protected List<DBSExpressionEvaluator.IterInfo>
allIterInfos
List of all iterators, in reversed order.protected Map<String,DBSExpressionEvaluator.IterInfo>
canonicalPrefixIterInfos
Map of canonical reference prefix to iterator.protected Map<String,DBSExpressionEvaluator.ValueInfo>
canonicalReferenceValueInfos
Map of canonical reference to value info.protected List<String>
documentTypes
protected Expression
expression
protected boolean
hasWildcard
protected OrderByClause
orderByClause
protected boolean
parsing
protected int
refCount
protected List<DBSExpressionEvaluator.ValueInfo>
referenceValueInfos
For each encountered reference in traversal order, the corresponding value info.protected SchemaManager
schemaManager
protected SelectClause
selectClause
protected State
state
protected List<DBSExpressionEvaluator.IterInfo>
toplevelIterInfos
The toplevel iterators.protected List<DBSExpressionEvaluator.ValueInfo>
toplevelValueInfos
The toplevel values, computed without wildcards.protected int
uncorrelatedCounter
-
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
Constructors Constructor Description DBSExpressionEvaluator(DBSSession session, SQLQuery query, String[] principals, boolean fulltextSearchDisabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addProjection(Reference ref, Map<String,Serializable> projection)
protected boolean
checkSecurity(State state)
protected List<String>
getDocumentTypes()
Expression
getExpression()
protected Set<String>
getMixinDocumentTypes(String mixin)
OrderByClause
getOrderByClause()
SelectClause
getSelectClause()
boolean
hasWildcardProjection()
protected boolean
incrementIterators()
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
initializeValuesAndIterators(State state)
Initializes toplevel values and iterators for a given state.protected boolean
isNeverPerInstanceMixin(String mixin)
List<Map<String,Serializable>>
matches(State state)
Returns the projection matches for a given state.void
parse()
Initializes parsing datastructures.protected DBSExpressionEvaluator.ValueInfo
parseACP(String[] parts, String name)
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.String
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.Boolean
walkMixinTypes(List<String> mixins, boolean include)
Matches the mixin types against a list of values.Object
walkReference(Reference ref)
Evaluates a reference over the context state.protected DBSExpressionEvaluator.ValueInfo
walkReferenceGetValueInfo(Reference ref)
Map<String,Serializable>
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 Detail
-
selectClause
protected final SelectClause selectClause
-
expression
protected final Expression expression
-
orderByClause
protected final OrderByClause orderByClause
-
schemaManager
protected SchemaManager schemaManager
-
state
protected State state
-
parsing
protected boolean parsing
-
referenceValueInfos
protected List<DBSExpressionEvaluator.ValueInfo> referenceValueInfos
For each encountered reference in traversal order, the corresponding value info.
-
canonicalReferenceValueInfos
protected Map<String,DBSExpressionEvaluator.ValueInfo> canonicalReferenceValueInfos
Map of canonical reference to value info.
-
canonicalPrefixIterInfos
protected Map<String,DBSExpressionEvaluator.IterInfo> canonicalPrefixIterInfos
Map of canonical reference prefix to iterator.
-
allIterInfos
protected List<DBSExpressionEvaluator.IterInfo> allIterInfos
List of all iterators, in reversed order.
-
toplevelIterInfos
protected List<DBSExpressionEvaluator.IterInfo> toplevelIterInfos
The toplevel iterators.
-
toplevelValueInfos
protected List<DBSExpressionEvaluator.ValueInfo> toplevelValueInfos
The toplevel values, computed without wildcards.
-
uncorrelatedCounter
protected int uncorrelatedCounter
-
hasWildcard
protected boolean hasWildcard
-
refCount
protected int refCount
-
-
Constructor Detail
-
DBSExpressionEvaluator
public DBSExpressionEvaluator(DBSSession session, SQLQuery query, String[] principals, boolean fulltextSearchDisabled)
-
-
Method Detail
-
getSelectClause
public SelectClause getSelectClause()
-
getExpression
public Expression getExpression()
-
getOrderByClause
public OrderByClause getOrderByClause()
-
isNeverPerInstanceMixin
protected boolean isNeverPerInstanceMixin(String mixin)
-
parse
public void parse()
Initializes parsing datastructures.
-
matches
public List<Map<String,Serializable>> matches(State state)
Returns the projection matches for a given state.
-
checkSecurity
protected boolean checkSecurity(State state)
-
walkAll
protected Map<String,Serializable> 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
protected void addProjection(Reference ref, Map<String,Serializable> projection)
-
hasWildcardProjection
public boolean hasWildcardProjection()
-
walkReference
public Object walkReference(Reference ref)
Description copied from class:ExpressionEvaluator
Evaluates a reference over the context state.- Specified by:
walkReference
in classExpressionEvaluator
- Parameters:
ref
- the reference
-
walkReferenceGetValueInfo
protected DBSExpressionEvaluator.ValueInfo walkReferenceGetValueInfo(Reference ref)
-
parseReference
protected DBSExpressionEvaluator.ValueInfo parseReference(Reference ref)
Parses and computes value and iterator information for a reference.
-
parseReference
protected DBSExpressionEvaluator.ValueInfo parseReference(String name, String originalName)
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
protected DBSExpressionEvaluator.ValueInfo parseACP(String[] parts, String name)
-
initializeValuesAndIterators
protected void initializeValuesAndIterators(State state)
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
protected Object traverse(Object value, List<Serializable> steps)
Traverses an object in a series of steps.
-
traverse
protected Object traverse(Object value, Serializable step)
Traverses a single step.
-
incrementIterators
protected boolean incrementIterators()
Increments iterators lexicographically.Returns
true
when all iterations are finished.
-
walkMixinTypes
public 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')
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
-
-