org.acegisecurity.domain.dao
Class PaginatedList<E extends PersistableEntity>

java.lang.Object
  extended by org.acegisecurity.domain.dao.PaginatedList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>

public class PaginatedList<E extends PersistableEntity>
extends Object
implements List<E>

JDK1.5 compatible paginated List.

Elements in the internal List (see getList() represent only part of a larger resultset.

Note that firstElement starts at zero. Any attempt to access other than the current page will cause an error.

This is a read only implementation and many of the List methods are not implemented.

Version:
$Id: PaginatedList.java,v 1.4 2005/11/17 00:55:47 benalex Exp $
Author:
Carlos Sanchez, Ben Alex

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
PaginatedList()
           
PaginatedList(E entity)
          Used to construct a PaginatedList which contains only the given entity.
PaginatedList(List<E> list, int firstElement, int maxElements, int size)
           
 
Method Summary
 boolean add(E arg0)
          Unsupported operation
 void add(int arg0, E arg1)
          Unsupported operation
 boolean addAll(Collection<? extends E> arg0)
          Unsupported operation
 boolean addAll(int arg0, Collection<? extends E> arg1)
          Unsupported operation
 void clear()
          Unsupported operation
 boolean contains(Object arg0)
          Unsupported operation
 boolean containsAll(Collection<?> arg0)
          Unsupported operation
 E get(int arg0)
          Unsupported operation
 int getFirstElement()
          First element of this page, starting at zero.
 int getLastPageNumber()
          Calculate the last page number, starting at 0
 List<E> getList()
          Get list with the elements of this page.
 int getMaxElements()
          Max number of elements in the page
 int getPageNumber()
          Calculate the page number, starting at 0
 int getPageSize()
          Number of elements in this page
 int indexOf(Object arg0)
          Unsupported operation
 boolean isEmpty()
          Unsupported operation
 Iterator<E> iterator()
           
 int lastIndexOf(Object arg0)
          Unsupported operation
 ListIterator<E> listIterator()
          Unsupported operation
 ListIterator<E> listIterator(int arg0)
          Unsupported operation
 E remove(int arg0)
          Unsupported operation
 boolean remove(Object arg0)
          Unsupported operation
 boolean removeAll(Collection arg0)
          Unsupported operation
 boolean retainAll(Collection<?> arg0)
          Unsupported operation
 E set(int arg0, E arg1)
          Unsupported operation
 void setFirstElement(int firstElement)
           
 void setList(List<E> list)
           
 void setMaxElements(int maxElements)
           
 void setSize(int size)
          Set the number of elements in all the pages
 int size()
          Number of elements in all the pages
 List<E> subList(int arg0, int arg1)
          Unsupported operation
 Object[] toArray()
           
<T> T[]
toArray(T[] arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Field Detail

logger

protected final transient org.apache.commons.logging.Log logger
Constructor Detail

PaginatedList

public PaginatedList()

PaginatedList

public PaginatedList(E entity)
Used to construct a PaginatedList which contains only the given entity.

Parameters:
entity - the entity to include (can be null, which indicates an empty PaginatedList should be created)

PaginatedList

public PaginatedList(List<E> list,
                     int firstElement,
                     int maxElements,
                     int size)
Method Detail

isEmpty

public boolean isEmpty()
Unsupported operation

Specified by:
isEmpty in interface Collection<E extends PersistableEntity>
Specified by:
isEmpty in interface List<E extends PersistableEntity>
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.isEmpty()

setFirstElement

public void setFirstElement(int firstElement)

getFirstElement

public int getFirstElement()
First element of this page, starting at zero.

Returns:

getLastPageNumber

public int getLastPageNumber()
Calculate the last page number, starting at 0

Returns:

setList

public void setList(List<E> list)

getList

public List<E> getList()
Get list with the elements of this page.

Returns:
this page of the results

setMaxElements

public void setMaxElements(int maxElements)

getMaxElements

public int getMaxElements()
Max number of elements in the page

Returns:

getPageNumber

public int getPageNumber()
Calculate the page number, starting at 0

Returns:

getPageSize

public int getPageSize()
Number of elements in this page

Returns:

setSize

public void setSize(int size)
Set the number of elements in all the pages

Parameters:
size - DOCUMENT ME!

add

public void add(int arg0,
                E arg1)
Unsupported operation

Specified by:
add in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
arg1 - DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.add(int, java.lang.Object)

add

public boolean add(E arg0)
Unsupported operation

Specified by:
add in interface Collection<E extends PersistableEntity>
Specified by:
add in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.add(java.lang.Object)

addAll

public boolean addAll(Collection<? extends E> arg0)
Unsupported operation

Specified by:
addAll in interface Collection<E extends PersistableEntity>
Specified by:
addAll in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.addAll(java.util.Collection)

addAll

public boolean addAll(int arg0,
                      Collection<? extends E> arg1)
Unsupported operation

Specified by:
addAll in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
arg1 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.addAll(int, java.util.Collection)

clear

public void clear()
Unsupported operation

Specified by:
clear in interface Collection<E extends PersistableEntity>
Specified by:
clear in interface List<E extends PersistableEntity>
Throws:
UnsupportedOperationException
See Also:
Collection.clear()

contains

public boolean contains(Object arg0)
Unsupported operation

Specified by:
contains in interface Collection<E extends PersistableEntity>
Specified by:
contains in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.contains(java.lang.Object)

containsAll

public boolean containsAll(Collection<?> arg0)
Unsupported operation

Specified by:
containsAll in interface Collection<E extends PersistableEntity>
Specified by:
containsAll in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.containsAll(java.util.Collection)

get

public E get(int arg0)
Unsupported operation

Specified by:
get in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
See Also:
List.get(int)

indexOf

public int indexOf(Object arg0)
Unsupported operation

Specified by:
indexOf in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.indexOf(java.lang.Object)

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E extends PersistableEntity>
Specified by:
iterator in interface Collection<E extends PersistableEntity>
Specified by:
iterator in interface List<E extends PersistableEntity>

lastIndexOf

public int lastIndexOf(Object arg0)
Unsupported operation

Specified by:
lastIndexOf in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.lastIndexOf(java.lang.Object)

listIterator

public ListIterator<E> listIterator()
Unsupported operation

Specified by:
listIterator in interface List<E extends PersistableEntity>
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.listIterator()

listIterator

public ListIterator<E> listIterator(int arg0)
Unsupported operation

Specified by:
listIterator in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.listIterator(int)

remove

public E remove(int arg0)
Unsupported operation

Specified by:
remove in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.remove(int)

remove

public boolean remove(Object arg0)
Unsupported operation

Specified by:
remove in interface Collection<E extends PersistableEntity>
Specified by:
remove in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(Collection arg0)
Unsupported operation

Specified by:
removeAll in interface Collection<E extends PersistableEntity>
Specified by:
removeAll in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.removeAll(java.util.Collection)

retainAll

public boolean retainAll(Collection<?> arg0)
Unsupported operation

Specified by:
retainAll in interface Collection<E extends PersistableEntity>
Specified by:
retainAll in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
Collection.retainAll(java.util.Collection)

set

public E set(int arg0,
             E arg1)
Unsupported operation

Specified by:
set in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
arg1 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.set(int, java.lang.Object)

size

public int size()
Number of elements in all the pages

Specified by:
size in interface Collection<E extends PersistableEntity>
Specified by:
size in interface List<E extends PersistableEntity>
See Also:
Collection.size()

subList

public List<E> subList(int arg0,
                       int arg1)
Unsupported operation

Specified by:
subList in interface List<E extends PersistableEntity>
Parameters:
arg0 - DOCUMENT ME!
arg1 - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException
See Also:
List.subList(int, int)

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E extends PersistableEntity>
Specified by:
toArray in interface List<E extends PersistableEntity>

toArray

public <T> T[] toArray(T[] arg0)
Specified by:
toArray in interface Collection<E extends PersistableEntity>
Specified by:
toArray in interface List<E extends PersistableEntity>


Copyright © 2004-2005 Acegi Technology Pty Limited. All Rights Reserved.