org.jasig.portal.groups
Class ReferencePersonNameFinder

java.lang.Object
  extended by org.jasig.portal.groups.ReferencePersonNameFinder
All Implemented Interfaces:
IEntityNameFinder

public class ReferencePersonNameFinder
extends java.lang.Object
implements IEntityNameFinder

Reference implementation of IEntityNameFinder for IPersons.

Version:
$Revision: 1.10 $
Author:
Dan Ellentuck

Field Summary
private static java.lang.String DIRECTORY_FIRST_NAME_COLUMN
           
private static java.lang.String DIRECTORY_LAST_NAME_COLUMN
           
private static java.lang.String DIRECTORY_TABLE
           
private static java.lang.String DIRECTORY_USER_NAME_COLUMN
           
private static org.apache.commons.logging.Log log
           
private  java.util.Map names
           
private static IEntityNameFinder singleton
           
private static java.lang.String USER_ID_COLUMN
           
private static java.lang.String USER_NAME_COLUMN
           
private static java.lang.String USER_TABLE
           
 
Constructor Summary
private ReferencePersonNameFinder()
          ReferenceIPersonNameFinder constructor comment.
 
Method Summary
private  java.util.Map getDirectoryNames()
          Get names by user ID from UP_PERSON_DIR.
 java.lang.String getName(java.lang.String key)
          Given the key, returns the entity's name.
 java.util.Map getNames(java.lang.String[] keys)
          Given an array of keys, returns the names of the entities.
private  java.lang.String getSelectDirectoryNamesSql()
           
private  java.lang.String getSelectUserNamesSql()
           
 java.lang.Class getType()
          Returns the entity type for this IEntityFinder.
private  java.util.Map getUserNames()
          Get names by user ID from UP_USER.
private  void initialize()
          Loads the names cache.
private  java.util.Map primGetNames()
           
static IEntityNameFinder singleton()
           
 java.lang.String toString()
          Returns a String that represents the value of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

singleton

private static IEntityNameFinder singleton

USER_TABLE

private static java.lang.String USER_TABLE

USER_ID_COLUMN

private static java.lang.String USER_ID_COLUMN

USER_NAME_COLUMN

private static java.lang.String USER_NAME_COLUMN

DIRECTORY_TABLE

private static java.lang.String DIRECTORY_TABLE

DIRECTORY_FIRST_NAME_COLUMN

private static java.lang.String DIRECTORY_FIRST_NAME_COLUMN

DIRECTORY_LAST_NAME_COLUMN

private static java.lang.String DIRECTORY_LAST_NAME_COLUMN

DIRECTORY_USER_NAME_COLUMN

private static java.lang.String DIRECTORY_USER_NAME_COLUMN

names

private java.util.Map names
Constructor Detail

ReferencePersonNameFinder

private ReferencePersonNameFinder()
                           throws java.sql.SQLException
ReferenceIPersonNameFinder constructor comment.

Throws:
java.sql.SQLException
Method Detail

getDirectoryNames

private java.util.Map getDirectoryNames()
                                 throws java.sql.SQLException
Get names by user ID from UP_PERSON_DIR.

Throws:
java.sql.SQLException

getName

public java.lang.String getName(java.lang.String key)
                         throws java.lang.Exception
Given the key, returns the entity's name.

Specified by:
getName in interface IEntityNameFinder
Parameters:
key - java.lang.String
Throws:
java.lang.Exception

getNames

public java.util.Map getNames(java.lang.String[] keys)
                       throws java.lang.Exception
Given an array of keys, returns the names of the entities. If a key is not found, its name will be null.

Specified by:
getNames in interface IEntityNameFinder
Parameters:
keys - java.lang.String[]
Throws:
java.lang.Exception

getSelectDirectoryNamesSql

private java.lang.String getSelectDirectoryNamesSql()
Returns:
java.lang.String

getSelectUserNamesSql

private java.lang.String getSelectUserNamesSql()
Returns:
java.lang.String

getType

public java.lang.Class getType()
Returns the entity type for this IEntityFinder.

Specified by:
getType in interface IEntityNameFinder
Returns:
java.lang.Class

getUserNames

private java.util.Map getUserNames()
                            throws java.sql.SQLException
Get names by user ID from UP_USER.

Throws:
java.sql.SQLException

initialize

private void initialize()
                 throws java.sql.SQLException
Loads the names cache. This may seem like a dumb way to do it (making two passes and merging the results) but it does avoid the outer join horror. In any event, local implementations may often use a directory service like LDAP.

Throws:
java.sql.SQLException

primGetNames

private java.util.Map primGetNames()
Returns:
java.util.Map

singleton

public static IEntityNameFinder singleton()
                                   throws java.sql.SQLException
Returns:
IEntityNameFinder
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Returns a String that represents the value of this object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the receiver