org.rhq.enterprise.gui.common.paging
Class ResourceNameDisambiguatingPagedListDataModel<T>

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.rhq.enterprise.gui.common.paging.PagedListDataModel<org.rhq.core.domain.resource.composite.DisambiguationReport<T>>
          extended by org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel<T>
Direct Known Subclasses:
ListResourceGroupMembersUIBean.ListResourceGroupMembersDataModel, ResourceGroupSummaryUIBean.ListResourceGroupMembersDataModel

public abstract class ResourceNameDisambiguatingPagedListDataModel<T>
extends PagedListDataModel<org.rhq.core.domain.resource.composite.DisambiguationReport<T>>

This is an extension to the PagedListDataModel that automatically performs the disambiguation of the resource names contained in the pages of fetched data.

This class implements the PagedListDataModel.fetchPage(PageControl) method and defers the actual loading of the data to a new fetchDataForPage(PageControl) method. The result of that call is supplied to the ResourceManagerLocal.disambiguate(java.util.List, IntExtractor, DisambiguationUpdateStrategy) method and the disambiguated results are then returned from the fetchPage(PageControl) method.

Author:
Lukas Krejci

Constructor Summary
ResourceNameDisambiguatingPagedListDataModel(PageControlView view, String beanName, boolean alwaysIncludeParents)
           
 
Method Summary
protected abstract  org.rhq.core.domain.util.PageList<T> fetchDataForPage(org.rhq.core.domain.util.PageControl pc)
          This method is to be implemented by inheritors and is called to fetch the actual data that contain the resources to disambiguate.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.composite.DisambiguationReport<T>> fetchPage(org.rhq.core.domain.util.PageControl pc)
          Method which must be implemented in cooperation with the managed bean class to fetch data on demand.
protected abstract  IntExtractor<T> getResourceIdExtractor()
           
 
Methods inherited from class org.rhq.enterprise.gui.common.paging.PagedListDataModel
getDataPage, getDefaultPageControl, getPageControl, getPageControlView, getRowCount, getRowData, getRowIndex, getWrappedData, isRowAvailable, setPageControl, setRowIndex, setWrappedData
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceNameDisambiguatingPagedListDataModel

public ResourceNameDisambiguatingPagedListDataModel(PageControlView view,
                                                    String beanName,
                                                    boolean alwaysIncludeParents)
Parameters:
view -
beanName -
alwaysIncludeParents - whether the disambiguation should always include the parent names even if they wouldn't be needed to make the resource names unique.
Method Detail

fetchPage

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.composite.DisambiguationReport<T>> fetchPage(org.rhq.core.domain.util.PageControl pc)
Description copied from class: PagedListDataModel
Method which must be implemented in cooperation with the managed bean class to fetch data on demand.

Specified by:
fetchPage in class PagedListDataModel<org.rhq.core.domain.resource.composite.DisambiguationReport<T>>
Parameters:
pc - information such as the first row of data to be fetched, the number of rows of data to be fetched and sorting data
Returns:
the data page with the rows in memory

fetchDataForPage

protected abstract org.rhq.core.domain.util.PageList<T> fetchDataForPage(org.rhq.core.domain.util.PageControl pc)
This method is to be implemented by inheritors and is called to fetch the actual data that contain the resources to disambiguate.

Parameters:
pc -
Returns:

getResourceIdExtractor

protected abstract IntExtractor<T> getResourceIdExtractor()
Returns:
an extractor for getting a resource id out of the instance of type T.


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.