DLESE Tools
v1.6.0

org.dlese.dpc.schemedit
Class RecordList

java.lang.Object
  extended by org.dlese.dpc.schemedit.RecordList

public class RecordList
extends Object

Class to manage a list of records (e.g. search results) as a list of RECORD IDS, rather than as ResultDoc arrays. We don't want to keep sets of ResultDocs around because they take up memory and also because they can become stale over time.

Author:
ostwald

Constructor Summary
RecordList()
          Constructor for the RecordList object
RecordList(ResultDocList resultDocs, SimpleLuceneIndex index)
          Constructor for the RecordList object given a ResultDocList and a SimpleLuceneIndex.
RecordList(SimpleLuceneIndex index)
          Constructor for the RecordList object
RecordList(String[] ids, SimpleLuceneIndex index)
          Constructor for the RecordList object given an array of ids
RecordList(String query, SimpleLuceneIndex index)
          Contructor for the RecordList object given a query string and a lucene index
 
Method Summary
 void add(String id)
          Add the id to this RecordLists's items
 boolean contains(String id)
          returns true of the provided id is managed by this RecordList
 String getCurrentRecId()
          Id of the current record.
 int getCurrentRecIndex()
          Index of the current record in the result list.
 ResultDoc getCurrentResult()
          Gets the current record as a ResultDoc instance.
 List getHits()
          Returns the records as a list of ResultDocs
 List getHits(int start, int length)
          Returns a list of recordDocs for the specified range.
 int getIndexOf(String id)
          Returns the index of the specified id, or -1 if it is not managed by this RecordList
 boolean getIsEmpty()
          Gets the isEmpty attribute of the RecordList object
 List getItems()
          List of record ids returned by the last query.
 String getRecId(int recIndex)
          Gets the recId attribute of the RecordList object
 ResultDoc getResultDoc(String id)
          Gets the ResultDoc given a record id via the index.
 ResultDoc getResultDoc(String id, SimpleLuceneIndex index)
          Gets the resultDoc for a particular record by searching the index.
 int getSize()
          Gets the size attribute of the RecordList object
 boolean isEmpty()
          Gets the empty attribute of the RecordList object
 Iterator iterator()
          Returns an iterator for the current record list.
 void setCurrentRecId(String id)
          Sets the currentRecId attribute of the RecordList object
 void setIndex(SimpleLuceneIndex index)
          Sets the index attribute of the RecordList object
 int size()
          The number of items
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordList

public RecordList()
Constructor for the RecordList object


RecordList

public RecordList(SimpleLuceneIndex index)
Constructor for the RecordList object

Parameters:
index - the index

RecordList

public RecordList(String query,
                  SimpleLuceneIndex index)
Contructor for the RecordList object given a query string and a lucene index

Parameters:
query - the query
index - a lucene index

RecordList

public RecordList(ResultDocList resultDocs,
                  SimpleLuceneIndex index)
Constructor for the RecordList object given a ResultDocList and a SimpleLuceneIndex. The record IDs are extracted from ResultDocList items and stored.

Parameters:
resultDocs - the resultDocList
index - the index

RecordList

public RecordList(String[] ids,
                  SimpleLuceneIndex index)
Constructor for the RecordList object given an array of ids

BatchOperations.handleRemoveRecords() uses this method for the values returned by request.getParameterValues().

Parameters:
ids - An array of RecordIds
index - the index
Method Detail

size

public int size()
The number of items

Returns:
the number of ids (items) managed by this RecordList

getSize

public int getSize()
Gets the size attribute of the RecordList object

Returns:
The size value

iterator

public Iterator iterator()
Returns an iterator for the current record list.

Returns:
an iterator over this recordList's ids

contains

public boolean contains(String id)
returns true of the provided id is managed by this RecordList

Parameters:
id - id to check against items
Returns:
true if this RecordList's items contains specified id

add

public void add(String id)
Add the id to this RecordLists's items

Parameters:
id - id to add

isEmpty

public boolean isEmpty()
Gets the empty attribute of the RecordList object

Returns:
The empty value

getIsEmpty

public boolean getIsEmpty()
Gets the isEmpty attribute of the RecordList object

Returns:
The isEmpty value

getIndexOf

public int getIndexOf(String id)
Returns the index of the specified id, or -1 if it is not managed by this RecordList

Parameters:
id - a record id to find the index of in this ResultList
Returns:
The indexOf value

getItems

public List getItems()
List of record ids returned by the last query.

Returns:
The items value

setIndex

public void setIndex(SimpleLuceneIndex index)
Sets the index attribute of the RecordList object

Parameters:
index - The new index value

getHits

public List getHits()
Returns the records as a list of ResultDocs

Returns:
The hits value

getHits

public List getHits(int start,
                    int length)
Returns a list of recordDocs for the specified range.

Parameters:
start - beginning index
length - length of range
Returns:
The hits value

getCurrentRecId

public String getCurrentRecId()
Id of the current record.

Returns:
The currentRecId value

setCurrentRecId

public void setCurrentRecId(String id)
Sets the currentRecId attribute of the RecordList object

Parameters:
id - The new currentRecId value

getCurrentRecIndex

public int getCurrentRecIndex()
Index of the current record in the result list.

Returns:
The currentRecIndex value

getCurrentResult

public ResultDoc getCurrentResult()
Gets the current record as a ResultDoc instance.

Returns:
The currentResult value

getResultDoc

public ResultDoc getResultDoc(String id)
Gets the ResultDoc given a record id via the index.

Parameters:
id - the id for which to obtain a ResultDoc
Returns:
The resultDoc value

getResultDoc

public ResultDoc getResultDoc(String id,
                              SimpleLuceneIndex index)
Gets the resultDoc for a particular record by searching the index.

Parameters:
id - record id
index - the index
Returns:
The resultDoc value

getRecId

public String getRecId(int recIndex)
Gets the recId attribute of the RecordList object

Parameters:
recIndex - NOT YET DOCUMENTED
Returns:
The recId value

DLESE Tools
v1.6.0