Class BaseIteratorTableContentProvider
- All Implemented Interfaces:
IPageFlowScopeAdapter
,IAddressableTableContentProvider
,IContentProvider
,IRefreshable
,IRefreshableContentProvider
,ISelectableTableContentProvider
,ISortableTableContentProvider
,ITableContentProvider
,Serializable
- Direct Known Subclasses:
ChildrenTableContentProvider
,SearchTableContentProvider
,VersionHistoryTableContentProvider
- Since:
- 8.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Current row index.protected SelectableTableContentProviderHelper
Holds selection state.protected String
Row variable name.Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
-
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor.BaseIteratorTableContentProvider
(javax.jcr.Session jcrSession) Constructor -
Method Summary
Modifier and TypeMethodDescriptionReturns wrapped current row object.javax.jcr.Session
Gets the current JCR sessionboolean
Returnstrue
whenIRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from the data source by executingIRefreshable.refresh()
method.Object[]
Returns list of properties supported by this content provider.int
Return the number of rows of data objects represented by this DataModel.getRowId()
Returns unique identifier for the current row.int
Return the zero-relative index of the currently selected row.int
Returns number of selected rows.Returns collection ofString
ids of the selected rows.protected Class
Returns the row type for the table controlReturns collection ofString
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.Returns row variable name.Returns collection of selected row objects (not IDs) from the ISelectableTableContentProvider.getSort()
Returns current sort info.Class<?>
Returns java type of the given propertyprotected String
getUniqueId
(Object temp) Gets the unique id of the object.boolean
Returns true if it's more effecient to use unselected model (ieISelectableTableContentProvider.getRowUnselectedIds()
rather thanISelectableTableContentProvider.getRowSelectedIds()
).Returns value of the given propertyboolean
hasProperty
(Object propertyKey) Checks if the given property is supported by this content providerprotected abstract boolean
Checks if the provider is configured properly for looking up resultsprotected abstract javax.jcr.RangeIterator
Do the work to return the node iteratorboolean
Checks if this content provider truly is addressable.boolean
Returnstrue
if the provider is currenlty in auto-refresh modeboolean
Return a flag indicating whether there is rowData available at the current rowIndex.boolean
Returnstrue
if current row is selected.void
refresh()
(Re)loads data from the data source.void
setAutoRefresh
(boolean autorefresh) Sets auto refresh mode on.void
setJcrSession
(javax.jcr.Session jcrSession) Sets the current JCR sessionvoid
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 viaIContentProvider.getValue(Object)
.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
Sets new selection using a collection ofString
ids of the rows to select.void
Unselects rows using a collection ofString
ids of the un-selected rows (all other rows are selected implicitly).void
setRowVariable
(String varName) Sets row variable name to use for accessing row specific data.void
Sets new sort info, re-sorting the table (if necessary).boolean
Returns true if this content provider supports auto refresh feature.Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider
toString
-
Field Details
-
m_index
protected int m_indexCurrent row index. -
m_var
Row variable name. -
m_selectableHelper
Holds selection state.
-
-
Constructor Details
-
BaseIteratorTableContentProvider
public BaseIteratorTableContentProvider()Default Constructor. Must callsetJcrSession(Session)
with a valid JCR session before using. -
BaseIteratorTableContentProvider
public BaseIteratorTableContentProvider(javax.jcr.Session jcrSession) Constructor- Parameters:
jcrSession
- the JCR session to query in
-
-
Method Details
-
getJcrSession
public javax.jcr.Session getJcrSession()Gets the current JCR session- Returns:
- the JCR session
-
setJcrSession
public void setJcrSession(javax.jcr.Session jcrSession) Sets the current JCR session- Parameters:
jcrSession
- the JCR session to set
-
getRowType
Returns the row type for the table control- Returns:
- always returns the
Node
class
-
getPropertyKeys
Description copied from interface:IContentProvider
Returns list of properties supported by this content provider. Can returnObject[0]
, never null.- Specified by:
getPropertyKeys
in interfaceIContentProvider
- Returns:
- array of property keys which is typically of type
String
orInteger
-
getType
Description copied from interface:IContentProvider
Returns java type of the given property- Specified by:
getType
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- property java
Class
- Throws:
PropertyNotFoundException
- if property is not supported
-
getValue
Description copied from interface:IContentProvider
Returns value of the given property- Specified by:
getValue
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- value of the property, can be
null
- Throws:
PropertyNotFoundException
- if property is not supportedELException
-
hasProperty
Description copied from interface:IContentProvider
Checks if the given property is supported by this content provider- Specified by:
hasProperty
in interfaceIContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
true
if property is supported
-
hasValidInputParameters
protected abstract boolean hasValidInputParameters()Checks if the provider is configured properly for looking up results -
getCurrentRow
Description copied from interface:ITableContentProvider
Returns wrapped current row object. Can be
null
if not data is available- Specified by:
getCurrentRow
in interfaceITableContentProvider
- Returns:
- current row object
- See Also:
-
getRowCount
public int getRowCount()Description copied from interface:ITableContentProvider
Return the number of rows of data objects represented by this DataModel.Return -1, if the number of rows is unknown, or no wrappedData is available.
- Specified by:
getRowCount
in interfaceITableContentProvider
- See Also:
-
invokeSearch
protected abstract javax.jcr.RangeIterator invokeSearch()Do the work to return the node iterator- Returns:
- node iterator
-
getRowIndex
public int getRowIndex()Description copied from interface:ITableContentProvider
Return the zero-relative index of the currently selected row.If we are not currently positioned on a row, or no wrappedData is available, return -1.
- Specified by:
getRowIndex
in interfaceITableContentProvider
- See Also:
-
getRowVariable
Description copied from interface: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.
- Specified by:
getRowVariable
in interfaceITableContentProvider
- Returns:
- row variable name or null if not specified
- See Also:
-
isRowAvailable
public boolean isRowAvailable()Description copied from interface:ITableContentProvider
Return a flag indicating whether there is rowData available at the current rowIndex. If no wrappedData is available, return false.- Specified by:
isRowAvailable
in interfaceITableContentProvider
- See Also:
-
setRowIndex
public void setRowIndex(int rowIndex) Description copied from interface:ITableContentProvider
Set the zero-relative index of the currently selected row, or -1 to indicate that we are not positioned on a row.- Specified by:
setRowIndex
in interfaceITableContentProvider
- See Also:
-
setRowVariable
Description copied from interface: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 isitem
, then the provider implementation can accessid
property of each record asitem.id
.This property should set only once at the provider initialization time
- Specified by:
setRowVariable
in interfaceITableContentProvider
-
getNeedRefresh
public boolean getNeedRefresh()Description copied from interface:IRefreshable
Returns
true
whenIRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from the data source by executingIRefreshable.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.- Specified by:
getNeedRefresh
in interfaceIRefreshable
- Returns:
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.
-
isAutoRefresh
public boolean isAutoRefresh()Description copied from interface:IRefreshable
Returnstrue
if the provider is currenlty in auto-refresh mode- Specified by:
isAutoRefresh
in interfaceIRefreshable
- Returns:
- false if auto-refresh mode is off or not supported
-
refresh
Description copied from interface:IRefreshable
(Re)loads data from the data source. Implementation specific meaning can be executing a SQL query or a web service call. All current data will be lost and updated with the new results if successful.- Specified by:
refresh
in interfaceIRefreshable
- Throws:
ContentProviderException
- if error loading data from the data source
-
setAutoRefresh
Description copied from interface: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 returnstrue
, the provider callsIRefreshable.refresh()
method to updated the result properties.- Specified by:
setAutoRefresh
in interfaceIRefreshable
- Parameters:
autorefresh
- true to turn it on- Throws:
ContentProviderException
- if auto refresh mode is not supported- See Also:
-
setNeedRefresh
public void setNeedRefresh(boolean needRefresh) Description copied from interface:IRefreshable
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 viaIContentProvider.getValue(Object)
.- Specified by:
setNeedRefresh
in interfaceIRefreshable
- Parameters:
needRefresh
-true
if the input parameters have changed
-
supportsAutoRefresh
public boolean supportsAutoRefresh()Description copied from interface:IRefreshable
Returns true if this content provider supports auto refresh feature.- Specified by:
supportsAutoRefresh
in interfaceIRefreshable
- Returns:
- true when auto refresh is supported
- See Also:
-
getRowId
Description copied from interface:IAddressableTableContentProvider
Returns unique identifier for the current row. If no current row is avaiable, returns null.- Specified by:
getRowId
in interfaceIAddressableTableContentProvider
- Returns:
- current row id or null
-
isAddressable
public boolean isAddressable()Description copied from interface:IAddressableTableContentProvider
Checks if this content provider truly is addressable.- Specified by:
isAddressable
in interfaceIAddressableTableContentProvider
- Returns:
true
if addressable.
-
setRowById
Description copied from interface:IAddressableTableContentProvider
Selects current row by its id. If id doesn't identify a row, makes no row current (equivalent tosetRowIndex(-1)
).- Specified by:
setRowById
in interfaceIAddressableTableContentProvider
- Parameters:
id
- row id to find and make current
-
getUniqueId
Gets the unique id of the object. If temp is a Node, then this will return the node if if available or the node path if no id is available. If temp is a Row, then this returns the row path.- Parameters:
temp
- the object to get the id of- Returns:
- unique id of the object
- Throws:
javax.jcr.RepositoryException
-
getRowSelectedCount
public int getRowSelectedCount()Description copied from interface:ISelectableTableContentProvider
Returns number of selected rows.- Specified by:
getRowSelectedCount
in interfaceISelectableTableContentProvider
- Returns:
- number of currently selection rows
-
getRowSelectedIds
Description copied from interface:ISelectableTableContentProvider
Returns collection ofString
ids of the selected rows. May be empty or contain non-existent ids; never null, never contains null.- Specified by:
getRowSelectedIds
in interfaceISelectableTableContentProvider
- Returns:
- collection of ids of selected rows
-
getRowUnselectedIds
Description copied from interface:ISelectableTableContentProvider
Returns collection ofString
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.- Specified by:
getRowUnselectedIds
in interfaceISelectableTableContentProvider
- Returns:
- collection of ids of the un-selection rows
-
getUseUnselectedModel
public boolean getUseUnselectedModel()Description copied from interface:ISelectableTableContentProvider
Returns true if it's more effecient to use unselected model (ieISelectableTableContentProvider.getRowUnselectedIds()
rather thanISelectableTableContentProvider.getRowSelectedIds()
).- Specified by:
getUseUnselectedModel
in interfaceISelectableTableContentProvider
- Returns:
- true if it's more effecient to use unselected model
-
isRowSelected
public boolean isRowSelected()Description copied from interface:ISelectableTableContentProvider
Returnstrue
if current row is selected.- Specified by:
isRowSelected
in interfaceISelectableTableContentProvider
- Returns:
- true if current row is selection
-
setRowSelected
public void setRowSelected(boolean selected) Description copied from interface:ISelectableTableContentProvider
Sets the selection status for the current row.- Specified by:
setRowSelected
in interfaceISelectableTableContentProvider
- Parameters:
selected
-true
to select current row;false
to unselect.
-
setRowSelectedIds
Description copied from interface:ISelectableTableContentProvider
Sets new selection using a collection ofString
ids of the rows to select. May be empty or contain non-existent ids; never null, never contains null.- Specified by:
setRowSelectedIds
in interfaceISelectableTableContentProvider
- Parameters:
ids
- the collection ofString
row ids
-
setRowUnselectedIds
Description copied from interface:ISelectableTableContentProvider
Unselects rows using a collection ofString
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.- Specified by:
setRowUnselectedIds
in interfaceISelectableTableContentProvider
- Parameters:
ids
- collection ofString
row ids
-
getSelectedRows
Returns collection of selected row objects (not IDs) from the ISelectableTableContentProvider.- Parameters:
provider
- selectable table provider- Returns:
- collection if selected row objects, never null, can be empty, can be up to
ITableContentProvider.getRowCount()
size
-
getSort
Description copied from interface:ISortableTableContentProvider
Returns current sort info. Never null.- Specified by:
getSort
in interfaceISortableTableContentProvider
- Returns:
- currenly set sort info
-
setSort
Description copied from interface:ISortableTableContentProvider
Sets new sort info, re-sorting the table (if necessary). This does not change the model's rowIndex property, even though it will probably now point to a different row.- Specified by:
setSort
in interfaceISortableTableContentProvider
- Parameters:
sortInfo
- Sort info, must not be null.
-