com.redhat.rhn.common.db.datasource
Class DataList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by com.redhat.rhn.common.db.datasource.DataList<E>
Type Parameters:
E - the type of the objects to be used in this list.
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

public class DataList<E>
extends java.util.ArrayList<E>

Replacement for DataResult. Used for displayed lists for which the data comes from database queries. Main functionality: elaborates the data right before it is requested so that only the subset of data needed is elaborated and nobody needs to remember to elaborate the list. Differences from DataResult: DataList elaborates on its own, DataResult had to be told. DataList contains no pagination data, expecting the UI to handle that whereas DataResult contained start, end, and total size data expecting UI to deal directly with these methods rather than just those of a list.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DataList(java.util.Collection c)
          Collection constructor for special cases.
 
Method Summary
 E get(int arg0In)
          
static DataList getDataList(SelectMode m, java.util.Map params, java.util.Map elabParams)
          Helper method so that one can get a dataresult through the usual way of querying database with a driving query from a datasource select mode.
 java.util.Map getElaboratorParams()
           
 SelectMode getMode()
           
 java.util.Iterator<E> iterator()
          
 java.util.ListIterator<E> listIterator()
          
 java.util.ListIterator<E> listIterator(int arg)
          
 void setElaboratorParams(java.util.Map elaboratorParamsIn)
           
 void setMode(SelectMode modeIn)
           
 java.util.List subList(int start, int end)
          
 java.lang.Object[] toArray()
          
 java.lang.Object[] toArray(java.lang.Object[] arg)
          
 java.lang.String toString()
           Prints meta-data about the list instead of the list itself.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, removeAll, retainAll
 

Constructor Detail

DataList

public DataList(java.util.Collection c)
Collection constructor for special cases. Also used internally.

Parameters:
c - The collection.
Method Detail

getDataList

public static DataList getDataList(SelectMode m,
                                   java.util.Map params,
                                   java.util.Map elabParams)
Helper method so that one can get a dataresult through the usual way of querying database with a driving query from a datasource select mode.

Parameters:
m - Datasource's SelectMode
params - Driving query parameters.
elabParams - Elaborator parameters.
Returns:
A new DataList object containing the results of the driving query.

subList

public java.util.List subList(int start,
                              int end)

Specified by:
subList in interface java.util.List<E>
Overrides:
subList in class java.util.AbstractList<E>

get

public E get(int arg0In)

Specified by:
get in interface java.util.List<E>
Overrides:
get in class java.util.ArrayList<E>

iterator

public java.util.Iterator<E> iterator()

Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.List<E>
Overrides:
iterator in class java.util.AbstractList<E>

listIterator

public java.util.ListIterator<E> listIterator()

Specified by:
listIterator in interface java.util.List<E>
Overrides:
listIterator in class java.util.AbstractList<E>

listIterator

public java.util.ListIterator<E> listIterator(int arg)

Specified by:
listIterator in interface java.util.List<E>
Overrides:
listIterator in class java.util.AbstractList<E>

toArray

public java.lang.Object[] toArray()

Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.List<E>
Overrides:
toArray in class java.util.ArrayList<E>

toArray

public java.lang.Object[] toArray(java.lang.Object[] arg)

Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.List<E>
Overrides:
toArray in class java.util.ArrayList<E>

getElaboratorParams

public java.util.Map getElaboratorParams()
Returns:
Returns the elaboratorParams.

setElaboratorParams

public void setElaboratorParams(java.util.Map elaboratorParamsIn)
Parameters:
elaboratorParamsIn - The elaboratorParams to set.

getMode

public SelectMode getMode()
Returns:
Returns the mode.

setMode

public void setMode(SelectMode modeIn)
Parameters:
modeIn - The mode to set.

toString

public java.lang.String toString()
Prints meta-data about the list instead of the list itself. Prevents a database call to elaborate by not accessing the data of the list.

Overrides:
toString in class java.util.AbstractCollection<E>