org.acegisecurity.domain.service
Class ImmutableManagerImpl<E extends PersistableEntity>

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.acegisecurity.domain.service.ImmutableManagerImpl<E>
All Implemented Interfaces:
ImmutableManager<E>, InitializingBean, ApplicationContextAware

public class ImmutableManagerImpl<E extends PersistableEntity>
extends ApplicationObjectSupport
implements ImmutableManager<E>, InitializingBean

Base ImmutableManager implementation.

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

Field Summary
protected  Dao<E> dao
           
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
ImmutableManagerImpl()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void doInitManager()
          Provides hook for custom subclasses to provide initialization behaviour
 List<E> findAll()
          Return all persistent instances, including subclasses.
 List<E> findId(Collection<Serializable> ids)
          Find a List of PersistableEntitys, searched by their identifiers.
 Dao<E> getDao()
           
protected  String getDefaultSortOrder()
           
 Class getSupportsClass()
           
 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).
 void setBeanName(String beanName)
           
 void setDao(Dao<E> dao)
           
 void setSupportsClass(Class supportClass)
           
 boolean supports(Class clazz)
          Indicates whether the DAO instance provides persistence services for the specified class.
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dao

protected Dao<E extends PersistableEntity> dao
Constructor Detail

ImmutableManagerImpl

public ImmutableManagerImpl()
Method Detail

setSupportsClass

public void setSupportsClass(Class supportClass)

getSupportsClass

public Class getSupportsClass()

getDao

public Dao<E> getDao()

setDao

public void setDao(Dao<E> dao)

getDefaultSortOrder

protected String getDefaultSortOrder()
Returns:
the sort order column to be used by default by the scroll methods

doInitManager

protected void doInitManager()
                      throws Exception
Provides hook for custom subclasses to provide initialization behaviour

Throws:
Exception

afterPropertiesSet

public final void afterPropertiesSet()
                              throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

findAll

public List<E> findAll()
Description copied from interface: ImmutableManager
Return all persistent instances, including subclasses.

Specified by:
findAll in interface ImmutableManager<E extends PersistableEntity>
Returns:
all persistence instances (an empty List will be returned if no matches are found)

findId

public List<E> findId(Collection<Serializable> ids)
Description copied from interface: ImmutableManager
Find a List of PersistableEntitys, searched by their identifiers.

Specified by:
findId in interface ImmutableManager<E extends PersistableEntity>
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

public E readId(Serializable id)
Description copied from interface: ImmutableManager
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.

Specified by:
readId in interface ImmutableManager<E extends PersistableEntity>
Parameters:
id - the identifier of the persistent instance desired to be retrieved
Returns:
the request item, or null if not found

readPopulatedId

public E readPopulatedId(Serializable id)
Description copied from interface: ImmutableManager
Loads a persistent instance by its identifier, along with any lazy loaded properties associated with that instance.

Specified by:
readPopulatedId in interface ImmutableManager<E extends PersistableEntity>
Parameters:
id - the identifier of the persistent instance desired to be retrieved
Returns:
the request item, or null if not found

scroll

public PaginatedList<E> scroll(E value,
                               int firstElement,
                               int maxElements)
Description copied from interface: ImmutableManager
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.

Specified by:
scroll in interface ImmutableManager<E extends PersistableEntity>
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

public PaginatedList<E> scrollPopulated(E value,
                                        int firstElement,
                                        int maxElements)
Description copied from interface: ImmutableManager
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.

Specified by:
scrollPopulated in interface ImmutableManager<E extends PersistableEntity>
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

public PaginatedList<E> scrollWithSubclasses(E value,
                                             int firstElement,
                                             int maxElements)
Description copied from interface: ImmutableManager
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).

Specified by:
scrollWithSubclasses in interface ImmutableManager<E extends PersistableEntity>
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

public PaginatedList<E> scrollPopulatedWithSubclasses(E value,
                                                      int firstElement,
                                                      int maxElements)
Description copied from interface: ImmutableManager
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.

Specified by:
scrollPopulatedWithSubclasses in interface ImmutableManager<E extends PersistableEntity>
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

public boolean supports(Class clazz)
Description copied from interface: ImmutableManager
Indicates whether the DAO instance provides persistence services for the specified class.

Specified by:
supports in interface ImmutableManager<E extends PersistableEntity>
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

setBeanName

public void setBeanName(String beanName)


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