info.magnolia.ui.workbench.search
Class SearchJcrContainer

java.lang.Object
  extended by info.magnolia.ui.workbench.container.AbstractContainer
      extended by info.magnolia.ui.workbench.container.AbstractJcrContainer
          extended by info.magnolia.ui.workbench.list.FlatJcrContainer
              extended by info.magnolia.ui.workbench.search.SearchJcrContainer
All Implemented Interfaces:
com.vaadin.data.Container, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.Ordered, com.vaadin.data.Container.Sortable, Serializable

public class SearchJcrContainer
extends FlatJcrContainer

The jcr container backing the search view. It provides the subset of items returned by the current search. It will include mgnl:folder nodes if the latter are defined as "searchable".

See Also:
AbstractJcrContainer.findSearchableNodeTypes(), Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class info.magnolia.ui.workbench.container.AbstractContainer
AbstractContainer.ItemSetChangeEvent, AbstractContainer.PropertySetChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.data.Container
com.vaadin.data.Container.Editor, com.vaadin.data.Container.Filter, com.vaadin.data.Container.Filterable, com.vaadin.data.Container.Hierarchical, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeEvent, com.vaadin.data.Container.ItemSetChangeListener, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.Ordered, com.vaadin.data.Container.PropertySetChangeEvent, com.vaadin.data.Container.PropertySetChangeListener, com.vaadin.data.Container.PropertySetChangeNotifier, com.vaadin.data.Container.SimpleFilterable, com.vaadin.data.Container.Sortable, com.vaadin.data.Container.Viewer
 
Field Summary
protected static String CONTAINS_TEMPLATE_FOR_SEARCH
           
protected static String JCR_SCORE_FUNCTION
           
protected static String WHERE_TEMPLATE_FOR_SEARCH
           
 
Fields inherited from class info.magnolia.ui.workbench.container.AbstractJcrContainer
ASCENDING_KEYWORD, DEFAULT_CACHE_RATIO, DEFAULT_NODE_TYPE, DEFAULT_PAGE_LENGTH, DESCENDING_KEYWORD, JCR_NAME_FUNCTION, ORDER_BY, PROPERTY_NAME_AND_UUID_SEPARATOR, SELECT_TEMPLATE, SELECTOR_NAME, WHERE_TEMPLATE_FOR_PATH
 
Constructor Summary
SearchJcrContainer(WorkbenchDefinition workbenchDefinition)
           
 
Method Summary
protected  OrderBy getDefaultOrderBy(String property)
           
 String getFullTextExpression()
           
protected  String getJcrNameOrderByFunction()
           
protected  String getQueryWhereClause()
          Overrides its default implementation to take further constraints from getQueryWhereClauseSearch() into account.
protected  String getQueryWhereClauseNodeTypes()
           
protected  String getQueryWhereClauseSearch()
          Builds a string representing the constraints to be applied for this search.
 void setFullTextExpression(String fullTextExpression)
           
 
Methods inherited from class info.magnolia.ui.workbench.container.AbstractJcrContainer
addItem, addItem, addItemAfter, addItemAfter, addItemAt, addItemAt, addItemSetChangeListener, addListener, addSortableProperty, clearItemIndexes, constructJCRQuery, containsId, executeQuery, findSearchableNodeTypes, fireItemSetChange, firstItemId, getCacheRatio, getContainerProperty, getCurrentOffset, getIdByIndex, getItem, getItemIds, getItemIds, getItemIndexes, getJcrItem, getMainNodeType, getPageLength, getQuerySelectStatement, getQueryWhereClauseWorkspacePath, getSearchableNodeTypes, getSortableContainerPropertyIds, getWorkbenchDefinition, getWorkspace, handleRepositoryException, indexOfId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId, refresh, removeAllItems, removeItem, removeItemSetChangeListener, removeListener, resetOffset, setCacheRatio, setPageLength, setSize, size, sort, updateSize
 
Methods inherited from class info.magnolia.ui.workbench.container.AbstractContainer
addContainerProperty, getContainerPropertyIds, getType, removeContainerProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.data.Container
addContainerProperty, getContainerPropertyIds, getType, removeContainerProperty
 

Field Detail

WHERE_TEMPLATE_FOR_SEARCH

protected static final String WHERE_TEMPLATE_FOR_SEARCH
See Also:
Constant Field Values

CONTAINS_TEMPLATE_FOR_SEARCH

protected static final String CONTAINS_TEMPLATE_FOR_SEARCH
See Also:
Constant Field Values

JCR_SCORE_FUNCTION

protected static final String JCR_SCORE_FUNCTION
See Also:
Constant Field Values
Constructor Detail

SearchJcrContainer

public SearchJcrContainer(WorkbenchDefinition workbenchDefinition)
Method Detail

getQueryWhereClause

protected String getQueryWhereClause()
Overrides its default implementation to take further constraints from getQueryWhereClauseSearch() into account.

Overrides:
getQueryWhereClause in class AbstractJcrContainer
Returns:
the JCR query where clause to select only node types which are not hidden in list and nodes under the path configured in the workspace as String - if the latter is not configured return a blank string so that all nodes are considered.
See Also:
AbstractJcrContainer.getQueryWhereClauseNodeTypes(), AbstractJcrContainer.getQueryWhereClauseWorkspacePath()

getQueryWhereClauseNodeTypes

protected String getQueryWhereClauseNodeTypes()
Overrides:
getQueryWhereClauseNodeTypes in class AbstractJcrContainer
Returns:
a String containing the node types to be displayed in a list view and searched for in a query. All node types declared in a workbench definition are returned unless their hideInList property is true or the node is of type mgnl:folder (custom implementations of this method may still decide to display folders). Assuming a node types declaration like the following
 ...
 + workbench
  + nodeTypes
   + foo
    * name = nt:foo
   + bar
    * name = nt:bar
    * hideInList = true
   + baz (a mixin type)
    * name = nt:baz
 ...
 
this method will return the following string [jcr:primaryType] = 'nt:foo' or [jcr:mixinTypes] = 'baz'. This will eventually be used to restrict the node types to be displayed in list views and searched for in search views, i.e. select * from [nt:base] where ([jcr:primaryType] = 'nt:foo' or [jcr:mixinTypes] = 'baz').
See Also:
AbstractJcrContainer.findSearchableNodeTypes()

getQueryWhereClauseSearch

protected String getQueryWhereClauseSearch()
Builds a string representing the constraints to be applied for this search. Used by the overridden getQueryWhereClause() to augment the WHERE clause for this query. It basically adds constraints on node names, property names and full-text search on all searchable properties, i.e. those not excluded by Magnolia/JackRabbit's indexing configuration.

See /magnolia-core/src/main/resources/info/magnolia/jackrabbit/indexing_configuration.xml


setFullTextExpression

public void setFullTextExpression(String fullTextExpression)

getFullTextExpression

public String getFullTextExpression()

getJcrNameOrderByFunction

protected String getJcrNameOrderByFunction()
Overrides:
getJcrNameOrderByFunction in class AbstractJcrContainer
Returns:
the jcr function used to sort the node name (or jcr name property) column. By default it's AbstractJcrContainer.JCR_NAME_FUNCTION.

getDefaultOrderBy

protected OrderBy getDefaultOrderBy(String property)
Overrides:
getDefaultOrderBy in class AbstractJcrContainer
Returns:
an OrderBy object for the passed in property to be used for the default order by clause.


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.