Many instances require searching for users and retrieving attributes from multiple sources and merging those results. There are two options for using multiple attribute sources. MergingPersonAttributeDaoImpl allows multiple child IPersonAttributeDao implementations to be queried and merges their results into a single result set. CascadingPersonAttributeDao is similar but it folds the results of previous IPersonAttributeDaos into the query for the next IPersonAttributeDao in the list. Cascading is useful if an attribute from system A is needed to retrieve attributes from system B.
MergingPersonAttributeDaoImpl
Designed to query multiple IPersonAttributeDaos in order and merge the results into a single result set.
Setting up a MergingPersonAttributeDaoImpl in Spring to would look like the following:
<bean id="mergingPersonAttributeDao" class="org.jasig.services.persondir.support.MergingPersonAttributeDaoImpl"> <property name="personAttributeDaos"> <list> <ref bean="jdbcPersonAttributeDao" /> <ref bean="studentLdapPersonAttributeDao" /> <ref bean="facStaffLdapPersonAttributeDao" /> </list> </property> </bean>
This configuration will query three IPersonAttributeDaos in order and merge their results using the default IAttributeMerger which is the MultivaluedAttributeMerger.
Configuration
MergingPersonAttributeDaoImpl has an anonymous constructor.
Property |
Type |
Default Value |
|
---|---|---|---|
defaultAttribute |
String |
username |
The attribute name to use for calls to IPerson getPerson(String). A query Map is generated for these calls using the defaultAttribute and the value passed in. |
personAttributeDaos |
List<IPersonAttributeDao> |
null |
A List of IPersonAttributeDaos to be queried and have their results merged. |
attrMerger |
IAttributeMerger |
new MultivaluedAttributeMerger() |
The result set merging strategy to be used. See the Merging Strategies section for more information on available options. |
recoverExceptions |
boolean |
true |
If an exception thrown by a child IPersonAttributeDao |