edu.internet2.middleware.grouper.subj
Class SubjectHelper

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

public class SubjectHelper
extends java.lang.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(edu.internet2.middleware.subject.Subject subject)
          if keeping the subjects in a map where the subject is the key, this multikey will identify the subject
static boolean eq(java.lang.Object a, java.lang.Object b)
           
static boolean eqSource(java.lang.Object a, java.lang.Object b)
           
static java.lang.String getPretty(Member _m)
           
static java.lang.String getPretty(edu.internet2.middleware.subject.Subject subj)
           
static java.lang.String getPrettyComplete(edu.internet2.middleware.subject.Subject subj)
           
static boolean inList(java.util.Collection<edu.internet2.middleware.subject.Subject> collection, java.lang.String sourceId, java.lang.String subjectId)
          see if a subject is in a list
static boolean inList(java.util.Collection<edu.internet2.middleware.subject.Subject> collection, edu.internet2.middleware.subject.Subject subject)
          see if a subject is in a list
static boolean inSourceList(java.util.Collection<edu.internet2.middleware.subject.Source> collection, edu.internet2.middleware.subject.Source source)
          see if a source is in a list
static void removeDuplicates(java.util.Collection<edu.internet2.middleware.subject.Subject> subjects)
          remove duplicates from a set
static void sortByDescription(java.util.Collection<edu.internet2.middleware.subject.Subject> subjects)
          sort a set or list by subject description
static java.util.Set<edu.internet2.middleware.subject.Subject> sortSetForSearch(java.util.Collection<edu.internet2.middleware.subject.Subject> subjectsIn, java.lang.String searchTerm)
          sort a set of subjects for a search, match id's and identifiers at top
static java.util.Set<edu.internet2.middleware.subject.Subject> sortSetForSearch(java.util.Collection<edu.internet2.middleware.subject.Subject> subjectsIn, java.lang.String searchTerm, java.util.Set<edu.internet2.middleware.subject.Subject> idOrIdentifierMatches)
          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(edu.internet2.middleware.subject.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

sortByDescription

public static void sortByDescription(java.util.Collection<edu.internet2.middleware.subject.Subject> subjects)
sort a set or list by subject description

Parameters:
subjects -

sortSetForSearch

public static java.util.Set<edu.internet2.middleware.subject.Subject> sortSetForSearch(java.util.Collection<edu.internet2.middleware.subject.Subject> subjectsIn,
                                                                                       java.lang.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

sortSetForSearch

public static java.util.Set<edu.internet2.middleware.subject.Subject> sortSetForSearch(java.util.Collection<edu.internet2.middleware.subject.Subject> subjectsIn,
                                                                                       java.lang.String searchTerm,
                                                                                       java.util.Set<edu.internet2.middleware.subject.Subject> idOrIdentifierMatches)
sort a set of subjects for a search, match id's and identifiers at top

Parameters:
subjectsIn -
searchTerm -
idOrIdentifierMatches - null if not known, but if you know of some, pass that in here
Returns:
the set with close matches at top

eq

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

eqSource

public static boolean eqSource(java.lang.Object a,
                               java.lang.Object b)
Parameters:
a -
b -
Returns:
True if both objects are Sources and equal.
Since:
2.0.2

getPretty

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

getPretty

public static java.lang.String getPretty(edu.internet2.middleware.subject.Subject subj)
Parameters:
subj -
Returns:
string

getPrettyComplete

public static java.lang.String getPrettyComplete(edu.internet2.middleware.subject.Subject subj)
Parameters:
subj -
Returns:
string

removeDuplicates

public static void removeDuplicates(java.util.Collection<edu.internet2.middleware.subject.Subject> subjects)
remove duplicates from a set

Parameters:
subjects -

inList

public static boolean inList(java.util.Collection<edu.internet2.middleware.subject.Subject> collection,
                             edu.internet2.middleware.subject.Subject subject)
see if a subject is in a list

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

inList

public static boolean inList(java.util.Collection<edu.internet2.middleware.subject.Subject> collection,
                             java.lang.String sourceId,
                             java.lang.String subjectId)
see if a subject is in a list

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

inSourceList

public static boolean inSourceList(java.util.Collection<edu.internet2.middleware.subject.Source> collection,
                                   edu.internet2.middleware.subject.Source source)
see if a source is in a list

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