org.jasig.services.persondir.support
Class AbstractQueryPersonAttributeDao

java.lang.Object
  extended by org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
      extended by org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
          extended by org.jasig.services.persondir.support.AbstractQueryPersonAttributeDao
All Implemented Interfaces:
org.jasig.services.persondir.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 AbstractFlatteningPersonAttributeDao.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[]) Yes null

Version:
$Revision: 43243 $
Author:
Eric Dalquist

Field Summary
 
Fields inherited from class org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
logger
 
Constructor Summary
AbstractQueryPersonAttributeDao()
           
 
Method Summary
 Map<String,List<Object>> getMultivaluedUserAttributes(Map<String,List<Object>> 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  Object[] getQueryArgumentArray(List<List<Object>> args)
          Converts the List of List of value type to an Object[].
 List<String> getQueryAttributes()
           
protected  Map<String,List<Object>> getUserAttributesIfNeeded(List<List<Object>> args)
          Collates the first argument in each sub-list into an Object[] to pass to getUserAttributesIfNeeded(Object[])
protected  Map<String,List<Object>> getUserAttributesIfNeeded(Object[] args)
          Is called by AbstractFlatteningPersonAttributeDao.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<String> queryAttributes)
           
 
Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
getDefaultAttributeName, getMultivaluedUserAttributes, setDefaultAttributeName
 
Methods inherited from class org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
flattenResults, getUserAttributes, getUserAttributes
 
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

getMultivaluedUserAttributes

public final Map<String,List<Object>> getMultivaluedUserAttributes(Map<String,List<Object>> 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.

See Also:
IPersonAttributeDao.getMultivaluedUserAttributes(java.util.Map)

getUserAttributesIfNeeded

protected Map<String,List<Object>> getUserAttributesIfNeeded(List<List<Object>> args)
Collates the first argument in each sub-list into an Object[] to pass to getUserAttributesIfNeeded(Object[])

See Also:
getUserAttributesIfNeeded(Object[])

getUserAttributesIfNeeded

protected Map<String,List<Object>> getUserAttributesIfNeeded(Object[] args)
Is called by AbstractFlatteningPersonAttributeDao.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 AbstractFlatteningPersonAttributeDao.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 IPersonAttributeDao.getUserAttributes(Map)

getQueryArgumentArray

protected Object[] getQueryArgumentArray(List<List<Object>> args)
Converts the List of List of value type to an Object[]. This implementation uses the first value of each sub-list as the value for the returned object array.

Parameters:
args - the List of List of values to generate an object array from.
Returns:
An array of arguments based on the lists

getQueryAttributes

public final List<String> getQueryAttributes()
Returns:
Returns the queryAttributes.

setQueryAttributes

public final void setQueryAttributes(List<String> queryAttributes)
Parameters:
queryAttributes - The queryAttributes to set.


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