Class SubjectHelper
java.lang.Object
edu.internet2.middleware.grouper.subj.SubjectHelper
Subject utility helper class.
- Version:
- $Id: SubjectHelper.java,v 1.7 2009-12-28 06:08:37 mchyzer Exp $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MultiKeyconvertToMultiKey(Subject subject) if keeping the subjects in a map where the subject is the key, this multikey will identify the subjectstatic booleanstatic booleanstatic SubjectfindInList(Collection<Subject> collection, String sourceId, String subjectId, boolean exceptionIfNotFound) see if a subject is in a list, if so return itstatic Stringstatic Stringstatic StringgetPrettyComplete(Subject subj) static inthashcode for subjectstatic booleaninList(Collection<Subject> collection, Subject subject) see if a subject is in a liststatic booleaninList(Collection<Subject> collection, String sourceId, String subjectId) see if a subject is in a liststatic booleaninSourceList(Collection<Source> collection, Source source) see if a source is in a liststatic voidremoveDuplicates(Collection<Subject> subjects) remove duplicates from a setstatic voidsortByDescription(Collection<Subject> subjects) sort a set or list by subject descriptionsortSetForSearch(Collection<Subject> subjectsIn, String searchTerm) sort a set of subjects for a search, match id's and identifiers at topsortSetForSearch(Collection<Subject> subjectsIn, String searchTerm, Set<Subject> idOrIdentifierMatches) sort a set of subjects for a search, match id's and identifiers at topstatic StringsourcesToIdsString(Collection<Source> sources) convert sources to id's comma separatedstatic booleansubjectEqualsGrouperAll(Subject subject) see if the subject passed in equals the all subjectstatic booleansubjectEqualsGrouperAll(String sourceId, String subjectId) see if the subject passed in equals the all subject
-
Constructor Details
-
SubjectHelper
public SubjectHelper()
-
-
Method Details
-
subjectEqualsGrouperAll
see if the subject passed in equals the all subject- Parameters:
subject-- Returns:
- true
-
subjectEqualsGrouperAll
see if the subject passed in equals the all subject- Parameters:
subject-- Returns:
- true
-
sourcesToIdsString
convert sources to id's comma separated- Parameters:
sources-- Returns:
- the string or null if none
-
convertToMultiKey
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
sort a set or list by subject description- Parameters:
subjects-
-
nonGroupSources
- Returns:
- the sources that are non group
-
sortSetForSearch
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
hashcode for subject- Parameters:
subject-- Returns:
- the hashcode
-
eq
- 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
- Parameters:
a-b-- Returns:
- True if both objects are
Sources and equal. - Since:
- 2.0.2
-
getPretty
- Parameters:
_m-- Returns:
- string
-
getPretty
- Parameters:
subj-- Returns:
- string
-
getPrettyComplete
- Parameters:
subj-- Returns:
- string
-
removeDuplicates
remove duplicates from a set- Parameters:
subjects-
-
inList
see if a subject is in a list- Parameters:
collection-subject-- Returns:
- true if in list
-
inList
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
see if a source is in a list- Parameters:
collection-source-- Returns:
- true if in list
-