com.beasys.commerce.ebusiness.catalog
Class CatalogItemIterator

java.lang.Object
  extended by com.beasys.commerce.ebusiness.catalog.CatalogItemIterator
All Implemented Interfaces
ViewIterator, Serializable
Direct Known Subclasses:
CategoryItemIterator, CategoryIterator, OrphanedItemIterator, ProductItemIterator, SearchItemIterator, SiblingIterator, SubCategoryIterator

public abstract class CatalogItemIterator
extends Object
implements ViewIterator, Serializable

The CatalogItemIterator is an abstract base class that all catalog iterators must extend. This class should only be used by a single thread.

See Also
View, ViewIterator, Serialized Form

Field Summary
static int DEFAULT_VIEW_SIZE
           
protected static boolean VERBOSE
           
 
Constructor Summary
CatalogItemIterator(String managerJndiName, CatalogRequest catalogRequest, int numItems, int viewSize)
          CatalogItemIterator constructor that takes the total number of spanned objects and a view size.
 
Method Summary
protected abstract  CatalogItem getCatalogItem(View view, int itemIndex)
          Returns a CatalogItem within the current view.
protected  CatalogManager getCatalogManager()
           
protected  CatalogQueryManager getCatalogQueryManager()
           
protected  CatalogRequest getCatalogRequest()
           
protected  CategoryManager getCategoryManager()
           
 View getCurrentView()
          Returns the current view.
protected  CustomDataManager getCustomDataManager()
           
protected  ProductItemManager getProductItemManager()
           
 View getViewAt(int index)
          Gets the view at the specified index.
 int getViewCount()
          Returns the number of views spanned by this iterator.
 void gotoNextView()
          Moves the iterator to the next view.
 void gotoPreviousView()
          Moves the iterator to the previous view.
 void gotoViewAt(int index)
          Moves the iterator to the view at the specified index.
 boolean hasNext()
          Returns true if the iterator has more elements.
 boolean hasNextView()
          Returns true if the iterator has a next view.
 boolean hasPreviousView()
          Returns true if the iterator has a previous view.
 Object next()
          Returns the next element in the iteration.
protected abstract  void refreshView(View view)
          This function is called whenever the current view needs to be refreshed.
 int size()
          Returns the number of objects over which the iterator spans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

protected static final boolean VERBOSE
See Also
Constants Summary

DEFAULT_VIEW_SIZE

public static final int DEFAULT_VIEW_SIZE
See Also
Constants Summary
Constructor Detail

CatalogItemIterator

public CatalogItemIterator(String managerJndiName,
                           CatalogRequest catalogRequest,
                           int numItems,
                           int viewSize)
CatalogItemIterator constructor that takes the total number of spanned objects and a view size.

Method Detail

getCatalogManager

protected CatalogManager getCatalogManager()
                                    throws RemoteException
Throws
RemoteException

getProductItemManager

protected ProductItemManager getProductItemManager()
                                            throws RemoteException
Returns
the ProductItemManger for the CatalogManager associated with this ViewIterator.
Throws
RemoteException - on remote error.
See Also
ProductItemManager

getCategoryManager

protected CategoryManager getCategoryManager()
                                      throws RemoteException
Returns
the CategoryManager for the CatalogManager associated with this ViewIterator.
Throws
RemoteException - on remote error.
See Also
CategoryManager

getCatalogQueryManager

protected CatalogQueryManager getCatalogQueryManager()
                                              throws RemoteException
Returns
the CatalogQueryManager for the CatalogManager associated with this ViewIterator.
Throws
RemoteException - on remote error.
See Also
CatalogQueryManager

getCustomDataManager

protected CustomDataManager getCustomDataManager()
                                          throws RemoteException
Returns
the CustomDataManager for the CatalogManager associated with this ViewIterator.
Throws
RemoteException - on remote error.
See Also
CustomDataManager

getCatalogRequest

protected CatalogRequest getCatalogRequest()
Returns
the CatalogRequest for this ViewIterator.
Throws
RemoteException - on remote error.
See Also
CatalogRequest

refreshView

protected abstract void refreshView(View view)
                             throws RemoteException
This function is called whenever the current view needs to be refreshed. All classes that extend this class must implement this function.

Parameters
view - The view to refresh.
Throws
RemoteException - on remote error.

getCatalogItem

protected abstract CatalogItem getCatalogItem(View view,
                                              int itemIndex)
                                       throws NoSuchElementException
Returns a CatalogItem within the current view. All classes that extend this class must implement this function.

Parameters
view - The current view.
itemIndex - The index of the item to retrieve.
Throws
NoSuchElementException - If the item does not exist.

size

public final int size()
Returns the number of objects over which the iterator spans. This number is guaranteed to only be accurate at the time of iterator creation.

Specified by:
size in interface ViewIterator
Returns
The number of spanned objects.

hasNext

public final boolean hasNext()
Returns true if the iterator has more elements.

Specified by:
hasNext in interface ViewIterator
Returns
true if the iterator has more elements.

next

public Object next()
            throws NoSuchElementException,
                   RemoteException
Returns the next element in the iteration.

Specified by:
next in interface ViewIterator
Returns
the next element in the iteration.
Throws
RemoteException - on remote error.
NoSuchElementException - if the iteration has no more elements.

getViewCount

public final int getViewCount()
Returns the number of views spanned by this iterator.

Specified by:
getViewCount in interface ViewIterator
Returns
the number of views spanned by this iterator.

getCurrentView

public final View getCurrentView()
Returns the current view.

Specified by:
getCurrentView in interface ViewIterator
Returns
The current view.

getViewAt

public final View getViewAt(int index)
                     throws IndexOutOfBoundsException
Gets the view at the specified index.

Specified by:
getViewAt in interface ViewIterator
Parameters
index - The index of the desired view.
Returns
The view at the specified index.
Throws
IndexOutOfBoundsException - if the index is invalid.

hasNextView

public final boolean hasNextView()
Returns true if the iterator has a next view.

Specified by:
hasNextView in interface ViewIterator
Returns
true if the iterator has a next view.

hasPreviousView

public final boolean hasPreviousView()
Returns true if the iterator has a previous view.

Specified by:
hasPreviousView in interface ViewIterator
Returns
true if the iterator has a previous view.

gotoNextView

public final void gotoNextView()
                        throws NoSuchViewException
Moves the iterator to the next view.

Specified by:
gotoNextView in interface ViewIterator
Throws
NoSuchViewException - if the iterator does not have a next view.

gotoPreviousView

public final void gotoPreviousView()
                            throws NoSuchViewException
Moves the iterator to the previous view.

Specified by:
gotoPreviousView in interface ViewIterator
Throws
NoSuchViewException - if the iterator does not have a previous view.

gotoViewAt

public final void gotoViewAt(int index)
                      throws NoSuchViewException
Moves the iterator to the view at the specified index.

Specified by:
gotoViewAt in interface ViewIterator
Parameters
index - The index of the desired view.
Throws
NoSuchViewException - if the index is invalid.


Copyright © 2006 BEA Systems, Inc. All Rights Reserved