Class SubjectHelper

java.lang.Object
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 $
  • Constructor Details

    • SubjectHelper

      public SubjectHelper()
  • Method Details

    • subjectEqualsGrouperAll

      public static boolean subjectEqualsGrouperAll(Subject subject)
      see if the subject passed in equals the all subject
      Parameters:
      subject -
      Returns:
      true
    • subjectEqualsGrouperAll

      public static boolean subjectEqualsGrouperAll(String sourceId, String subjectId)
      see if the subject passed in equals the all subject
      Parameters:
      subject -
      Returns:
      true
    • sourcesToIdsString

      public static String sourcesToIdsString(Collection<Source> sources)
      convert sources to id's comma separated
      Parameters:
      sources -
      Returns:
      the string or null if none
    • convertToMultiKey

      public static 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
    • sortByDescription

      public static void sortByDescription(Collection<Subject> subjects)
      sort a set or list by subject description
      Parameters:
      subjects -
    • nonGroupSources

      public static Set<Source> nonGroupSources()
      Returns:
      the sources that are non group
    • sortSetForSearch

      public static Set<Subject> sortSetForSearch(Collection<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
    • sortSetForSearch

      public static Set<Subject> sortSetForSearch(Collection<Subject> subjectsIn, String searchTerm, Set<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
    • hashcode

      public static int hashcode(Subject subject)
      hashcode for subject
      Parameters:
      subject -
      Returns:
      the hashcode
    • eq

      public static boolean eq(Object a, Object b)
      Parameters:
      a -
      b -
      Returns:
      True if both objects are Subjects and equal. could be a multikey (sourceId, subjectId) and subject
      Since:
      1.2.1
    • eqSource

      public static boolean eqSource(Object a, Object b)
      Parameters:
      a -
      b -
      Returns:
      True if both objects are Sources and equal.
      Since:
      2.0.2
    • 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
    • findInList

      public static Subject findInList(Collection<Subject> collection, String sourceId, String subjectId, boolean exceptionIfNotFound)
      see if a subject is in a list, if so return it
      Parameters:
      collection -
      sourceId -
      subjectId -
      exceptionIfNotFound - true if an exception should be thrown if not found
      Returns:
      subject or null if not found or exception
    • inSourceList

      public static boolean inSourceList(Collection<Source> collection, Source source)
      see if a source is in a list
      Parameters:
      collection -
      source -
      Returns:
      true if in list