org.jasig.services.persondir.support.merger
Class BaseAdditiveAttributeMerger

java.lang.Object
  extended by org.jasig.services.persondir.support.merger.BaseAdditiveAttributeMerger
All Implemented Interfaces:
IAttributeMerger
Direct Known Subclasses:
MultivaluedAttributeMerger, NoncollidingAttributeAdder, ReplacingAttributeAdder

public abstract class BaseAdditiveAttributeMerger
extends Object
implements IAttributeMerger

Merges the Sets of IPersons additively calling the abstract mergePersonAttributes(Map, Map) method on the attributes of IPersons that exist in both sets. The mergeAvailableQueryAttributes(Set, Set) and mergePossibleUserAttributeNames(Set, Set) methods do a simple addative merge of the sets. These can be overriden by subclasses.

Version:
$Revision$
Author:
Eric Dalquist

Constructor Summary
BaseAdditiveAttributeMerger()
           
 
Method Summary
protected  Map<String,List<Object>> buildMutableAttributeMap(Map<String,List<Object>> attributes)
          Do a deep clone of an attribute Map to ensure it is completley mutable.
protected  Map<String,List<Object>> createMutableAttributeMap(int size)
          Create the Map used when merging attributes
 Map<String,List<Object>> mergeAttributes(Map<String,List<Object>> toModify, Map<String,List<Object>> toConsider)
          Modify the "toModify" argument in consideration of the "toConsider" argument.
 Set<String> mergeAvailableQueryAttributes(Set<String> toModify, Set<String> toConsider)
          Modify the "toModify" argument in consideration of the "toConsider" argument.
protected abstract  Map<String,List<Object>> mergePersonAttributes(Map<String,List<Object>> toModify, Map<String,List<Object>> toConsider)
          Modify the "toModify" argument in consideration of the "toConsider" argument.
 Set<String> mergePossibleUserAttributeNames(Set<String> toModify, Set<String> toConsider)
          Modify the "toModify" argument in consideration of the "toConsider" argument.
 Set<IPersonAttributes> mergeResults(Set<IPersonAttributes> toModify, Set<IPersonAttributes> toConsider)
          Merge the results of a search.IPersonLookupDao call and a compiled results map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseAdditiveAttributeMerger

public BaseAdditiveAttributeMerger()
Method Detail

mergeAvailableQueryAttributes

public Set<String> mergeAvailableQueryAttributes(Set<String> toModify,
                                                 Set<String> toConsider)
Description copied from interface: IAttributeMerger
Modify the "toModify" argument in consideration of the "toConsider" argument. Return the resulting Set which may or may not be the same reference as the "toModify" argument. The modification performed is implementation-specific -- implementations of this interface exist to perform some particular transformation on the toModify argument given the toConsider argument.

Specified by:
mergeAvailableQueryAttributes in interface IAttributeMerger
Parameters:
toModify - Modify this set
toConsider - In consideration of this set
Returns:
The modified set

mergePossibleUserAttributeNames

public Set<String> mergePossibleUserAttributeNames(Set<String> toModify,
                                                   Set<String> toConsider)
Description copied from interface: IAttributeMerger
Modify the "toModify" argument in consideration of the "toConsider" argument. Return the resulting Set which may or may not be the same reference as the "toModify" argument. The modification performed is implementation-specific -- implementations of this interface exist to perform some particular transformation on the toModify argument given the toConsider argument.

Specified by:
mergePossibleUserAttributeNames in interface IAttributeMerger
Parameters:
toModify - Modify this set
toConsider - In consideration of this set
Returns:
The modified set

mergeResults

public final Set<IPersonAttributes> mergeResults(Set<IPersonAttributes> toModify,
                                                 Set<IPersonAttributes> toConsider)
Description copied from interface: IAttributeMerger
Merge the results of a search.IPersonLookupDao call and a compiled results map.

Specified by:
mergeResults in interface IAttributeMerger
Parameters:
toModify - The compiled results map, this will be modified based on the values in toConsider.
toConsider - The query results map, this will not be modified.

buildMutableAttributeMap

protected Map<String,List<Object>> buildMutableAttributeMap(Map<String,List<Object>> attributes)
Do a deep clone of an attribute Map to ensure it is completley mutable.


createMutableAttributeMap

protected Map<String,List<Object>> createMutableAttributeMap(int size)
Create the Map used when merging attributes


mergePersonAttributes

protected abstract Map<String,List<Object>> mergePersonAttributes(Map<String,List<Object>> toModify,
                                                                  Map<String,List<Object>> toConsider)
Modify the "toModify" argument in consideration of the "toConsider" argument. Return the resulting Map, which may or may not be the same reference as the "toModify" argument. The modification performed is implementation-specific -- implementations of this interface exist to perform some particular transformation on the toModify argument given the toConsider argument.

Parameters:
toModify - - modify this map
toConsider - - in consideration of this map
Returns:
the modified Map
Throws:
IllegalArgumentException - if either toModify or toConsider is null

mergeAttributes

public Map<String,List<Object>> mergeAttributes(Map<String,List<Object>> toModify,
                                                Map<String,List<Object>> toConsider)
Description copied from interface: IAttributeMerger
Modify the "toModify" argument in consideration of the "toConsider" argument. Return the resulting Map, which may or may not be the same reference as the "toModify" argument. The modification performed is implementation-specific -- implementations of this interface exist to perform some particular transformation on the toModify argument given the toConsider argument.

Specified by:
mergeAttributes in interface IAttributeMerger
Parameters:
toModify - - modify this map
toConsider - - in consideration of this map
Returns:
the modified Map


Copyright © 2012 Jasig. All Rights Reserved.