org.apache.commons.scaffold.util
Interface ScrollerBean

All Known Implementing Classes:
ScrollerBeanBase

public interface ScrollerBean

Base class for scrolling searches.

Version:
$Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
Author:
Ted Husted

Method Summary
 String commandKey()
          Returns the String to use to retrieve the appropriate query for this search.
 String countKey()
          Returns the String to use to retrieve the appropriate query to count the entries matching this search.
 int entryCount()
          The total number of entries in search list.
 boolean failsOnEmpty()
          Whether to branch to "failure" if list returns zero entries.
 Integer getScrollFrom()
          The relative position of the first entry in this set.
 boolean hasParameter()
          Returns whether this search takes a parameter (eg primary key) [false].
 boolean isLike()
          Returns whether this search uses the LIKE operator so that other methods know to wrap searchValue in a call to like [false].
 void listLegend(ResultList list)
          Setup the legend for the result list.
 Scroller newScroller(int entries)
          Return new scroller using the current starting point (getScrollFrom), the default limit (set.SCROLL_ROWS), and current count from Access (countCurrent).
 Collection result(Object target, Object parameter)
          Returns the collection representing the result of the Search [null].
 Object[] scrollerParams(String parameter)
          Return the array of parameters needed to select the entries for this set.
 ProcessResult scrollerSearch()
          Invoke business logic; return result.
 Integer scrollOffset()
          The number of entries before the first entry in the set (One less than scrollFrom) [0].
 int scrollRows()
          The number of entries to return [Scroller.SCROLL_ROWS].
 String searchLabel()
          Returns a label to the property being searched.
 String searchProperty()
          Returns the name of the property being matched with the searchValue.
 Object searchValue()
          Returns the value used in the search [null].
 void setScrollFrom(Integer scrollFrom)
           
 String tokenEmptyDispatch()
          Returns the dispatch token for an empty result [Tokens.FAILURE].
 String tokenEmptyMessage()
          Returns the message token for an empty result [Tokens.DATA_ACCESS_EMPTY].
 

Method Detail

getScrollFrom

Integer getScrollFrom()
The relative position of the first entry in this set.

Returns:
the position to start this set

setScrollFrom

void setScrollFrom(Integer scrollFrom)

scrollOffset

Integer scrollOffset()
The number of entries before the first entry in the set (One less than scrollFrom) [0].

Returns:
Offset to next entry

scrollRows

int scrollRows()
The number of entries to return [Scroller.SCROLL_ROWS].

Returns:
Entries per page.

countKey

String countKey()
Returns the String to use to retrieve the appropriate query to count the entries matching this search. Must be overridden or provide functionality.

Returns:
Value of count key

hasParameter

boolean hasParameter()
Returns whether this search takes a parameter (eg primary key) [false]. Override this method to return true and getParameter to return the required parameter.

Returns:
True if this search uses a parameter

searchValue

Object searchValue()
Returns the value used in the search [null]. This can be the literal value used in the query or (if hasParameter==false) a description of what the search returns. Must be overridden or provide functionality.

Returns:
Value of search parameter

isLike

boolean isLike()
Returns whether this search uses the LIKE operator so that other methods know to wrap searchValue in a call to like [false].

Returns:
True if this search uses the LIKE operator

entryCount

int entryCount()
               throws ResourceException
The total number of entries in search list. The default behavior returns a "like" search count of entries matching the searchKey. Override to provide functionality.

Returns:
total entries
Throws:
May - throw an exception on data access error
ResourceException

commandKey

String commandKey()
Returns the String to use to retrieve the appropriate query for this search. Must be overridden or provide functionality.

Returns:
Value of command key

searchProperty

String searchProperty()
Returns the name of the property being matched with the searchValue. Default method returns null. Must be overridden or provide functionality.

Returns:
The search property

searchLabel

String searchLabel()
Returns a label to the property being searched. This can be the property name or a more descriptive legend. Default method returns searchProperty. Must be overridden or provide functionality.

Returns:
The label for the search property

failsOnEmpty

boolean failsOnEmpty()
Whether to branch to "failure" if list returns zero entries.


tokenEmptyMessage

String tokenEmptyMessage()
Returns the message token for an empty result [Tokens.DATA_ACCESS_EMPTY]. May be used when isFailOnEmpty is true.

Returns:
Message token for an empty result.

tokenEmptyDispatch

String tokenEmptyDispatch()
Returns the dispatch token for an empty result [Tokens.FAILURE]. May be used when isFailOnEmpty is true.

Returns:
Message token for an empty result.

scrollerParams

Object[] scrollerParams(String parameter)
Return the array of parameters needed to select the entries for this set.

Parameters:
parameter - The additional parameter needed to select this set, if any.

result

Collection result(Object target,
                  Object parameter)
                  throws ResourceException
Returns the collection representing the result of the Search [null]. The default behavior performs a "like" search for the parameter Override for an other search type. Subclasses may ignor parameter argument when isParameter is false.

Parameters:
target - Bean to use for entries
parameter - Value to use to match entries
Returns:
Collection with the result of the search
Throws:
ResourceException

newScroller

Scroller newScroller(int entries)
                     throws ResourceException
Return new scroller using the current starting point (getScrollFrom), the default limit (set.SCROLL_ROWS), and current count from Access (countCurrent).

Returns:
new Scroller using current and default settings.
Throws:
ResourceException - on data access error

listLegend

void listLegend(ResultList list)
Setup the legend for the result list. Default behavior is to use the searchLabel and searchValue (if any).


scrollerSearch

ProcessResult scrollerSearch()
                             throws Exception
Invoke business logic; return result.

Throws:
Exception


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