com.novell.sentinel.client.bean
Class PagedBeanCollection<B extends SentinelBean>

java.lang.Object
  extended by com.novell.sentinel.client.bean.PagedBeanCollection<B>
Type Parameters:
B - The bean type (e.g., IdentityBean)

public class PagedBeanCollection<B extends SentinelBean>
extends Object

A class to contain the results of a "list" operation on Sentinel data items.


Nested Class Summary
static class PagedBeanCollection.DeltaCounts
           
 
Constructor Summary
PagedBeanCollection(BeanTransporter<B> _pageSource)
          Construct an instance with the passed BeanTransporter as the source which will be used to get the next or previous pages.
 
Method Summary
 void addBean(B bean)
          Add a bean to this page.
 Collection<B> getBeans()
          Get the Collection of beans in the page.
 PagedBeanCollection.DeltaCounts getDeltaCounts()
          Get the delta counts (if any) supplied with the page data.
 String getNextPageURL()
          Get the URL (if any) of the next page of data.
 String getPreviousPageURL()
          Get the URL (if any) of the previous page of data.
 boolean hasNextPage()
          Return true if there is a next potential next page of items addressed by a URL.
 boolean hasPreviousPage()
          Return true if there is a next potential previous page of items addressed by a URL.
 void nextPage(OnBeanPageLoad<B> handler)
          Get the next page of data items.
 void previousPage(OnBeanPageLoad<B> handler)
          Get the previous page of data items.
 void setDeltaCounts(int createdCount, int deletedCount, int modifiedCount)
          Set the delta counts for this page.
 void setNextPageURL(String url)
          Set the next page URL.
 void setPreviousPageURL(String url)
          Set the previous page URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagedBeanCollection

public PagedBeanCollection(BeanTransporter<B> _pageSource)
Construct an instance with the passed BeanTransporter as the source which will be used to get the next or previous pages.

Parameters:
_pageSource - BeanTransporter implementation.
Method Detail

setDeltaCounts

public void setDeltaCounts(int createdCount,
                           int deletedCount,
                           int modifiedCount)
Set the delta counts for this page. This is designed to be used by the deserialization code.

Parameters:
createdCount -
deletedCount -
modifiedCount -

getDeltaCounts

public PagedBeanCollection.DeltaCounts getDeltaCounts()
Get the delta counts (if any) supplied with the page data.

Returns:
The counts instance, or null.

getNextPageURL

public String getNextPageURL()
Get the URL (if any) of the next page of data. A URL does not guarantee that the page addressed will actually contain items.

Returns:
The URL, or null.

setNextPageURL

public void setNextPageURL(String url)
Set the next page URL. This is intended to be used by BeanTransporter implementations.

Parameters:
url - The URL of the next page of data.

getPreviousPageURL

public String getPreviousPageURL()
Get the URL (if any) of the previous page of data. A URL does not guarantee that the page addressed will actually contain items.

Returns:
The URL, or null.

setPreviousPageURL

public void setPreviousPageURL(String url)
Set the previous page URL. This is intended to be used by BeanTransporter implementations.

Parameters:
url - The URL of the previous page of data.

getBeans

public Collection<B> getBeans()
Get the Collection of beans in the page. May be empty.

Returns:
A Collection. May be empty, will never be null.

addBean

public void addBean(B bean)
Add a bean to this page. This is intended to be used by BeanTransporter implementations.

Parameters:
bean - The bean to add.

hasNextPage

public boolean hasNextPage()
Return true if there is a next potential next page of items addressed by a URL.

Returns:
true if the next page URL is not null.

hasPreviousPage

public boolean hasPreviousPage()
Return true if there is a next potential previous page of items addressed by a URL.

Returns:
true if the previous page URL is not null.

nextPage

public void nextPage(OnBeanPageLoad<B> handler)
Get the next page of data items. This will issue an HTTP GET if the next page URL is set.

Parameters:
handler - The handler to which is reported the GET results. If the URL is not set, an empty page is reported.

previousPage

public void previousPage(OnBeanPageLoad<B> handler)
Get the previous page of data items. This will issue an HTTP GET if the next previous URL is set.

Parameters:
handler - The handler to which is reported the GET results. If the URL is not set, an empty page is reported.