MergingPersonAttributeDaoImpl

An IPersonAttributeDao implementation which iterates over a List of child IPersonAttributeDaos and merges their reported attributes in a configurable way.

Unlike CascadingPersonAttributeDao, MergingPersonAttributeDao invokes each child with the same seed, the seed with which the MergingPersonAttributeDao itself was invoked.

Advanced configuration

Here's an example of configuring a MergingPersonAttributeDaoImpl to apply an alternative merge strategy and to propogate any exceptions thrown by the DAOs it is merging.

<beans>
    <bean id="personAttributeDao" 
        class="org.jasig.portal.services.persondir.support.MergingPersonAttributeDaoImpl">
        <property name="personAttributeDaos">
            <list>
                <bean 
                    class="org.jasig.portal.services.persondir.support.JdbcPersonAttributeDaoImpl">
                    <constructor-arg>
                       <bean
                         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		         <property name="driverClassName"><value>${jdbc.driverClassName}</value></property>
		         <property name="url"><value>${jdbc.url}</value></property>
		         <property name="username"><value>${jdbc.username}</value></property>
		         <property name="password"><value>${jdbc.password}</value></property>
	               </bean>
                    </constructor-arg>
                    <constructor-arg>
                        <value>SELECT name, shirt_color FROM 
                            someschema.sometable WHERE uid = ?</value>
                    </constructor-arg>
                    <property name="columnsToAttributes">
                        <map>
                            <entry key="name">
                                <value>name</value>
                            </entry>
                            <entry key="shirt_color">
                                <value>shirtColor</value>
                            </entry>
                        </map>
                    </property>
                </bean>
                <bean 
                    class="org.jasig.portal.services.persondir.support.LdapPersonAttributeDaoImpl">
                    <property name="ldapAttributesToPortalAttributes">
                        <map>
                            <entry key="name">
                                <value>name</value>
                            </entry>
                            <entry key="shirt_color">
                                <value>shirtColor</value>
                            </entry>
                        </map>
                    </property>
                    <property name="ldapServer">
                        <bean 
                            class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
                            <property name="staticMethod">
                                <value>
                                    org.jasig.portal.ldap.LdapServices.getLdapServer</value>
                            </property>
                            <property name="arguments">
                                <list>
                                    <value>personLdap</value>
                                </list>
                            </property>
                        </bean>
                    </property>
                    <property name="uidQuery">
                        <value>(cn={0})</value>
                    </property>
                </bean>
            </list>
        </property>
        <property name="recoverExceptions">
            <value>false</value>
        </property>
        <property name="merger">
            <bean class="org.jasig.portal.services.persondir.support.merger.NoncollidingAttributeAdder"/>
        </property>
    </bean>
</beans>