org.kuali.rice.kns.util
Class TransactionalServiceUtils

java.lang.Object
  extended by org.kuali.rice.kns.util.TransactionalServiceUtils

public class TransactionalServiceUtils
extends Object

This class provides utility methods to support the operation of transactional services


Constructor Summary
TransactionalServiceUtils()
           
 
Method Summary
static
<E> Iterator<E>
copyToExternallyUsuableIterator(Iterator<E> iter)
          Copys iterators so that they may be used outside of this class.
static void exhaustIterator(Iterator<?> iterator)
          Exhausts (i.e.
static
<E> E
retrieveFirstAndExhaustIterator(Iterator<E> iterator)
          Returns the first element and exhausts an iterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionalServiceUtils

public TransactionalServiceUtils()
Method Detail

copyToExternallyUsuableIterator

public static <E> Iterator<E> copyToExternallyUsuableIterator(Iterator<E> iter)
Copys iterators so that they may be used outside of this class. Often, the DAO may return iterators that may not be used outside of this class because the transaction/ connection may be automatically closed by Spring. This method copies all of the elements in the OJB backed iterators into list-based iterators by placing the returned BOs into a list

Parameters:
iter - an OJB backed iterator to copy
Returns:
an Iterator that may be used outside of this class

retrieveFirstAndExhaustIterator

public static <E> E retrieveFirstAndExhaustIterator(Iterator<E> iterator)
Returns the first element and exhausts an iterator

Type Parameters:
E - the type of elements in the iterator
Parameters:
iterator - the iterator to exhaust
Returns:
the first element of the iterator; null if the iterator's empty

exhaustIterator

public static void exhaustIterator(Iterator<?> iterator)
Exhausts (i.e. complete iterates through) an iterator

Parameters:
iterator -


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.