org.jasig.services.persondir.support
Class AbstractQueryPersonAttributeDao

java.lang.Object
  extended by org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
      extended by org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
All Implemented Interfaces:
IPersonAttributeDao
Direct Known Subclasses:
AbstractJdbcPersonAttributeDao, LdapPersonAttributeDao

public abstract class AbstractQueryPersonAttributeDao
extends AbstractDefaultAttributePersonAttributeDao

Provides common functionality for DAOs using a set of attribute values from the seed to perform a query. Ensures the nessesary attributes to run the query exist on the seed and organizes the values into an argument array.

Configuration:

Property Description Required Default
queryAttributes A List of String attribute names whos values should be used when executing the query via getUserAttributesIfNeeded(Object[]). If this List is set all of the names it contains must be in the keySet of the seed passed to getUserAttributes(Map) or null will be returned. If the List is left null the AbstractDefaultAttributePersonAttributeDao.getDefaultAttributeName() will be used as the single argument when calling getUserAttributesIfNeeded(Object[]) No null

Version:
$Revision: 2892 $
Author:
Eric Dalquist eric.dalquist@doit.wisc.edu

Field Summary
 
Fields inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
logger
 
Constructor Summary
AbstractQueryPersonAttributeDao()
           
 
Method Summary
 List getQueryAttributes()
           
 Map getUserAttributes(Map seed)
          Checks the seed for being null, throws IllegalArgumentException if it is.
Ensures the seed contains the attributes needed to run the query, returns null if they aren't available.
Compiles the Object[] of arguments from the seed based on the queryAttributes.
protected abstract  Map getUserAttributesIfNeeded(Object[] args)
          Is called by getUserAttributes(Map) if the attributes required for the query, as defined by the values of the queryAttributes property, are available in the seed.
 void setQueryAttributes(List queryAttributes)
           
 
Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
getDefaultAttributeName, getUserAttributes, setDefaultAttributeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jasig.services.persondir.IPersonAttributeDao
getPossibleUserAttributeNames
 

Constructor Detail

AbstractQueryPersonAttributeDao

public AbstractQueryPersonAttributeDao()
Method Detail

getUserAttributes

public final Map getUserAttributes(Map seed)
Checks the seed for being null, throws IllegalArgumentException if it is.
Ensures the seed contains the attributes needed to run the query, returns null if they aren't available.
Compiles the Object[] of arguments from the seed based on the queryAttributes.

Parameters:
seed - immutable Map of attributes to values to seed the query
Returns:
Map from attribute names to values
See Also:
org.jasig.portal.services.persondir.IPersonAttributeDao#getUserAttributes(java.util.Map)

getUserAttributesIfNeeded

protected abstract Map getUserAttributesIfNeeded(Object[] args)
Is called by getUserAttributes(Map) if the attributes required for the query, as defined by the values of the queryAttributes property, are available in the seed. The implementation of getUserAttributes(Map) also compiles the array of query argument values based on the order of items in the queryAttributes property and the values in the seed.

Parameters:
args - The arguments to execute the query with.
Returns:
The results of the query, as specified by org.jasig.portal.services.persondir.IPersonAttributeDao#getUserAttributes(Map)

getQueryAttributes

public List getQueryAttributes()
Returns:
Returns the queryAttributes.

setQueryAttributes

public void setQueryAttributes(List queryAttributes)
Parameters:
queryAttributes - The queryAttributes to set.


Copyright © 1998-2007 Java Architectures Special Interest Group. All Rights Reserved.