public final class CQLQueryModel
extends java.lang.Object
A CQL query model. Special contexts are <code>facet</code>, <code>filter</code>, and <code>option</code>. These contexts form breadcrumb trails. Bread crumbs provide a means for a server to track an chronologically ordered set of client actions. Bread crumbs are typically rendered as a user-driven constructed list of links, and are useful when users select them to drill down and up in a structure, so that they can find their way and have a notion of where they currently are. Bread crumbs in the original sense just represent where users are situated in a site hierarchy. For example, when browsing a library catalog, bread crumbs could look like this: <pre> Home > Scientific literature > Arts & Human > Philosophy </pre> or <pre> Main library > Branch library > First floor > Rare book room </pre> These items would be rendered as links to the corresponding location. Classes that implement this interface are responsible for managing such a bread crumb structure. A typical implementation regards bread crumbs as a set of elements. When a bread crumb is activated that was not in the set yet, it would add it to the set, or when a bread crumb is activated that is already on the set, it would roll back to the corresponding depth. In this model, multiple bread crumb trails may exist side by side. They are separate and do not depend on each other. There is a list of bread crumb trails, and the notion of a currently active bread crumb within a trail. This model does not make any presumptions on how it should interact with breadcrumbs except that a breadcrumb model should be serializable into a writer.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FACET_INDEX_NAME
Contexts 'facet', 'filter', and 'option'.
|
static java.lang.String |
FILTER_INDEX_NAME |
static java.lang.String |
OPTION_INDEX_NAME |
Constructor and Description |
---|
CQLQueryModel() |
Modifier and Type | Method and Description |
---|---|
void |
addFacet(Facet<Term> facet) |
void |
addFilter(BooleanOperator op,
Filter<AbstractNode> filter)
Add CQL filter.
|
void |
addOption(Option<Term> option) |
FacetBreadcrumbTrail<Term> |
getFacetTrail() |
java.lang.String |
getFilterTrail() |
OptionBreadcrumbTrail<Term> |
getOptionTrail()
Get the option breadcrumb trail.
|
java.lang.String |
getQuery() |
static boolean |
isFacetContext(java.lang.String context)
Check if this context is the facet context.
|
static boolean |
isFilterContext(java.lang.String context)
Check if this context is the filter context.
|
static boolean |
isOptionContext(java.lang.String context)
Check if this context is the option context.
|
static boolean |
isVisible(java.lang.String context)
Get query of a given context.
|
void |
removeFacet(Facet<Term> facet) |
void |
removeFilter(Filter<AbstractNode> filter)
Remove CQL filter.
|
void |
removeOption(Option<Term> option) |
void |
setQuery(java.lang.String query) |
java.lang.String |
toCQL()
Write the CQL query model as CQL string.
|
public static final java.lang.String FACET_INDEX_NAME
Contexts 'facet', 'filter', and 'option'.
public static final java.lang.String FILTER_INDEX_NAME
public static final java.lang.String OPTION_INDEX_NAME
public void setQuery(java.lang.String query)
public java.lang.String getQuery()
public void addFilter(BooleanOperator op, Filter<AbstractNode> filter)
Add CQL filter.
op
- boolean operator, AND for conjunctive filter, OR for disjunctive filterfilter
- the filter to addpublic void removeFilter(Filter<AbstractNode> filter)
Remove CQL filter.
filter
- the filter to removepublic FacetBreadcrumbTrail<Term> getFacetTrail()
public java.lang.String getFilterTrail()
public OptionBreadcrumbTrail<Term> getOptionTrail()
Get the option breadcrumb trail.
public static boolean isVisible(java.lang.String context)
Get query of a given context.
context
- the contextpublic static boolean isFacetContext(java.lang.String context)
Check if this context is the facet context.
context
- the contextpublic static boolean isFilterContext(java.lang.String context)
Check if this context is the filter context.
context
- the contextpublic static boolean isOptionContext(java.lang.String context)
Check if this context is the option context.
context
- the contextpublic java.lang.String toCQL()
Write the CQL query model as CQL string.