org.acegisecurity.domain.service
Interface ImmutableManager<E extends PersistableEntity>

All Known Implementing Classes:
ImmutableManagerImpl

public interface ImmutableManager<E extends PersistableEntity>

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

This interface provides a remoting protocol compliant approach to accessing services layer logic for a given application. A generics-based services layer interface decreases development time because the basic CRUD and finder operations can be specified in a typesafe fashion that reuses superclass code.

It is not envisioned that this interface will provide all services layer functions. The significant value of a services layer is the value-add beyond simply fronting the DAO or applying validation/binding logic that is better situated in the domain object or its validator. The type of value-adds expected to be provided by a services layer include incrementing business identifiers (eg an invoice number); generating messages for logging/audit purposes (thus such messages are at a business transaction level of granularity, instead of DAO/persistence granularity where the overall context of the the message becomes unclear); updating related domain objects via their respective services layer beans (eg an invoice services layer bean would call the general journal services layer bean to create the accrual accounting entries); making changes to a domain object that requires logic that is unsuitable to put into a validator because it extends beyond a single domain object instance or requires access to other persistent entities (eg computing taxation appliable to an invoice based on a break-down of each item on the order, its delivery destination, and the customer); producing messages (eg notify another system the invoice was created or email the customer via SMTP); provide a layer to locate transaction and security configuration; expose a reasonably protocol-independent interface to the application that can be used by a variety of web services and client types; ensure any returned objects are eagerly loaded to a well-defined interface contract etc.

A single ImmutableManager implementation will typically exist for each PersistableEntity, particularly given a PersistableEntity is allowed to manage multiple PersistableValues. The particular PersistableEntity an implementation supports will be expressed by the supports(Class) method.

No other part of the Domain subproject relies on this interface. If you would prefer to write your own services layer interfaces from scratch, this is not a problem at all.

Version:
$Id: ImmutableManager.java,v 1.2 2005/11/17 00:55:51 benalex Exp $
Author:
Ben Alex

Method Summary
 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)
          Find persistent instances with properties matching those of the passed PersistableEntity.
 PaginatedList<E> scrollPopulated(E value, int firstElement, int maxElements)
          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)
          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)
          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.
 

Method Detail

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)
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
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)
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
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)
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
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)
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
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


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