org.acegisecurity.domain.dao
Interface Dao<E extends PersistableEntity>

All Known Implementing Classes:
DaoHibernate

public interface Dao<E extends PersistableEntity>

Provides fundamental DAO capabilities for a single concrete PersistableEntity, using JDK 1.5 generics.

This interface provides a portable approach to Data Access Object (DAO) functionality across various object relational persistance solutions.

It is not envisioned that this interface will provide all data access requirements for applications, however it should provide all of the standard create, read, update, delete (CRUD) and finder functions that are routinely needed. Specialized subclasses (that provide finer-grained functionality) of the Dao interface are encouraged.

A Dao implementation (or a subclass of Dao) should be the sole entry point into the persistance layer of an application. The persistence layer should only respond to requests from the services layer. The services layer is where all transaction demarcation, security authorization, casting to and from concrete PersistableEntitys, workflow and business logic should take place.

Each Dao implementation will support one PersistableEntity classes only. The supported PersistableEntity class must be indicated via the supports(Class) method.

Version:
$Id: Dao.java,v 1.7 2005/11/17 00:55:47 benalex Exp $
Author:
Ben Alex

Method Summary
 E create(E value)
          Create a new object, with the current PersistableEntity.getInternalId() value being ignored.
 void delete(E value)
          Delete an object.
 List<E> findAll()
          Return all persistent instances, including subclasses.
 List<E> findId(Collection<Serializable> ids)
          Find a List of PersistableEntitys, searched by their identifiers.
 E readId(Serializable id)
          Load a persistent instance by its identifier, although some properties may be lazy loaded depending on the underlying DAO implementation and/or persistence engine mapping document.
 E readPopulatedId(Serializable id)
          Loads a persistent instance by its identifier, along with any lazy loaded properties associated with that instance.
 PaginatedList<E> scroll(E value, int firstElement, int maxElements, String orderByAsc)
          Find persistent instances with properties matching those of the passed PersistableEntity.
 PaginatedList<E> scrollPopulated(E value, int firstElement, int maxElements, String orderByAsc)
          Find persistent instances with properties matching those of the passed PersistableEntity, with a guarantee the returned results will have each of the value class' immediate properties initialized.
 PaginatedList<E> scrollPopulatedWithSubclasses(E value, int firstElement, int maxElements, String orderByAsc)
          Find persistent instances with properties matching those of the passed PersistableEntity, ignoring the class of the passed PersistableEntity (useful if you pass a superclass, as you want to find all subclass instances which match).
 PaginatedList<E> scrollWithSubclasses(E value, int firstElement, int maxElements, String orderByAsc)
          Find persistent instances with properties matching those of the passed PersistableEntity, ignoring the class of the passed PersistableEntity (useful if you pass a superclass, as you want to find all subclass instances which match).
 boolean supports(Class clazz)
          Indicates whether the DAO instance provides persistence services for the specified class.
 E update(E value)
          Update an object.
 

Method Detail

create

E create(E value)
Create a new object, with the current PersistableEntity.getInternalId() value being ignored.

Parameters:
value - (without the identity property initialized)
Returns:
the value created (with the identity property initialised)

delete

void delete(E value)
Delete an object.

Parameters:
value - the value to delete

findAll

List<E> findAll()
Return all persistent instances, including subclasses.

Returns:
all persistence instances (an empty List will be returned if no matches are found)

findId

List<E> findId(Collection<Serializable> ids)
Find a List of PersistableEntitys, searched by their identifiers.

Parameters:
ids - collection of identifiers to locate
Returns:
the values with those identifiers (an empty List will be returned if no matches are found)

readId

E readId(Serializable id)
Load a persistent instance by its identifier, although some properties may be lazy loaded depending on the underlying DAO implementation and/or persistence engine mapping document.

Parameters:
id - the identifier of the persistent instance desired to be retrieved
Returns:
the request item, or null if not found

readPopulatedId

E readPopulatedId(Serializable id)
Loads a persistent instance by its identifier, along with any lazy loaded properties associated with that instance.

Parameters:
id - the identifier of the persistent instance desired to be retrieved
Returns:
the request item, or null if not found

scroll

PaginatedList<E> scroll(E value,
                        int firstElement,
                        int maxElements,
                        String orderByAsc)
Find persistent instances with properties matching those of the passed PersistableEntity.

Persistent instances are matched on the basis of query by example. Properties whose value is null, empty Strings, and any Collections are ignored in the query by example evaluation.

Parameters:
value - parameters to filter on (the class of this object will be added to the filter)
firstElement - the first result (start at zero to obtain all results)
maxElements - the maximum number of results desired for this page of the result set
orderByAsc - the property name of the PersistableEntity that should be used to order the results
Returns:
the requested page of the result list (a properly formed PaginatedList is returned if no results match)

scrollPopulated

PaginatedList<E> scrollPopulated(E value,
                                 int firstElement,
                                 int maxElements,
                                 String orderByAsc)
Find persistent instances with properties matching those of the passed PersistableEntity, with a guarantee the returned results will have each of the value class' immediate properties initialized.

Persistent instances are matched on the basis of query by example. Properties whose value is null, empty Strings, and any Collections are ignored in the query by example evaluation.

Parameters:
value - parameters to filter on (the class of this object will be added to the filter)
firstElement - the first result (start at zero to obtain all results)
maxElements - the maximum number of results desired for this page of the result set
orderByAsc - the property name of the PersistableEntity that should be used to order the results
Returns:
the requested page of the result list (a properly formed PaginatedList is returned if no results match)

scrollWithSubclasses

PaginatedList<E> scrollWithSubclasses(E value,
                                      int firstElement,
                                      int maxElements,
                                      String orderByAsc)
Find persistent instances with properties matching those of the passed PersistableEntity, ignoring the class of the passed PersistableEntity (useful if you pass a superclass, as you want to find all subclass instances which match).

Parameters:
value - parameters to filter on (the class of this object will NOT be added to the filter)
firstElement - the first result (start at zero to obtain all results)
maxElements - the maximum number of results desired for this page of the result set
orderByAsc - the property name of the PersistableEntity that should be used to order the results
Returns:
the requested page of the result list (a properly formed PaginatedList is returned if no results match)

scrollPopulatedWithSubclasses

PaginatedList<E> scrollPopulatedWithSubclasses(E value,
                                               int firstElement,
                                               int maxElements,
                                               String orderByAsc)
Find persistent instances with properties matching those of the passed PersistableEntity, ignoring the class of the passed PersistableEntity (useful if you pass a superclass, as you want to find all subclass instances which match). Guarantees the returned results will have each of the DAO's supports class' immediate properties initialized.

Parameters:
value - parameters to filter on (the class of this object will NOT be added to the filter)
firstElement - the first result (start at zero to obtain all results)
maxElements - the maximum number of results desired for this page of the result set
orderByAsc - the property name of the PersistableEntity that should be used to order the results
Returns:
the requested page of the result list (a properly formed PaginatedList is returned if no results match)

supports

boolean supports(Class clazz)
Indicates whether the DAO instance provides persistence services for the specified class.

Parameters:
clazz - to test, which should be an implementation of PersistableEntity
Returns:
true or false, indicating whether or not the passed class is supported by this DAO instance

update

E update(E value)
Update an object.

Parameters:
value - to update, with the PersistableEntity having a non-null identifier
Returns:
the updated value


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