com.bea.netuix.application.notifications.enumerators
Class AggregatingNotificationUserEnumerator

java.lang.Object
  extended by com.bea.netuix.application.notifications.enumerators.AggregatingNotificationUserEnumerator
All Implemented Interfaces
INotificationUserEnumerator, Serializable

public class AggregatingNotificationUserEnumerator
extends Object
implements INotificationUserEnumerator

Serves to aggregate multiple INotificationUserEnumerator objects into a single enumerator. Because the enumeration must guarantee that usernames are only returned once, this implementation creates an in-memory collection of all usernames returned from its contained enumerators so as to ensure that duplicate usernames are never passed on. This does limit the use of this implementation to a reasonably-sized set of usernames (the set that would reasonably fit in memory).

See Also
Serialized Form

Constructor Summary
AggregatingNotificationUserEnumerator(Collection<INotificationUserEnumerator> enumerators)
          Constructor where the collection of enumerators to aggregate is specified.
 
Method Summary
 void close()
          Releases any resources used by this enumeration.
 String getNext()
          Returns the next username in the enumeration.
 boolean hasNext()
          Used to determine if more usernames are available from this enumeration.
 void open()
          Serves to initialize the enumeration.
 void reset()
          Used to reset the enumeration to the beginning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregatingNotificationUserEnumerator

public AggregatingNotificationUserEnumerator(Collection<INotificationUserEnumerator> enumerators)
Constructor where the collection of enumerators to aggregate is specified.

Parameters
enumerators - the collection of enumerators to aggregate.
Method Detail

open

public void open()
          throws NotificationUserEnumerationException
Serves to initialize the enumeration. Any resources the enumeration needs may be obtained in this initialization method. This method is called before any calls to the reset, hasNext or getNext methods are made.

Specified by:
open in interface INotificationUserEnumerator
Throws
NotificationUserEnumerationException - if any problems were encountered.

reset

public void reset()
           throws NotificationUserEnumerationException
Used to reset the enumeration to the beginning. This may be necessary if a transaction got rolled back and the NotificationManager is attempting to send the notification again.

It is not necessary that the enumeration proceed in the same order as it did previously, nor that the enumeration results in the same total return set-- in other words, the enumeration can be based entirely on dynamic criteria or data which may change over time. The only requirement is that an enumeration must not return the same username twice unless a call to reset() has been made.

Specified by:
reset in interface INotificationUserEnumerator
Throws
NotificationUserEnumerationException - if any problems were encountered.

hasNext

public boolean hasNext()
                throws NotificationUserEnumerationException
Used to determine if more usernames are available from this enumeration.

Specified by:
hasNext in interface INotificationUserEnumerator
Returns
true as long as more usernames are available from the enumeration.
Throws
NotificationUserEnumerationException - if any problems were encountered.

getNext

public String getNext()
               throws NotificationUserEnumerationException
Returns the next username in the enumeration.

Specified by:
getNext in interface INotificationUserEnumerator
Returns
the next username in the enumeration.
Throws
NotificationUserEnumerationException - if any problems were encountered.

close

public void close()
           throws NotificationUserEnumerationException
Releases any resources used by this enumeration.

Specified by:
close in interface INotificationUserEnumerator
Throws
NotificationUserEnumerationException - if any problems were encountered.


Copyright © 2011, Oracle. All rights reserved.