com.sun.mdm.index.master.search.potdup
Class PotentialDuplicateIterator

java.lang.Object
  extended bycom.sun.mdm.index.page.PageIteratorWrapper
      extended bycom.sun.mdm.index.master.search.potdup.PotentialDuplicateIterator
All Implemented Interfaces:
java.io.Serializable

public class PotentialDuplicateIterator
extends PageIteratorWrapper
implements java.io.Serializable

The PotentialDuplicateIterator class represents an iterator containing the PotentialDuplicateSummary objects returned by a call to lookupPotentialDuplicates. Use indexes to page through the PotentialDuplicateSummary objects and to retrieve specific objects from the iterator.

See Also:
Serialized Form

Constructor Summary
PotentialDuplicateIterator(java.util.ArrayList fullData)
          Creates a new instance of the PotentialDuplicateIterator class that does not maintain the connection to the server.
PotentialDuplicateIterator(PageData pageData, int pageSize, int maxElements)
          Creates a new instance of the PotentialDuplicateIterator class that maintains the connection to the server.
 
Method Summary
 PotentialDuplicateSummary absolute(int index)
          Retrieves a PotentialDuplicateSummary object at the specified index from the PotentialDuplicateIterator object.
 PotentialDuplicateSummary[] absolute(int index, int count)
          Retrieves a series of rows from a PotentialDuplicateIterator object, beginning with the row at the specified index and continuing through the specified number of rows.
 PotentialDuplicateSummary first()
          Retrieves the first row from a PotentialDuplicateIterator object.
 PotentialDuplicateSummary[] first(int count)
          Retrieves the first rows in the iterator.
 PotentialDuplicateSummary next()
          Retrieves the next row from a PotentialDuplicateIterator object.
 PotentialDuplicateSummary[] next(int count)
          Retrieves the next series of rows in the iterator.
 PotentialDuplicateSummary prev()
          Retrieves the previous row from a PotentialDuplicateIterator object.
 PotentialDuplicateSummary[] prev(int count)
          Retrieves the previous series of rows in the iterator.
 void setReadForwardOnly(boolean forwardOnly)
          Specifies whether the potential duplicate iterator will clear all the DataPage objects of a loaded page (i) once it starts to read and load the next page (i+1).
 void sortBy(java.lang.String field, boolean reverse)
          Sorts the objects in the PotentialDuplicateIterator by the specified comparator.
 void sortSummaryBy(java.lang.String field, boolean reverse)
          Sorts the objects in the PotentialDuplicateIterator by the specified comparator.
 
Methods inherited from class com.sun.mdm.index.page.PageIteratorWrapper
close, count, currentPosition, getGenericIterator, hasNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PotentialDuplicateIterator

public PotentialDuplicateIterator(java.util.ArrayList fullData)
                           throws PageException
Creates a new instance of the PotentialDuplicateIterator class that does not maintain the connection to the server.

Parameters:
fullData - An array of all objects in the result set.
Throws:
PageException - Thrown if an error occurs while creating the iterator.

PotentialDuplicateIterator

public PotentialDuplicateIterator(PageData pageData,
                                  int pageSize,
                                  int maxElements)
                           throws PageException
Creates a new instance of the PotentialDuplicateIterator class that maintains the connection to the server.

Parameters:
pageData - A session bean that stores the data retrieved from the server.
pageSize - The size of each unit of data retrieved from the server.
maxElements - The maximum number of elements retrieved for a potential duplicate search.
Throws:
PageException - An error occurred while creating the iterator.
Method Detail

absolute

public PotentialDuplicateSummary absolute(int index)
                                   throws PageException,
                                          java.rmi.RemoteException
Retrieves a PotentialDuplicateSummary object at the specified index from the PotentialDuplicateIterator object.

Parameters:
index - The row to retrieve.
Returns:
PotentialDuplicateSummary - A PotentialDuplicateSummary object.
Throws:
PageException - Thrown if an error occurs while retrieving the object.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

absolute

public PotentialDuplicateSummary[] absolute(int index,
                                            int count)
                                     throws PageException,
                                            java.rmi.RemoteException
Retrieves a series of rows from a PotentialDuplicateIterator object, beginning with the row at the specified index and continuing through the specified number of rows.

Parameters:
index - The first row to retrieve.
count - The total number of rows to retrieve.
Returns:
PotentialDuplicateSummary[] - An array of PotentialDuplicateSummary objects.
Throws:
PageException - Thrown if an error occurs while retrieving the objects.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

first

public PotentialDuplicateSummary first()
                                throws PageException,
                                       java.rmi.RemoteException
Retrieves the first row from a PotentialDuplicateIterator object.

Parameters:
None.

Returns:
PotentialDuplicateSummary - A PotentialDuplicateSummary object.
Throws:
PageException - Thrown if an error occurs while retrieving the object.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

first

public PotentialDuplicateSummary[] first(int count)
                                  throws PageException,
                                         java.rmi.RemoteException
Retrieves the first rows in the iterator. The number of rows retrieved is specified as a parameter to this method. If the number of rows specified by the parameter is larger than the number of records in the iterator, all rows are retrieved.

Parameters:
count - The total number of rows to retrieve.
Returns:
PotentialDuplicateSummary[] - An array of PotentialDuplicateSummary objects.
Throws:
PageException - Thrown if an error occurs while retrieving the objects.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

next

public PotentialDuplicateSummary next()
                               throws java.rmi.RemoteException,
                                      PageException
Retrieves the next row from a PotentialDuplicateIterator object. If the current index is 4, this method returns the row at index=4.

Parameters:
None.

Returns:
PotentialDuplicateSummary - A PotentialDuplicateSummary object.
Throws:
PageException - Thrown if the call to hasNext returns false.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

next

public PotentialDuplicateSummary[] next(int count)
                                 throws java.rmi.RemoteException,
                                        PageException
Retrieves the next series of rows in the iterator. The number of rows retrieved is specified as a parameter to this method. If the iterator does not have the specified number of rows remaining, it only retrieves the remaining rows.

Parameters:
count - The total number of rows to retrieve.
Returns:
PotentialDuplicateSummary[] - An array of PotentialDuplicateSummary objects.
Throws:
PageException - Thrown if the index is already at the end of the iterator.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

prev

public PotentialDuplicateSummary prev()
                               throws PageException,
                                      java.rmi.RemoteException
Retrieves the previous row from a PotentialDuplicateIterator object. If the current index is 5, this method returns the row at index=4 and leaves the position at index=4.

Parameters:
None.

Returns:
PotentialDuplicateSummary - A PotentialDuplicateSummary object.
Throws:
PageException - Thrown if the index is already at the beginning of the iterator.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

prev

public PotentialDuplicateSummary[] prev(int count)
                                 throws PageException,
                                        java.rmi.RemoteException
Retrieves the previous series of rows in the iterator. The number of rows retrieved is specified as a parameter to this method.

Parameters:
count - The total number of rows to retrieve.
Returns:
PotentialDuplicateSummary[] - An array of PotentialDuplicateSummary objects.
Throws:
PageException - Thrown if the index is already at the beginning of the iterator.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

setReadForwardOnly

public void setReadForwardOnly(boolean forwardOnly)
Specifies whether the potential duplicate iterator will clear all the DataPage objects of a loaded page (i) once it starts to read and load the next page (i+1). Setting the iterator to clear old DataPage objects helps to optimize the performance of potential duplicate reports.

Parameters:
forwardOnly - A Boolean indicator of whether the iterator will clear old DataPage objects. Specify true to clear old DataPage objects; specify false to leave the objects in memory.
Returns:
void - None.
Throws:
None.

sortBy

public void sortBy(java.lang.String field,
                   boolean reverse)
            throws PageException,
                   java.rmi.RemoteException
Sorts the objects in the PotentialDuplicateIterator by the specified comparator.

Parameters:
field - The name of the field to use as sorting criteria.
reverse - An indicator of whether to sort in ascending or descending order. Specify true to sort in descending order, or specify false to sort in ascending order.
Returns:
void - None.
Throws:
PageException - Thrown if there is an error during sorting.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.

sortSummaryBy

public void sortSummaryBy(java.lang.String field,
                          boolean reverse)
                   throws PageException,
                          java.rmi.RemoteException
Sorts the objects in the PotentialDuplicateIterator by the specified comparator. This method does not load the associated objects, improving the performance of the action.

Parameters:
field - The name of the field to use as sorting criteria.
reverse - An indicator of whether to sort in ascending or descending order. Specify true to sort in descending order, or specify false to sort in ascending order.
Returns:
void - None.
Throws:
PageException - Thrown if there is an error during sorting.
java.rmi.RemoteException - Thrown if the connection to the server goes down during processing.


Sun Microsystems, Inc.