Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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

Merging Strategies

Both merging daos use the IAttributeMerger to actually put the multiple results together. Person Directory ships with three implementations of this interface.

MultivaluedAttributeMerger

Merging of the Sets of IPersons is additive. For IPersons with the same name the person's attributes are merged into multi-valued lists.

As an example of this for two IPersons with the same name where:

  • IPerson A has attributes {email=eric.dalquist@example.com, phone=123-456-7890}
  • IPerson B has attributes {phone=[111-222-3333, 000-999-8888], office=3233}
  • The resulting merged IPerson would have attributes: {email=eric.dalquist@example.com, phone=[123-456-7890, 111-222-3333, 000-999-8888], office=3233}

NoncollidingAttributeAdder

Merging of the Sets of IPersons is additive. For IPersons with the same name the person's attributes are merged such that only attributes on the second IPerson that don't already exist on the first IPerson are merged in.

As an example of this for two IPersons with the same name where:

  • IPerson A has attributes {email=eric.dalquist@example.com, phone=123-456-7890}
  • IPerson B has attributes {phone=[111-222-3333, 000-999-8888], office=3233}
  • The resulting merged IPerson would have attributes: {email=eric.dalquist@example.com, phone=123-456-7890, office=3233}

ReplacingAttributeAdder

Merging of the Sets of IPersons is additive. For IPersons with the same name the person's attributes are merged such that attributes on the second IPerson replace any attributes with the same name on the first IPerson.

As an example of this for two IPersons with the same name where:

  • IPerson A has attributes {email=eric.dalquist@example.com, phone=123-456-7890}
  • IPerson B has attributes {phone=[111-222-3333, 000-999-8888], office=3233}
  • The resulting merged IPerson would have attributes: {email=eric.dalquist@example.com, phone=[111-222-3333, 000-999-8888], office=3233}
  • No labels