RSException
{
StoreEnumeration se = null;
try
{
final ProgressEvent event = new ProgressEvent();
event.setAnimate( true );
event.setCurrentValue( 3 );
event.setMaxValue( new Integer( -1 ) );
final String searching = ResourceManager.getResource( "global.Searching" );
event.setMessage( "" );
event.setPhase( searching );
event.setSource( this );
event.dispatch();
open();
final Index index = (Index) indexMap.get( Constants.REMOTE_ID );
int[] recordIds = null;
// If there's an index on remote id use the index buildSortedList
// feature, it's much faster than a RecordEnumeration
boolean failure = true;
if( index != null )
{
try
{
recordIds = index.buildSortedList();
failure = false;
}
catch( Exception e )
{
// If this operation fails, fall back to the enumeration
log.error( e );
}
}
if( failure )
{
se = rs.enumerateRecords();
final int count = se.numRecords();
event.setAnimate( false );
event.setCurrentValue( 0 );
event.setMaxValue( new Integer( count ) );
event.dispatch();
recordIds = new int[ count ];
for( int i = 0; se.hasNext(); i++ )
{
recordIds[i] = se.nextId();
if( i % 10 == 0 )
{
event.setCurrentValue( i );
event.dispatch();
}
}
}
return new RowSet( this, recordIds, null, null, RowSet.SM_EXACT );
}