public class QueryContext
extends com.exalead.access.feedapi.eval.mel.extension.VariableResolver
implements java.lang.Cloneable
com.exalead.access.feedapi.eval.mel.extension.VariableResolver.FieldsHolder
Constructor and Description |
---|
QueryContext()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addContextNode(Feed feed)
Deprecated.
as of 2013x release, replaced by
registerPageParameters(Feed) . |
void |
addContextNode(java.lang.String identifier,
ResultFeed resultFeed,
Entry entry)
Deprecated.
as of 2013x release, replaced by
pushFeedEntry(String, ResultFeed, Entry) . |
QueryContext |
clone()
Returns a copy of this QueryContext.
|
QueryContext |
createSubContext()
Creates a copy a this context, copying parameters scope & resetting local variables if we are in an asynchronous case.
|
QueryContext |
createSubContext(boolean synchronizedContext)
Creates a copy a this context, copying parameters scope & resetting local variables if we are in an asynchronous case.
|
void |
deleteLastNode(java.lang.String identifier)
Deprecated.
as of 2013x release, replaced by
popFeedEntry(String) . |
void |
disableFeed(Feed feed)
Disable the provided feed for the current running query.
|
void |
dump() |
void |
dump(org.apache.log4j.Logger logger)
Dumps a complete overview of the current QueryContext in the provided logger at a trace level.
|
void |
embedFeed(Feed feed,
boolean embedFeed)
Embed the given feed or not for the current running query.
|
void |
enableFeed(Feed feed)
Enable the given feed for the current running query.
|
java.lang.String |
eval(java.lang.String mELExpression)
Evaluates a MEL expression using the MELExpressionEvaluator.
|
java.lang.String |
eval(java.lang.String mELExpression,
boolean urlEncode,
boolean xmlEscape,
boolean highlight)
Deprecated.
as of 2013x release, replaced by
eval(String, MELFlags) |
java.lang.String |
eval(java.lang.String mELExpression,
com.exalead.access.feedapi.eval.mel.extension.types.MELFlags defaultFlags)
Evaluates a MEL expression using the MELExpressionEvaluator.
|
Feed |
getCurrentFeed()
Returns the feed currently processed.
|
Entry |
getEntry()
Returns the current entry.
|
<T> T |
getGlobalVariable(java.lang.String identifier)
Gets a global variable (kept across sub-contexts).
|
<T> T |
getLocalVariable(java.lang.String identifier)
Gets a local variable.
|
java.util.Map<java.lang.String,java.lang.Object> |
getLocalVariables()
Gets the local variables.
|
java.util.List<java.lang.String> |
getParametersNames(java.lang.String feedId,
boolean prefixParameters)
Get all the parameter names found in the query string for the given feed identifier that are now contained in the feed definition.
|
java.util.List<java.lang.String> |
getParametersNamesFromPattern(java.lang.String feedId,
boolean prefixParameters)
Deprecated.
as of 2013x release, replaced by
getParametersNames(String, boolean) . |
Feed |
getParentFeed()
Find the direct parent Feed of the current entry.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getQueryParams()
Gets the HTTP query parameters.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getRawHttpParams()
Deprecated.
as of 2013x release, replaced by
getQueryParams() . |
Feed |
getRootFeed()
Returns the root feed of the current query.
|
java.lang.String[] |
getSecurityTokens()
Get the Security Tokens provided with the user request.
|
java.lang.String |
getUsername()
Returns the username provided with the user request.
|
java.lang.String |
getUserQueryID()
Returns the user query identifier provided with the user request.
|
java.lang.String |
getUserSessionID()
Returns the user session identifier provided with the user request.
|
boolean |
isDebugEnabled()
Returns whether the request is executed in a debug context.
|
boolean |
isFeedEmbed(Feed feed)
Check whether the given feed is embed or not.
|
boolean |
isFeedEnabled(Feed feed)
Check whether the given feed is enabled or not.
|
java.util.List<java.lang.String> |
lookupValues(java.lang.String variable,
java.lang.String flags)
Looks up for a parameter / variable name in the context nodes and returns all values found or an empty list.
|
void |
overrideParameter(Feed feed,
java.lang.String name,
java.util.List<java.lang.String> values)
Override a parameter's values for the given Feed, for the current running query.
|
void |
overrideParameter(Feed feed,
java.lang.String name,
java.lang.String value)
Override a parameter's value for the given Feed, for the current running query.
|
void |
popFeedEntry(java.lang.String identifier)
Pop the feed & entry stacks.
|
void |
pushFeedEntry(java.lang.String identifier,
ResultFeed resultFeed,
Entry entry)
Push the previous feed & entry scopes values onto the feed & entry stacks.
|
void |
pushFeedResult(java.lang.String identifier,
ResultFeed resultFeed)
Push the previous feed onto the feed stack.
|
void |
registerPageParameters(Feed feed)
Register parameters of the given feed to the page.params scope.
|
java.util.List<java.lang.String> |
resolve(java.lang.String variable,
java.lang.String flags)
Support the generic VariableResolver interface resolve call.
|
void |
restoreContext(Feed feed)
Restore the context to its original state after a
switchContext(Feed) call. |
<T> void |
setGlobalVariable(java.lang.String identifier,
T variable)
Sets a global variable (kept across sub-contexts).
|
<T> void |
setLocalVariable(java.lang.String identifier,
T variable)
Sets a local variable.
|
void |
setLocalVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
Sets the local variables.
|
void |
setQueryParams(java.util.Map<java.lang.String,java.lang.String[]> queryParams)
Sets the HTTP query parameters.
|
void |
setRootFeed(Feed rootFeed)
Sets the root feed for the current query.
|
<T> void |
setVariable(java.lang.String identifier,
T variable)
Deprecated.
Since 2013x release, replaced by
setGlobalVariable(String, Object) .
The method VariableResolver.getVariable(String) will not return the expected value, you now have to use getGlobalVariable(String) .
We're sorry for this move, but it was a necessary one. |
void |
switchContext(Feed feed)
Fakes the query context to behave as if we were in the context of the provided Feed.
|
clearScopes, getDefaultFlags, getFields, getScopes, getVariable, getVariables, putScope, removeScope, resolve, setDefaultFlags, setVariable, setVariables
accept, collateTo, getFlags, rawStringValue, resolveField, resolveOperation, setFlags, stringValue, stringValue, visit, visitBoolean, visitCategory, visitCategory, visitFacet, visitFacet, visitFeed, visitList, visitMeta, visitNumber, visitString, visitUnknown
public void setQueryParams(java.util.Map<java.lang.String,java.lang.String[]> queryParams)
queryParams
- the HTTP query parameters.public java.util.Map<java.lang.String,java.lang.String[]> getQueryParams()
@Deprecated public java.util.Map<java.lang.String,java.lang.String[]> getRawHttpParams()
getQueryParams()
.public void pushFeedResult(java.lang.String identifier, ResultFeed resultFeed)
identifier
- the ResultFeed identifier.resultFeed
- the ResultFeed to be pushed on the feed stack.public void pushFeedEntry(java.lang.String identifier, ResultFeed resultFeed, Entry entry)
identifier
- the ResultFeed identifier.resultFeed
- the ResultFeed to be pushed on the feed stack.entry
- the Entry to be pushed on the entry stack.public void popFeedEntry(java.lang.String identifier)
identifier
- the identifier of the ResultFeed to be removed from the feeds scope.@Deprecated public void addContextNode(java.lang.String identifier, ResultFeed resultFeed, Entry entry)
pushFeedEntry(String, ResultFeed, Entry)
.identifier
- the ResultFeed identifier.resultFeed
- the ResultFeed to be pushed on the feed stack.entry
- the Entry to be pushed on the entry stack.@Deprecated public void deleteLastNode(java.lang.String identifier)
popFeedEntry(String)
.identifier
- the identifier of the ResultFeed to be removed from the feeds scope.public void registerPageParameters(Feed feed) throws AccessException
feed
- the given Feed.AccessException
@Deprecated public void addContextNode(Feed feed) throws AccessException
registerPageParameters(Feed)
.feed
- the given Feed.AccessException
public java.util.List<java.lang.String> lookupValues(java.lang.String variable, java.lang.String flags)
variable
- a variable name.flags
- variable flags.public java.util.List<java.lang.String> resolve(java.lang.String variable, java.lang.String flags)
variable
- a variable nameflags
- variable flagspublic java.lang.String eval(java.lang.String mELExpression)
mELExpression
- a MEL expression (e.g: ${search.q})@Deprecated public java.lang.String eval(java.lang.String mELExpression, boolean urlEncode, boolean xmlEscape, boolean highlight)
eval(String, MELFlags)
mELExpression
- a MEL expression (e.g: ${search.q})urlEncode
- true if by default MEL variables should be URL encodedxmlEscape
- true if by default MEL variables should be XML escapedhighlight
- true if by default MEL variables should be highlightedpublic java.lang.String eval(java.lang.String mELExpression, com.exalead.access.feedapi.eval.mel.extension.types.MELFlags defaultFlags)
mELExpression
- a MEL expression (e.g: ${search.q})defaultFlags
- the default flags to be used while resolving MEL variablespublic java.util.List<java.lang.String> getParametersNames(java.lang.String feedId, boolean prefixParameters)
feedId
- the given feed identifier.prefixParameters
- true to prefix parameters name with the feedId, false otherwise.@Deprecated public java.util.List<java.lang.String> getParametersNamesFromPattern(java.lang.String feedId, boolean prefixParameters)
getParametersNames(String, boolean)
.feedId
- the given feed identifier.prefixParameters
- true to prefix parameters name with the feedId, false otherwise.public java.lang.String[] getSecurityTokens()
public java.lang.String getUsername()
public java.lang.String getUserSessionID()
public java.lang.String getUserQueryID()
public boolean isDebugEnabled()
public void setRootFeed(Feed rootFeed) throws AccessException
rootFeed
- the root feed to be set.AccessException
- if the root feed is not a PageFeed instance.public Feed getRootFeed()
public Feed getCurrentFeed()
public void overrideParameter(Feed feed, java.lang.String name, java.lang.String value)
feed
- the Feed containing the parameter to be overridden.name
- the name of the parameter to be overridden.value
- the parameter's value.public void overrideParameter(Feed feed, java.lang.String name, java.util.List<java.lang.String> values)
feed
- the Feed containing the parameter to be overridden.name
- the name of the parameter to be overridden.value
- the parameter's values.public void disableFeed(Feed feed)
feed
- the provided feed.public void enableFeed(Feed feed)
feed
- the given feed.public boolean isFeedEnabled(Feed feed)
feed
- the given feed.public void embedFeed(Feed feed, boolean embedFeed)
feed
- the given feed.embedFeed
- true if the feed shall be embed, false otherwise.public boolean isFeedEmbed(Feed feed)
feed
- the given feed.public void switchContext(Feed feed) throws AccessException
feed
- the provided feed.AccessException
public void restoreContext(Feed feed)
switchContext(Feed)
call.public QueryContext createSubContext()
public QueryContext createSubContext(boolean synchronizedContext)
synchronizedContext
- true if we need a synchronized context, false otherwise.public <T> void setVariable(java.lang.String identifier, T variable)
setGlobalVariable(String, Object)
.
The method VariableResolver.getVariable(String)
will not return the expected value, you now have to use getGlobalVariable(String)
.
We're sorry for this move, but it was a necessary one.T
- identifier
- the variable identifier (e.g: a.b).variable
- the variable to be stored globally.public <T> void setGlobalVariable(java.lang.String identifier, T variable)
identifier
- the variable identifier (e.g: a.b).variable
- the variable to be stored globally.public <T> T getGlobalVariable(java.lang.String identifier)
identifier
- the variable identifier (e.g: a.b).public <T> void setLocalVariable(java.lang.String identifier, T variable)
identifier
- the variable identifier (e.g: a.b).variable
- the variable to be stored locally.public <T> T getLocalVariable(java.lang.String identifier)
identifier
- the variable identifier (e.g: a.b).public java.util.Map<java.lang.String,java.lang.Object> getLocalVariables()
public void setLocalVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
variables
- the local variables to be set.public Feed getParentFeed()
public Entry getEntry()
public QueryContext clone()
clone
in class java.lang.Object
public void dump()
public void dump(org.apache.log4j.Logger logger)
logger
- a Logger that will be used to dump the current QueryContext.Copyright © 2021 Dassault Systèmes, All Rights Reserved.