org.jasig.portal.services.persondir.support
Class MultivaluedPersonAttributeUtils

java.lang.Object
  extended by org.jasig.portal.services.persondir.support.MultivaluedPersonAttributeUtils

public final class MultivaluedPersonAttributeUtils
extends java.lang.Object

Since:
uPortal 2.5
Version:
$Revision: 1.5 $ $Date: 2005/04/13 17:45:29 $
Author:
Eric Dalquist edalquist@unicon.net

Constructor Summary
private MultivaluedPersonAttributeUtils()
          This class is not meant to be instantiated.
 
Method Summary
(package private) static void addResult(java.util.Map results, java.lang.Object key, java.lang.Object value)
          Adds a key/value pair to the specified Map, creating multi-valued values when appropriate.
(package private) static java.util.Collection flattenCollection(java.util.Collection source)
          Takes a Collection and creates a flattened Collection out of it.
(package private) static java.util.Map parseAttributeToAttributeMapping(java.util.Map mapping)
          Translate from a more flexible Attribute to Attribute mapping format to a Map from String to Set of Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultivaluedPersonAttributeUtils

private MultivaluedPersonAttributeUtils()
This class is not meant to be instantiated.

Method Detail

parseAttributeToAttributeMapping

static java.util.Map parseAttributeToAttributeMapping(java.util.Map mapping)
Translate from a more flexible Attribute to Attribute mapping format to a Map from String to Set of Strings. The point of the map is to map from attribute names in the underlying data store (e.g., JDBC column names, LDAP attribute names) to uPortal attribute names. Any given underlying data store attribute might map to zero uPortal attributes (not appear in the map at all), map to exactly one uPortal attribute (appear in the Map as a mapping from a String to a String or as a mapping from a String to a Set containing just one String), or map to several uPortal attribute names (appear in the Map as a mapping from a String to a Set of Strings). This method takes as its argument a Map that must have keys of type String and values of type String or Set of Strings. The argument must not be null and must have no null keys or null values. It must contain no keys other than Strings and no values other than Strings or Sets of Strings. This method will throw IllegalArgumentException if the method argument doesn't meet these requirements. This method returns a Map equivalent to its argument except whereever there was a String value in the Map there will instead be an immutable Set containing the String value. That is, the return value is normalized to be a Map from String to Set (of String).

Parameters:
mapping - Map from String names of attributes in the underlying store to uP attribute names or Sets of such names.
Returns:
a Map from String to Set of Strings
Throws:
java.lang.IllegalArgumentException - If the Map doesn't follow the rules stated above.

addResult

static void addResult(java.util.Map results,
                      java.lang.Object key,
                      java.lang.Object value)
Adds a key/value pair to the specified Map, creating multi-valued values when appropriate.
Since multi-valued attributes end up with a value of type List, passing in a List of any type will cause its contents to be added to the results Map directly under the specified key

Parameters:
results - The Map to modify.
key - The key to add the value for.
value - The value to add for the key.
Throws:
java.lang.IllegalArgumentException - if any argument is null

flattenCollection

static java.util.Collection flattenCollection(java.util.Collection source)
Takes a Collection and creates a flattened Collection out of it.

Parameters:
source - The Collection to flatten.
Returns:
A flattened Collection that contains all entries from all levels of source.