public abstract class AbstractJcrContainer extends AbstractContainer implements com.vaadin.v7.data.Container.Sortable, com.vaadin.v7.data.Container.Indexed, com.vaadin.v7.data.Container.ItemSetChangeNotifier, Refreshable
AbstractContainer.ItemSetChangeEvent, AbstractContainer.PropertySetChangeEvent
com.vaadin.v7.data.Container.Indexed.ItemAddEvent, com.vaadin.v7.data.Container.Indexed.ItemRemoveEvent
com.vaadin.v7.data.Container.Editor, com.vaadin.v7.data.Container.Filter, com.vaadin.v7.data.Container.Filterable, com.vaadin.v7.data.Container.Hierarchical, com.vaadin.v7.data.Container.Indexed, com.vaadin.v7.data.Container.ItemSetChangeEvent, com.vaadin.v7.data.Container.ItemSetChangeListener, com.vaadin.v7.data.Container.ItemSetChangeNotifier, com.vaadin.v7.data.Container.Ordered, com.vaadin.v7.data.Container.PropertySetChangeEvent, com.vaadin.v7.data.Container.PropertySetChangeListener, com.vaadin.v7.data.Container.PropertySetChangeNotifier, com.vaadin.v7.data.Container.SimpleFilterable, com.vaadin.v7.data.Container.Sortable, com.vaadin.v7.data.Container.Viewer
Modifier and Type | Field and Description |
---|---|
protected static String |
ASCENDING_KEYWORD |
static int |
DEFAULT_CACHE_RATIO |
static String |
DEFAULT_NODE_TYPE
Node type to use if none is configured.
|
static int |
DEFAULT_PAGE_LENGTH |
protected static String |
DESCENDING_KEYWORD |
protected static String |
JCR_NAME_FUNCTION |
protected static String |
ORDER_BY |
static String |
PROPERTY_NAME_AND_UUID_SEPARATOR
String separating a properties name and the uuid of its node.
|
protected static String |
SELECT_TEMPLATE |
protected static String |
SELECTOR_NAME |
protected List<OrderBy> |
sorters |
protected static String |
WHERE_TEMPLATE_FOR_PATH |
Constructor and Description |
---|
AbstractJcrContainer(JcrContentConnectorDefinition jcrContentConnectorDefinition) |
Modifier and Type | Method and Description |
---|---|
Object |
addItem() |
com.vaadin.v7.data.Item |
addItem(Object itemId) |
Object |
addItemAfter(Object previousItemId) |
com.vaadin.v7.data.Item |
addItemAfter(Object previousItemId,
Object newItemId)
*******************************
|
Object |
addItemAt(int index) |
com.vaadin.v7.data.Item |
addItemAt(int index,
Object newItemId) |
void |
addItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener) |
void |
addListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener) |
void |
addSortableProperty(String sortableProperty) |
protected void |
clearItemIndexes() |
protected String |
constructJCRQuery(boolean considerSorting) |
boolean |
containsId(Object itemId) |
protected void |
ensureItemIndices() |
protected javax.jcr.query.QueryResult |
executeQuery(String statement,
String language,
long limit,
long offset) |
protected Set<javax.jcr.nodetype.NodeType> |
findSearchableNodeTypes() |
void |
fireItemSetChange() |
void |
fireItemSetChange(com.vaadin.v7.data.Container.ItemSetChangeEvent event)
Sends an Item set change event to all registered interested listeners.
|
JcrItemId |
firstItemId() |
int |
getCacheRatio() |
JcrContentConnectorDefinition |
getConfiguration() |
com.vaadin.v7.data.Property<?> |
getContainerProperty(Object itemId,
Object propertyId) |
protected int |
getCurrentOffset() |
protected OrderBy |
getDefaultOrderBy(String property) |
JcrItemId |
getIdByIndex(int index) |
com.vaadin.v7.data.Item |
getItem(Object itemId) |
Collection<String> |
getItemIds() |
List<?> |
getItemIds(int startIndex,
int numberOfItems) |
protected Map<Long,JcrItemId> |
getItemIndexes() |
javax.jcr.Item |
getJcrItem(Object itemId) |
protected String |
getJcrNameOrderByFunction() |
protected String |
getMainNodeType()
Deprecated.
since 5.1. All node types declared in the workbench definition are equal, meaning that their position doesn't matter when it comes to which ones are used in a query.
The discriminating factor is the
hideInList boolean property. If that property is true , then the node will be excluded from the query. |
protected void |
getPage()
Fetches a page from the data source based on the values of pageLength, cacheRatio and currentOffset.
|
int |
getPageLength() |
protected String |
getQuerySelectStatement() |
protected String |
getQueryWhereClause() |
protected String |
getQueryWhereClauseNodeTypes() |
protected String |
getQueryWhereClauseWorkspacePath() |
Set<javax.jcr.nodetype.NodeType> |
getSearchableNodeTypes() |
List<String> |
getSortableContainerPropertyIds() |
String |
getWorkspace() |
protected void |
handleRepositoryException(org.slf4j.Logger logger,
String message,
javax.jcr.RepositoryException repositoryException)
Central method for uniform treatment of RepositoryExceptions in JcrContainers.
|
int |
indexOfId(Object itemId)
*****************************************
|
boolean |
isFirstId(Object itemId) |
boolean |
isLastId(Object itemId) |
JcrItemId |
lastItemId() |
JcrItemId |
nextItemId(Object itemId)
*****************************************
|
JcrItemId |
prevItemId(Object itemId) |
void |
refresh()
Refreshes the container - clears all caches and resets size and offset.
|
boolean |
removeAllItems() |
boolean |
removeItem(Object itemId) |
void |
removeItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener) |
void |
removeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener) |
protected void |
resetOffset() |
void |
setCacheRatio(int cacheRatio) |
void |
setPageLength(int pageLength) |
protected void |
setSize(int size) |
int |
size()
Gets the number of visible Items in the Container.
|
void |
sort(Object[] propertyId,
boolean[] ascending)
******************************************
|
void |
updateSize() |
addContainerProperty, getContainerPropertyIds, getType, removeContainerProperty
public static final int DEFAULT_PAGE_LENGTH
public static final int DEFAULT_CACHE_RATIO
public static final String PROPERTY_NAME_AND_UUID_SEPARATOR
public static final String DEFAULT_NODE_TYPE
protected static final String SELECTOR_NAME
protected static final String SELECT_TEMPLATE
protected static final String WHERE_TEMPLATE_FOR_PATH
protected static final String ORDER_BY
protected static final String ASCENDING_KEYWORD
protected static final String DESCENDING_KEYWORD
protected static final String JCR_NAME_FUNCTION
public AbstractJcrContainer(JcrContentConnectorDefinition jcrContentConnectorDefinition)
public void addSortableProperty(String sortableProperty)
public JcrContentConnectorDefinition getConfiguration()
public void addItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
addItemSetChangeListener
in interface com.vaadin.v7.data.Container.ItemSetChangeNotifier
public void addListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
addListener
in interface com.vaadin.v7.data.Container.ItemSetChangeNotifier
public void removeItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
removeItemSetChangeListener
in interface com.vaadin.v7.data.Container.ItemSetChangeNotifier
public void removeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
removeListener
in interface com.vaadin.v7.data.Container.ItemSetChangeNotifier
public void fireItemSetChange()
public void fireItemSetChange(com.vaadin.v7.data.Container.ItemSetChangeEvent event)
event
- the item set change event to send, optionally with additional
informationpublic int getPageLength()
public void setPageLength(int pageLength)
public int getCacheRatio()
public void setCacheRatio(int cacheRatio)
public javax.jcr.Item getJcrItem(Object itemId)
public com.vaadin.v7.data.Item getItem(Object itemId)
getItem
in interface com.vaadin.v7.data.Container
public Collection<String> getItemIds()
getItemIds
in interface com.vaadin.v7.data.Container
public com.vaadin.v7.data.Property<?> getContainerProperty(Object itemId, Object propertyId)
getContainerProperty
in interface com.vaadin.v7.data.Container
public int size()
size
in interface com.vaadin.v7.data.Container
public boolean containsId(Object itemId)
containsId
in interface com.vaadin.v7.data.Container
public com.vaadin.v7.data.Item addItem(Object itemId) throws UnsupportedOperationException
addItem
in interface com.vaadin.v7.data.Container
UnsupportedOperationException
public Object addItem() throws UnsupportedOperationException
addItem
in interface com.vaadin.v7.data.Container
UnsupportedOperationException
public boolean removeAllItems() throws UnsupportedOperationException
removeAllItems
in interface com.vaadin.v7.data.Container
UnsupportedOperationException
public int indexOfId(Object itemId)
indexOfId
in interface com.vaadin.v7.data.Container.Indexed
protected void ensureItemIndices()
public JcrItemId getIdByIndex(int index)
getIdByIndex
in interface com.vaadin.v7.data.Container.Indexed
public JcrItemId nextItemId(Object itemId)
nextItemId
in interface com.vaadin.v7.data.Container.Ordered
public JcrItemId prevItemId(Object itemId)
prevItemId
in interface com.vaadin.v7.data.Container.Ordered
public JcrItemId firstItemId()
firstItemId
in interface com.vaadin.v7.data.Container.Ordered
public JcrItemId lastItemId()
lastItemId
in interface com.vaadin.v7.data.Container.Ordered
public boolean isFirstId(Object itemId)
isFirstId
in interface com.vaadin.v7.data.Container.Ordered
public boolean isLastId(Object itemId)
isLastId
in interface com.vaadin.v7.data.Container.Ordered
public void sort(Object[] propertyId, boolean[] ascending)
sort
in interface com.vaadin.v7.data.Container.Sortable
public List<String> getSortableContainerPropertyIds()
getSortableContainerPropertyIds
in interface com.vaadin.v7.data.Container.Sortable
public boolean removeItem(Object itemId) throws UnsupportedOperationException
removeItem
in interface com.vaadin.v7.data.Container
UnsupportedOperationException
public com.vaadin.v7.data.Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
addItemAfter
in interface com.vaadin.v7.data.Container.Ordered
UnsupportedOperationException
public com.vaadin.v7.data.Item addItemAt(int index, Object newItemId) throws UnsupportedOperationException
addItemAt
in interface com.vaadin.v7.data.Container.Indexed
UnsupportedOperationException
public Object addItemAt(int index) throws UnsupportedOperationException
addItemAt
in interface com.vaadin.v7.data.Container.Indexed
UnsupportedOperationException
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
addItemAfter
in interface com.vaadin.v7.data.Container.Ordered
UnsupportedOperationException
protected void getPage()
protected String constructJCRQuery(boolean considerSorting)
considerSorting
- an optional ORDER BY
is added if this parameter is true
.select * from [nt:base] as selectorName [WHERE] [ORDER BY]"
.
Subclasses can customize the optional WHERE
clause by overriding getQueryWhereClause()
or, at a more fine-grained level, getQueryWhereClauseNodeTypes()
and getQueryWhereClauseWorkspacePath()
.
A restriction on the node types to be searched for can be applied via getQueryWhereClauseNodeTypes()
.
protected OrderBy getDefaultOrderBy(String property)
OrderBy
object for the passed in property to be used for the default order by clause.protected String getJcrNameOrderByFunction()
JCR_NAME_FUNCTION
.protected String getQueryWhereClause()
getQueryWhereClauseNodeTypes()
,
getQueryWhereClauseWorkspacePath()
protected String getQueryWhereClauseNodeTypes()
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')
.findSearchableNodeTypes()
protected final String getQueryWhereClauseWorkspacePath()
protected String getQuerySelectStatement()
SELECT
statement whose node type is nt:base
. Can be customized by subclasses to utilize other item types, i.e. select * from [my:fancytype]
. Used internally by constructJCRQuery(boolean)
.@Deprecated protected String getMainNodeType()
hideInList
boolean property. If that property is true
, then the node will be excluded from the query.public void updateSize()
getPage().
public List<?> getItemIds(int startIndex, int numberOfItems)
getItemIds
in interface com.vaadin.v7.data.Container.Indexed
public String getWorkspace()
public Set<javax.jcr.nodetype.NodeType> getSearchableNodeTypes()
public void refresh()
refresh
in interface Refreshable
protected void resetOffset()
protected void clearItemIndexes()
protected int getCurrentOffset()
protected void setSize(int size)
protected javax.jcr.query.QueryResult executeQuery(String statement, String language, long limit, long offset) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void handleRepositoryException(org.slf4j.Logger logger, String message, javax.jcr.RepositoryException repositoryException)
logger
- logger to be used - passed in so subclasses can still user their proper loggermessage
- message to be used in the handlingrepositoryException
- exception to be handledprotected Set<javax.jcr.nodetype.NodeType> findSearchableNodeTypes()
NodeType
s. A searchable node type is defined as follows
/modules/mymodule/apps/myapp/subApps/browser/workbench/nodeTypes
hideInList=true
). By default nodes are not hidden.
strict=false
), then its subtypes (if any) are searchable too. By default nodes are not defined as strict.
jcr:, nt:, mix:, rep:
are not taken into account.
Copyright © 2019 Magnolia International Ltd.. All rights reserved.