Class TransactionalServiceUtils


  • public final class TransactionalServiceUtils
    extends Object
    This class provides utility methods to support the operation of transactional services
    • 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 -