com.businessobjects.sdk.biar.om
Interface IManagedObjectIterator


public interface IManagedObjectIterator

This interface is used to iterate through info objects contained in an IObjectManager instance, and is returned by methods of that interface when an arbitrarily large collection of objects would otherwise have to be returned.

The iterator is backed by the originating IObjectManager (OM), which itself is thread safe, but iterator behavior cannot be guaranteed when modifications concurrently take place to the underlying OM. When iterating, only use the update and remove methods of the active iterator. Any other modification to the OM contents through OM's interface or through other iterators could cause undefined behavior. Implementing classes are designed to fail fast in the face of concurrent modification by throwing ConcurrentModificationException, but this is only a best effort because concurrent modification cannot be relieably detected in a multithreaded environment. The fail-fast behaviour should only be used to detect bugs.

Note: IManagedObjectIterator instances must be closed when they will no longer be used, even if the iteration sequence is completed. If this crucial step is omitted, resources will be leaked.


Method Summary
 java.util.Iterator asCollectionsIterator()
          Converts the iterator to a Java Collections iterator to adapt with code using that interface.
 void close()
          Close the iterator, releasing all associated resources, and rendering the iterator useless.
 boolean hasNext()
          Checks to see if there are more elements in the iteration sequence.
 IInfoObject next()
          Gets the next info object in the iteration sequence.
 void remove()
          Remove the last info object returned from IManagedObjectIterator.next() from the underlying IObjectManager.
 void update(IInfoObject obj)
          Update the last info object returned from IManagedObjectIterator.next() in the underlying IObjectManager.
 

Method Detail

asCollectionsIterator

java.util.Iterator asCollectionsIterator()

Converts the iterator to a Java Collections iterator to adapt with code using that interface. Advancing the returned iterator will advance the underlying IManagedObjectIterator and any OMException encountered while iterating will be rethrown as an unchecked IterationFailedException.

Returns:
a java.util.Iterator that iterates the same sequence as this IManagedObjectIterator.

hasNext

boolean hasNext()
                throws OMException

Checks to see if there are more elements in the iteration sequence.

Returns:
true if and only if there are more elements in the sequence.
Throws:
OMException - if the operation fails.

next

IInfoObject next()
                 throws OMException

Gets the next info object in the iteration sequence.

Returns:
the next info object in the iteration sequence.
Throws:
OMException - if the underlying read fails.
NoSuchElementException - if there is no next element in the sequence.

remove

void remove()
            throws OMException

Remove the last info object returned from IManagedObjectIterator.next() from the underlying IObjectManager.

Throws:
OMException - the underlying remove operation fails.
java.lang.IllegalStateException - if IManagedObjectIterator.next() has not yet been called.

update

void update(IInfoObject obj)
            throws OMException

Update the last info object returned from IManagedObjectIterator.next() in the underlying IObjectManager. Identity is determined and enforced by examining the CUID.

Parameters:
obj - the updated info object.
Throws:
OMException - the underlying update fails.
java.lang.IllegalStateException - if the CUID of the obj parameter does not match the CUID of the last info object returned from the next method, or if next has not yet been called.

close

void close()
           throws OMException

Close the iterator, releasing all associated resources, and rendering the iterator useless.

Throws:
OMException - if the operation fails.