public class CSPContentSearchProvider extends CSPBaseProvider implements ITableContentProvider, IRefreshableContentProvider, ISelectableTableContentProvider, ISortableTableContentProvider
Session
instance and a Node Id (the content type). Except these two
fields all others are optional and have some default values.fRetrievalModule, fSession
fExpireWithPageFlow
DATA_BINDING_CLIENTS, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
Constructor and Description |
---|
CSPContentSearchProvider() |
Modifier and Type | Method and Description |
---|---|
protected List<CSPContent> |
getCSPContents() |
Object |
getCurrentRow()
Returns wrapped current row object.
|
CSPIndexDefinitionProvider |
getIndexDefinitionProvider() |
boolean |
getNeedRefresh()
Returns
true when IRefreshable.isAutoRefresh() is on and the result properties need to be refreshed from
the data source by executing IRefreshable.refresh() method. |
boolean |
getPermanentDelete() |
Object[] |
getPropertyKeys()
Returns list of properties supported by this content provider.
|
int |
getResultCount() |
int |
getRowCount()
Return the number of rows of data objects represented by this DataModel.
|
String |
getRowId()
Returns unique identifier for the current row.
|
int |
getRowIndex()
Return the zero-relative index of the currently selected row.
|
int |
getRowSelectedCount()
Returns number of selected rows.
|
Collection |
getRowSelectedIds()
Returns collection of
String ids of the selected rows. |
protected Class<CSPContent> |
getRowType() |
Collection |
getRowUnselectedIds()
Returns collection of
String ids of the un-selected rows
(all other rows are selected implicitly)
May be empty or contain non-existent ids; never null, never contains null. |
String |
getRowVariable()
Returns row variable name.
|
CSPSearchQuery |
getSearchQuery() |
List<Object> |
getSelectedRows() |
ISortInfo |
getSort()
Returns current sort info.
|
Class<String> |
getType(Object propertyKey)
Returns java type of the given property
|
boolean |
getUseUnselectedModel()
Returns true if it's more effecient to use unselected model
(ie
ISelectableTableContentProvider.getRowUnselectedIds() rather than ISelectableTableContentProvider.getRowSelectedIds() ). |
Object |
getValue(Object propertyKey)
Returns value of the given property
|
boolean |
hasProperty(Object propertyKey)
Checks if the given property is supported by this content provider
|
boolean |
isAddressable()
Checks if this content provider truly is addressable.
|
boolean |
isAutoRefresh()
Returns
true if the provider is currenlty in auto-refresh mode |
boolean |
isRowAvailable()
Return a flag indicating whether there is rowData available at the
current rowIndex.
|
boolean |
isRowSelected()
Returns
true if current row is selected. |
boolean |
isSubNodesIncluded() |
void |
refresh()
Make the search and sort the results.
|
void |
setAutoRefresh(boolean autorefresh)
Sets auto refresh mode on.
|
void |
setIncludeSubNode(Boolean includeSubNodes) |
void |
setIndexDefinitionProvider(CSPIndexDefinitionProvider indexDefinitionProvider) |
void |
setNeedRefresh(boolean needRefresh)
Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any
output property is requested via
IContentProvider.getValue(Object) . |
void |
setPermanentDelete(boolean permanentDelete)
Deleting content in CSP is not really removing, it's
deactivating.
|
void |
setResultCount(int count)
Sets how many results will return
#listAttachments() . |
void |
setRowById(String id)
Selects current row by its id.
|
void |
setRowIndex(int rowIndex)
Set the zero-relative index of the currently selected row, or -1 to
indicate that we are not positioned on a row.
|
void |
setRowSelected(boolean selected)
Sets the selection status for the current row.
|
void |
setRowSelectedIds(Collection ids)
Sets new selection using a collection of
String ids of the rows to select. |
void |
setRowUnselectedIds(Collection ids)
Unselects rows using a collection of
String ids of the un-selected rows
(all other rows are selected implicitly). |
void |
setRowVariable(String var)
Sets row variable name to use for accessing row specific data.
|
void |
setSearchQuery(CSPSearchQuery searchQuery) |
void |
setSort(ISortInfo sortInfo)
Sets new sort info, re-sorting the table (if necessary).
|
protected void |
sort() |
boolean |
supportsAutoRefresh()
Returns true if this content provider supports auto refresh feature.
|
checkState, getSession, release, setSession
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
createMethodBinding, createMethodExpression, createValueBinding, createValueExpression, createValueExpression, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
public void setIncludeSubNode(Boolean includeSubNodes)
public boolean isSubNodesIncluded()
public void setResultCount(int count)
#listAttachments()
. Default is
100.count
- How many result will return #listAttachments()
.public int getResultCount()
public void setPermanentDelete(boolean permanentDelete)
permanentDelete
- Defines whether content to physically delete the content.
Default is false.public boolean getPermanentDelete()
public boolean getNeedRefresh()
IRefreshable
Returns true
when IRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from
the data source by executing IRefreshable.refresh()
method.
Implementations may return an accurate value from this method if they can track the changes to the input parameter
properties or they may require the clients to call IRefreshable.setNeedRefresh(boolean)
explicitely.
getNeedRefresh
in interface IRefreshable
true
when the output properties are not up-to-date with the current input parameters, i.e. IRefreshable.refresh()
needs to be executed manually or automatically.public boolean isAutoRefresh()
IRefreshable
true
if the provider is currenlty in auto-refresh modeisAutoRefresh
in interface IRefreshable
public void refresh() throws ContentProviderException
refresh
in interface IRefreshable
ContentProviderException
- if error loading data from the data sourceprotected void sort()
protected List<CSPContent> getCSPContents()
public void setAutoRefresh(boolean autorefresh) throws ContentProviderException
IRefreshable
Sets auto refresh mode on. When auto refresh mode is on, the provider calls IRefreshable.getNeedRefresh()
to determine whether the refresh needs to be done before returning any result properties. If it returns
true
, the provider calls IRefreshable.refresh()
method to updated the result properties.
setAutoRefresh
in interface IRefreshable
autorefresh
- true to turn it onContentProviderException
- if auto refresh mode is not supportedIRefreshable.supportsAutoRefresh()
,
IRefreshable.getNeedRefresh()
,
IRefreshable.setNeedRefresh(boolean)
public void setNeedRefresh(boolean needRefresh)
IRefreshable
IContentProvider.getValue(Object)
.setNeedRefresh
in interface IRefreshable
needRefresh
- true
if the input parameters have changedpublic boolean supportsAutoRefresh()
IRefreshable
supportsAutoRefresh
in interface IRefreshable
IRefreshable.setAutoRefresh(boolean)
public CSPSearchQuery getSearchQuery()
public void setSearchQuery(CSPSearchQuery searchQuery)
public Object[] getPropertyKeys()
IContentProvider
Object[0]
,
never null.getPropertyKeys
in interface IContentProvider
String
or Integer
public Object getValue(Object propertyKey) throws EvaluationException, PropertyNotFoundException
IContentProvider
getValue
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
null
EvaluationException
- if error during property evaluationPropertyNotFoundException
- if property is not supportedprotected Class<CSPContent> getRowType()
public boolean hasProperty(Object propertyKey)
IContentProvider
hasProperty
in interface IContentProvider
propertyKey
- property key of type String
or Integer
true
if property is supportedpublic int getRowSelectedCount()
ISelectableTableContentProvider
getRowSelectedCount
in interface ISelectableTableContentProvider
public Collection getRowSelectedIds()
ISelectableTableContentProvider
String
ids of the selected rows.
May be empty or contain non-existent ids; never null, never contains null.getRowSelectedIds
in interface ISelectableTableContentProvider
public Collection getRowUnselectedIds()
ISelectableTableContentProvider
String
ids of the un-selected rows
(all other rows are selected implicitly)
May be empty or contain non-existent ids; never null, never contains null.getRowUnselectedIds
in interface ISelectableTableContentProvider
public boolean getUseUnselectedModel()
ISelectableTableContentProvider
ISelectableTableContentProvider.getRowUnselectedIds()
rather than ISelectableTableContentProvider.getRowSelectedIds()
).getUseUnselectedModel
in interface ISelectableTableContentProvider
public boolean isRowSelected()
ISelectableTableContentProvider
true
if current row is selected.isRowSelected
in interface ISelectableTableContentProvider
public void setRowSelected(boolean selected)
ISelectableTableContentProvider
setRowSelected
in interface ISelectableTableContentProvider
selected
- true
to select current row; false
to unselect.public void setRowSelectedIds(Collection ids)
ISelectableTableContentProvider
String
ids of the rows to select.
May be empty or contain non-existent ids; never null, never contains null.setRowSelectedIds
in interface ISelectableTableContentProvider
ids
- the collection of String
row idspublic void setRowUnselectedIds(Collection ids)
ISelectableTableContentProvider
String
ids of the un-selected rows
(all other rows are selected implicitly).
May be empty or contain non-existent ids; never null, never contains null.setRowUnselectedIds
in interface ISelectableTableContentProvider
ids
- collection of String
row idspublic boolean isAddressable()
IAddressableTableContentProvider
isAddressable
in interface IAddressableTableContentProvider
true
if addressable.public void setRowById(String id)
IAddressableTableContentProvider
setRowIndex(-1)
).setRowById
in interface IAddressableTableContentProvider
id
- row id to find and make currentpublic Object getCurrentRow()
ITableContentProvider
Returns wrapped current row object. Can be null
if not data
is available
getCurrentRow
in interface ITableContentProvider
ITableContentProvider.isRowAvailable()
public int getRowCount()
ITableContentProvider
Return -1, if the number of rows is unknown, or no wrappedData is available.
getRowCount
in interface ITableContentProvider
DataModel.getRowCount()
public int getRowIndex()
ITableContentProvider
If we are not currently positioned on a row, or no wrappedData is available, return -1.
getRowIndex
in interface ITableContentProvider
DataModel.getRowIndex()
public String getRowVariable()
ITableContentProvider
Returns row variable name.
If specified row variable can be used to access current row data for the provider internal needs, like sorting or addressing.
getRowVariable
in interface ITableContentProvider
ITableContentProvider.setRowVariable(String)
public boolean isRowAvailable()
ITableContentProvider
isRowAvailable
in interface ITableContentProvider
DataModel.isRowAvailable()
public void setRowIndex(int rowIndex)
ITableContentProvider
setRowIndex
in interface ITableContentProvider
DataModel.getRowIndex()
public void setRowVariable(String var)
ITableContentProvider
Sets row variable name to use for accessing row specific data. For
example, if the provider wrapps an array of a data objects with
id
property and the variable name is item
, then
the provider implementation can access id
property of each
record as item.id
.
This property should set only once at the provider initialization time
setRowVariable
in interface ITableContentProvider
public Class<String> getType(Object propertyKey) throws PropertyNotFoundException
IContentProvider
getType
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
Class
PropertyNotFoundException
- if property is not supportedpublic String getRowId()
IAddressableTableContentProvider
getRowId
in interface IAddressableTableContentProvider
public ISortInfo getSort()
ISortableTableContentProvider
getSort
in interface ISortableTableContentProvider
public void setSort(ISortInfo sortInfo)
ISortableTableContentProvider
setSort
in interface ISortableTableContentProvider
sortInfo
- Sort info, must not be null.public CSPIndexDefinitionProvider getIndexDefinitionProvider()
public void setIndexDefinitionProvider(CSPIndexDefinitionProvider indexDefinitionProvider)