public class QueryState
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
QueryFunction
instances.DataSource
,
QueryFunction
,
Serialized FormConstructor and Description |
---|
QueryState()
Instantiate a QueryState with empty function list.
|
QueryState(org.json.JSONArray serializedState)
Instantiate a QueryState from a serialized representation.
|
Modifier and Type | Method and Description |
---|---|
void |
addFunction(QueryFunction function)
Deprecated.
use
addFunction(QueryFunction,SemanticView,Locale) instead TODO: make this method private? |
void |
addFunction(QueryFunction function,
SemanticView semanticView,
java.util.Locale currentLocale)
Add a specified QueryFunction to this QueryState, checking for duplicate multi select attribute refinements and override any single
select attribute refinements
The attribute keys in the QueryFunctions are substituted with locale-specific attribute keys using semanticView, which is an
AttributeKeyConverter . |
void |
addFunctions(java.util.List<? extends QueryFunction> functions)
Deprecated.
use
addFunctions(List, SemanticView, Locale) instead |
void |
addFunctions(java.util.List<? extends QueryFunction> functions,
SemanticView semanticView,
java.util.Locale currentLocale)
Add a list of QueryFunctions to this QueryState The attribute keys in the QueryFunctions are substituted with locale-specific attribute
keys using semanticView, which is an
AttributeKeyConverter . |
QueryState |
clone() |
static java.util.List<QueryFunction> |
cloneFunctionList(java.util.List<QueryFunction> list)
Clone a List of QueryFunction instances.
|
boolean |
equivalent(QueryState q)
Convenience method to check equivalence of query states A QueryState is equivalent to another if they contain the same non-QueryConfig
QueryFunctions, in the same order.
|
java.util.List<QueryFunction> |
getFunctions()
Get direct access to the QueryFunction list.
|
<T extends QueryFunction> |
getFunctions(java.lang.Class<T> klass)
Get a list of all query functions of the specified class (determined using .isInstance) associated with the specified viewKey.
|
int |
getNextQueryFilterId()
Gets a unique ID value to use on filters contained in this state.
|
long |
getQueryStateVersion() |
void |
removeAllFunctions()
Clear all query functions from this query state
|
void |
removeFunction(QueryFunction function)
Remove particular function based on .equals() equality
|
void |
removeFunctions(java.lang.Class<? extends QueryFunction> klass)
Removes each filter in the list of a given type (determined using .isInstance).
|
void |
removeFunctions(java.util.List<? extends QueryFunction> functions)
Remove each function in the given list based on .equals() equality
|
protected void |
setQueryStateVersion(long queryStateVersion) |
void |
swapFunctionOrder(int oldIndex,
int newIndex)
Used to maintain consistency in the ordering of functions for the selected attribute portal
|
org.json.JSONArray |
toBookmarkJSON()
Create a JSON representation of this query state to be saved in a Studio Bookmark.
|
java.lang.String |
toGroovyFilter(DataSource ds,
java.lang.String sourceCollectionKey)
Generate String in Groovy syntax representing the filters in query state
|
org.json.JSONArray |
toJSON()
Create a JSON representation of this query state and its query functions.
|
java.lang.String |
toSparkSqlFilter(DataSource ds,
java.lang.String sourceCollectionKey)
Generate String in SparkSQL syntax representing the filters in query state
|
java.lang.String |
toString() |
public QueryState()
public QueryState(org.json.JSONArray serializedState)
serializedState
- toJSON()
@Deprecated public void addFunction(QueryFunction function)
addFunction(QueryFunction,SemanticView,Locale)
instead TODO: make this method private?function
- the function to addpublic void addFunction(QueryFunction function, SemanticView semanticView, java.util.Locale currentLocale)
AttributeKeyConverter
.function
- semanticView
- currentLocale
- @Deprecated public void addFunctions(java.util.List<? extends QueryFunction> functions)
addFunctions(List, SemanticView, Locale)
insteadfunctions
- the list of functions to addpublic void addFunctions(java.util.List<? extends QueryFunction> functions, SemanticView semanticView, java.util.Locale currentLocale)
AttributeKeyConverter
.functions
- semanticView
- currentLocale
- public void removeFunction(QueryFunction function)
function
- The function to removepublic void removeFunctions(java.util.List<? extends QueryFunction> functions)
functions
- The functions to removepublic void removeFunctions(java.lang.Class<? extends QueryFunction> klass)
klass
- The class of filters to removepublic void removeAllFunctions()
public void swapFunctionOrder(int oldIndex, int newIndex)
oldIndex
- - location to swap fromnewIndex
- - location to swap topublic java.util.List<QueryFunction> getFunctions()
public <T extends QueryFunction> java.util.List<T> getFunctions(java.lang.Class<T> klass)
T
- klass
- The class, extending from QueryFunction, to match againstpublic org.json.JSONArray toJSON()
public org.json.JSONArray toBookmarkJSON()
QueryFunction
spublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toGroovyFilter(DataSource ds, java.lang.String sourceCollectionKey)
ds
- Data SourcesourceCollectionKey
- Stringpublic java.lang.String toSparkSqlFilter(DataSource ds, java.lang.String sourceCollectionKey)
ds
- Data SourcesourceCollectionKey
- Stringpublic QueryState clone()
clone
in class java.lang.Object
public static java.util.List<QueryFunction> cloneFunctionList(java.util.List<QueryFunction> list)
list
- the list to clonepublic boolean equivalent(QueryState q)
q
- The query state to compare againstpublic int getNextQueryFilterId()
public long getQueryStateVersion()
protected void setQueryStateVersion(long queryStateVersion)
Copyright 2003, 2014, Oracle and/or its affiliates. All rights reserved.