org.jasig.services.persondir.support
Class CascadingPersonAttributeDao

java.lang.Object
  extended by org.jasig.services.persondir.support.BasePersonAttributeDao
      extended by org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
          extended by org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
              extended by org.jasig.services.persondir.support.AbstractAggregatingDefaultQueryPersonAttributeDao
                  extended by org.jasig.services.persondir.support.CascadingPersonAttributeDao
All Implemented Interfaces:
IPersonAttributeDao

public class CascadingPersonAttributeDao
extends AbstractAggregatingDefaultQueryPersonAttributeDao

This IPersonAttributeDao implementation iterates through an ordered List of IPersonAttributeDao impls when getting user attributes.
The first DAO is queried using the seed Map passed to this class. The results of the query are merged into a general result map. After the first DAO this general result map used as the query seed for each DAO and each DAOs results are merged into it.
This behavior allows a DAO lower on the list to rely on attributes returned by a DAO higher on the list.
The default merger for the general result set is ReplacingAttributeAdder.
Note that most DAOs expect a Map of String->String. Some of the DAOs return a Map of String->Object or String->List. This may cause problems in the DAO if the key for an attribute with a non String value matches a key needed by the DAO for the query it is running.
It is highly recomended that the first DAO on the list for this class is the EchoPersonAttributeDaoImpl to ensure the seed gets placed into the general result map.

Since:
uPortal 2.5
Version:
$Revision$ $Date$
Author:
Eric Dalquist

Field Summary
 
Fields inherited from class org.jasig.services.persondir.support.AbstractAggregatingDefaultQueryPersonAttributeDao
attrMerger, personAttributeDaos, recoverExceptions, stopOnSuccess
 
Fields inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao
logger
 
Fields inherited from interface org.jasig.services.persondir.IPersonAttributeDao
WILDCARD, WILDCARD_PATTERN
 
Constructor Summary
CascadingPersonAttributeDao()
           
 
Method Summary
protected  Set<IPersonAttributes> getAttributesFromDao(Map<String,List<Object>> seed, boolean isFirstQuery, IPersonAttributeDao currentlyConsidering, Set<IPersonAttributes> resultPeople)
          If this is the first call or there are no results in the resultPeople Set the seed map is used.
 
Methods inherited from class org.jasig.services.persondir.support.AbstractAggregatingDefaultQueryPersonAttributeDao
getAvailableQueryAttributes, getMerger, getPeopleWithMultivaluedAttributes, getPersonAttributeDaos, getPossibleUserAttributeNames, isRecoverExceptions, isStopOnSuccess, setMerger, setPersonAttributeDaos, setRecoverExceptions, setStopOnSuccess
 
Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
getPerson, getUsernameAttributeProvider, setUsernameAttributeProvider, toSeedMap
 
Methods inherited from class org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
getPeople, toMultivaluedSeed
 
Methods inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao
flattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getUserAttributes, getUserAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CascadingPersonAttributeDao

public CascadingPersonAttributeDao()
Method Detail

getAttributesFromDao

protected Set<IPersonAttributes> getAttributesFromDao(Map<String,List<Object>> seed,
                                                      boolean isFirstQuery,
                                                      IPersonAttributeDao currentlyConsidering,
                                                      Set<IPersonAttributes> resultPeople)
If this is the first call or there are no results in the resultPeople Set the seed map is used. If not the attributes of the first user in the resultPeople Set are used.

Specified by:
getAttributesFromDao in class AbstractAggregatingDefaultQueryPersonAttributeDao
Parameters:
seed - The seed for the original query.
isFirstQuery - If this is the first query, this will stay true until a call to this method returns (does not throw an exception).
currentlyConsidering - The IPersonAttributeDao to execute the query on.
Returns:
The results from the call to the DAO, follows the same rules as IPersonAttributeDao.getUserAttributes(Map).
See Also:
AbstractAggregatingDefaultQueryPersonAttributeDao.getAttributesFromDao(java.util.Map, boolean, org.jasig.services.persondir.IPersonAttributeDao, java.util.Set)


Copyright © 2012 Jasig. All Rights Reserved.