edu.internet2.middleware.grouper.subj
Class SubjectHelper

java.lang.Object
  extended by edu.internet2.middleware.grouper.subj.SubjectHelper

public class SubjectHelper
extends Object

Subject utility helper class.

Version:
$Id: SubjectHelper.java,v 1.7 2009-12-28 06:08:37 mchyzer Exp $
Author:
blair christensen.

Constructor Summary
SubjectHelper()
           
 
Method Summary
static org.apache.commons.collections.keyvalue.MultiKey convertToMultiKey(Subject subject)
          if keeping the subjects in a map where the subject is the key, this multikey will identify the subject
static boolean eq(Object a, Object b)
           
static String getPretty(Member _m)
           
static String getPretty(Subject subj)
           
static String getPrettyComplete(Subject subj)
           
static boolean inList(Collection<Subject> collection, String sourceId, String subjectId)
          see if a subject is in a list
static boolean inList(Collection<Subject> collection, Subject subject)
          see if a subject is in a list
static void removeDuplicates(Collection<Subject> subjects)
          remove duplicates from a set
static Set<Subject> sortSetForSearch(Set<Subject> subjectsIn, String searchTerm)
          sort a set of subjects for a search, match id's and identifiers at top
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubjectHelper

public SubjectHelper()
Method Detail

convertToMultiKey

public static org.apache.commons.collections.keyvalue.MultiKey convertToMultiKey(Subject subject)
if keeping the subjects in a map where the subject is the key, this multikey will identify the subject

Parameters:
subject -
Returns:
the multikey of source id and subject id

sortSetForSearch

public static Set<Subject> sortSetForSearch(Set<Subject> subjectsIn,
                                            String searchTerm)
sort a set of subjects for a search, match id's and identifiers at top

Parameters:
subjectsIn -
searchTerm -
Returns:
the set with close matches at top

eq

public static boolean eq(Object a,
                         Object b)
Parameters:
a -
b -
Returns:
True if both objects are Subjects and equal.
Since:
1.2.1

getPretty

public static String getPretty(Member _m)
Parameters:
_m -
Returns:
string

getPretty

public static String getPretty(Subject subj)
Parameters:
subj -
Returns:
string

getPrettyComplete

public static String getPrettyComplete(Subject subj)
Parameters:
subj -
Returns:
string

removeDuplicates

public static void removeDuplicates(Collection<Subject> subjects)
remove duplicates from a set

Parameters:
subjects -

inList

public static boolean inList(Collection<Subject> collection,
                             Subject subject)
see if a subject is in a list

Parameters:
collection -
subject -
Returns:
true if in list

inList

public static boolean inList(Collection<Subject> collection,
                             String sourceId,
                             String subjectId)
see if a subject is in a list

Parameters:
collection -
sourceId -
subjectId -
Returns:
true if in list