com.redhat.rhn.common.db.datasource
Class DataResult<T>

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

public class DataResult<T>
extends java.util.ArrayList<T>
implements java.util.List<T>

The results of operations on the DataSource layer.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
  DataResult(java.util.Collection l)
          Create a DataResult with a simple Collection and null the Mode.
protected DataResult(java.util.Collection l, Mode m)
          Create a new DataResult object
protected DataResult(DataResult dr)
          Create a new DataResult object
protected DataResult(Mode m)
          Create a new DataResult object
 
Method Summary
 void elaborate()
          Elaborate the current DataResult with more values, using ID as the key.
 void elaborate(java.util.Map values)
          Elaborate the current DataResult with more values, using ID as the key.
 java.util.Map getElaborationParams()
          Return the parameters that were passed into the last call to elaborate()
 Elaborator getElaborator()
           
 int getEnd()
          Get the index of the list element in the list
 java.lang.String getFilterData()
          Get the data used to filter this list.
 CharacterMap getIndex()
          Get the index
 SelectMode getMode()
          Get the mode associated with this DataResult.
 int getStart()
          Get the index of the first element in the list
 int getTotalSize()
          Get the total number of entries in this list
 boolean hasFilter()
          Has this data been filtered
 void setElaborationParams(java.util.Map values)
          Set the parameters that will be used to elaborate the query Note that we make this public because we can't guarantee that elaborate(Map) will be called from the outside in every case where we need them.
 void setEnd(int endIn)
          Set the End value.
 void setFilter(boolean isFilter)
          Set if we this data has been filtered
 void setFilterData(java.lang.String fData)
          Set the data used to filter this list.
 void setIndex(CharacterMap i)
          Set the index
 void setStart(int startIn)
          Provide a start value.
 void setTotalSize(int ts)
          Set the total number of entries in this list
 DataResult<T> slice(int fromIndex, int toIndex)
          Performs the function as subList() except it returns a DataResult object.
 DataResult<T> subList(int fromIndex, int toIndex)
          
 java.lang.String toString()
          
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator
 
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
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray
 

Constructor Detail

DataResult

protected DataResult(DataResult dr)
Create a new DataResult object

Parameters:
dr - The Mode that created this DataResult

DataResult

protected DataResult(Mode m)
Create a new DataResult object

Parameters:
m - The Mode that created this DataResult

DataResult

protected DataResult(java.util.Collection l,
                     Mode m)
Create a new DataResult object

Parameters:
l - The list to add
m - The Mode that created this DataResult

DataResult

public DataResult(java.util.Collection l)
Create a DataResult with a simple Collection and null the Mode. Useful for creating DataResults of short lists Hibernate Objects

Parameters:
l - Collection of Objects you want in the Result
Method Detail

getMode

public SelectMode getMode()
Get the mode associated with this DataResult.

Returns:
Mode used by this DataResult.

subList

public DataResult<T> subList(int fromIndex,
                             int toIndex)

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

slice

public DataResult<T> slice(int fromIndex,
                           int toIndex)
Performs the function as subList() except it returns a DataResult object. This should be refactored at some point

Parameters:
fromIndex - start
toIndex - end
Returns:
new DataResult containing the requested "sublist"

elaborate

public void elaborate(java.util.Map values)
Elaborate the current DataResult with more values, using ID as the key. This will execute all elaborators.

Parameters:
values - The values to bind to the BindParameters

elaborate

public void elaborate()
Elaborate the current DataResult with more values, using ID as the key. This will execute all elaborators.


getElaborator

public Elaborator getElaborator()
Returns:
An elaborator object that could be used for elaboration later in cycle.

getElaborationParams

public java.util.Map getElaborationParams()
Return the parameters that were passed into the last call to elaborate()

Returns:
Map of elaboration values

setElaborationParams

public void setElaborationParams(java.util.Map values)
Set the parameters that will be used to elaborate the query Note that we make this public because we can't guarantee that elaborate(Map) will be called from the outside in every case where we need them.

Parameters:
values - name/value pairs used to elaborate the query

getTotalSize

public int getTotalSize()
Get the total number of entries in this list

Returns:
Returns the totalSize.

setTotalSize

public void setTotalSize(int ts)
Set the total number of entries in this list

Parameters:
ts - The totalSize to set.

getStart

public int getStart()
Get the index of the first element in the list

Returns:
the index of the first element of the list

setStart

public void setStart(int startIn)
Provide a start value.

Parameters:
startIn - we want to set.

getEnd

public int getEnd()
Get the index of the list element in the list

Returns:
the index of the last element of the list

setEnd

public void setEnd(int endIn)
Set the End value.

Parameters:
endIn - that we want to set.

getIndex

public CharacterMap getIndex()
Get the index

Returns:
A CharacterMap containing the index for the list

setIndex

public void setIndex(CharacterMap i)
Set the index

Parameters:
i - The new value for index

hasFilter

public boolean hasFilter()
Has this data been filtered

Returns:
True if the data is be filtered

setFilter

public void setFilter(boolean isFilter)
Set if we this data has been filtered

Parameters:
isFilter - Has this been filtered

getFilterData

public java.lang.String getFilterData()
Get the data used to filter this list.

Returns:
The data used to filter this list

setFilterData

public void setFilterData(java.lang.String fData)
Set the data used to filter this list.

Parameters:
fData - The data used to filter this list.

toString

public java.lang.String toString()

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