org.apache.myfaces.trinidad.model
Interface LocalRowKeyIndex

All Known Implementing Classes:
BaseMenuModel, ChildPropertyMenuModel, ChildPropertyTreeModel, CollectionModel, CollectionModelDecorator, CoreBreadCrumbs, CoreNavigationPane, CoreNavigationTree, CorePage, CoreProcessChoiceBar, CoreTable, CoreTrain, CoreTree, CoreTreeTable, MenuModel, ProcessMenuModel, RowKeyPropertyModel, RowKeyPropertyTreeModel, SortableModel, TreeModel, TreeModelDecorator, UIXHierarchy, UIXIterator, UIXMenuHierarchy, UIXNavigationHierarchy, UIXNavigationLevel, UIXNavigationPath, UIXNavigationTree, UIXPage, UIXProcess, UIXTable, UIXTree, UIXTreeTable, ViewIdPropertyMenuModel, XMLMenuModel

public interface LocalRowKeyIndex

Defines a set of "local" APIs for a CollectionModel. The "local" APIs allow a client to query the model and determine if a set of rows are locally available. "Locally available" can mean the model has the given set of rows in a local cache and can honor a fetch request efficiently (for example, without performing a SQL query).


Nested Class Summary
static class LocalRowKeyIndex.Confidence
          Enum used in the getEstimatedRowCountConfidence() API to determine if the row count is exact or an estimate
static class LocalRowKeyIndex.LocalCachingStrategy
          Enum used to indicate the type of caching supported by the model
 
Method Summary
 boolean areRowsLocallyAvailable(int rowCount)
          Check if a range of rows is locally available starting from the current row
 boolean areRowsLocallyAvailable(int startIndex, int rowCount)
          Check if a range of rows is locally available starting from a row index
 boolean areRowsLocallyAvailable(Object startRowKey, int rowCount)
          Check if a range of rows is locally available starting from a row key
 void clearCachedRow(int index)
          Clear a row from the local cache by row index
 void clearCachedRow(Object rowKey)
          Clear a row from the local cache by row key
 void clearCachedRows(int startingIndex, int rowsToClear)
          Clear the requested range of rows from the local cache
 void clearCachedRows(Object startingRowKey, int rowsToClear)
          Clear the requested range of rows from the local cache
 void clearLocalCache()
          clear all rows from the local cache
 LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
          Indicates the caching strategy supported by the model
 int getEstimatedRowCount()
          Convenient API to return a row count estimate.
 LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
          Helper API to determine if the row count returned from getEstimatedRowCount() is EXACT, or an ESTIMATE
 boolean isRowLocallyAvailable(int rowIndex)
          Given a row index, check if a row is locally available
 boolean isRowLocallyAvailable(Object rowKey)
          Given a row key, check if a row is locally available
 

Method Detail

isRowLocallyAvailable

boolean isRowLocallyAvailable(int rowIndex)
Given a row index, check if a row is locally available

Parameters:
rowIndex - index of row to check
Returns:
true if row is locally available flase otherwise

isRowLocallyAvailable

boolean isRowLocallyAvailable(Object rowKey)
Given a row key, check if a row is locally available

Parameters:
rowKey - row key for the row to check
Returns:
true if row is locally available flase otherwise

areRowsLocallyAvailable

boolean areRowsLocallyAvailable(int startIndex,
                                int rowCount)
Check if a range of rows is locally available starting from a row index

Parameters:
startIndex - staring index for the range
rowCount - number of rows in the range
Returns:
true if range of rows is locally available flase otherwise

areRowsLocallyAvailable

boolean areRowsLocallyAvailable(Object startRowKey,
                                int rowCount)
Check if a range of rows is locally available starting from a row key

Parameters:
startRowKey - staring row key for the range
rowCount - number of rows in the range
Returns:
true if range of rows is locally available flase otherwise

areRowsLocallyAvailable

boolean areRowsLocallyAvailable(int rowCount)
Check if a range of rows is locally available starting from the current row

Parameters:
rowCount - number of rows in the range
Returns:
true if range of rows is locally available flase otherwise

getEstimatedRowCount

int getEstimatedRowCount()
Convenient API to return a row count estimate. This method can be optimized to avoid a data fetch which may be required to return an exact row count.

This method can return -1 or a row count estimate if determining exact row count requires a data fetch. When dealing with estimated row counts, the caller needs to gracefully handle the case where isRowAvailable returns false for a row index or a row key.

Returns:
estimated row count

getEstimatedRowCountConfidence

LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
Helper API to determine if the row count returned from getEstimatedRowCount() is EXACT, or an ESTIMATE


clearLocalCache

void clearLocalCache()
clear all rows from the local cache


clearCachedRows

void clearCachedRows(int startingIndex,
                     int rowsToClear)
Clear the requested range of rows from the local cache

Parameters:
startingIndex - starting row index for the range to clear
rowsToClear - number of rows to clear from the cache

clearCachedRows

void clearCachedRows(Object startingRowKey,
                     int rowsToClear)
Clear the requested range of rows from the local cache

Parameters:
startingRowKey - starting row key for the range to clear
rowsToClear - number of rows to clear from the cache

clearCachedRow

void clearCachedRow(int index)
Clear a row from the local cache by row index

Parameters:
index - row index for the row to clear from the cache

clearCachedRow

void clearCachedRow(Object rowKey)
Clear a row from the local cache by row key

Parameters:
rowKey - row key for the row to clear from the cache

getCachingStrategy

LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
Indicates the caching strategy supported by the model

Returns:
caching strategy supported by the model
See Also:
LocalRowKeyIndex.LocalCachingStrategy


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.