org.dspace.content
Class ItemIterator

java.lang.Object
  extended by org.dspace.content.ItemIterator

public class ItemIterator
extends Object

Specialized iterator for DSpace Items. This iterator is used for loading items into memory one by one, since in many cases, it would not make sense to load a set of items into memory all at once. For example, loading in an entire community or site's worth of items wouldn't make sense. Note that this class is not a real Iterator, as it does not implement the Iterator interface

Version:
$Revision: 3761 $
Author:
Robert Tansley, Richard Jones

Constructor Summary
ItemIterator(Context context, ArrayList iids)
          Construct an item iterator using an array list of item ids
ItemIterator(Context context, TableRowIterator rows)
          Construct an item iterator using a set of TableRow objects from the item table
 
Method Summary
 void close()
          Dispose of this Iterator, and it's underlying resources
 boolean hasNext()
          Find out if there are any more items to iterate over
 Item next()
          Get the next item in the iterator.
 int nextID()
          return the id of the next item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemIterator

public ItemIterator(Context context,
                    TableRowIterator rows)
Construct an item iterator using a set of TableRow objects from the item table

Parameters:
context - our context
rows - the rows that correspond to the Items to be iterated over

ItemIterator

public ItemIterator(Context context,
                    ArrayList iids)
Construct an item iterator using an array list of item ids

Parameters:
context - our context
iids - the array list to be iterated over
Method Detail

hasNext

public boolean hasNext()
                throws SQLException
Find out if there are any more items to iterate over

Returns:
true if there are more items
Throws:
SQLException

next

public Item next()
          throws SQLException
Get the next item in the iterator. Returns null if there are no more items.

Returns:
the next item, or null
Throws:
SQLException

nextID

public int nextID()
           throws SQLException
return the id of the next item.

Returns:
the next id or -1 if none
Throws:
SQLException

close

public void close()
Dispose of this Iterator, and it's underlying resources



Copyright © 2010 DuraSpace. All Rights Reserved.