Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DatabaseObjectIterator

java.lang.Object
  extended by com.jivesoftware.forum.database.DatabaseObjectIterator
All Implemented Interfaces:
java.util.Iterator

public class DatabaseObjectIterator
extends java.lang.Object
implements java.util.Iterator

An class that defines the logic to iterate through an array of long unique ID's of Jive objects.

One feature of the class is the ability to recover from underlying modifications to the dataset in some cases. Consider the following sequence of events:

In the above example, the underlying messages in the thread were changed after the initial iterator was obtained. The logic in this class will attempt to automatically compensate for these changes by skipping over items that cannot be loaded. In the above example, that would translate to the iterator returning 5 messages instead of 8.


Constructor Summary
DatabaseObjectIterator(int type, long[] elements)
          Creates a new DatabaseObjectIterator.
 
Method Summary
 java.lang.Object getNextElement()
          Returns the next available element, or null if there are no more elements to return.
 boolean hasNext()
          Returns true if there are more elements in the iteration.
 java.lang.Object next()
          Returns the next element.
 void remove()
          Not supported for security reasons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseObjectIterator

public DatabaseObjectIterator(int type,
                              long[] elements)
Creates a new DatabaseObjectIterator. The type must be one of the following: Additionally, each type of iterator requires an extra object of a certain type to perform iteration. In respective order for each type, extraObject should be a ForumFactory, Forum, ForumThread, UserManager, or GroupManager. If type and extraObject do not match, iteration construction will fail.

The implementation of this method takes the type and extraObject and creates anonymous inner classes to handle loading of each Jive object.

Method Detail

hasNext

public boolean hasNext()
Returns true if there are more elements in the iteration.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements.

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Returns the next element.

Specified by:
next in interface java.util.Iterator
Returns:
the next element.
Throws:
java.util.NoSuchElementException - if there are no more elements.

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Not supported for security reasons.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException

getNextElement

public java.lang.Object getNextElement()
Returns the next available element, or null if there are no more elements to return.

Returns:
the next available element.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.