edu.internet2.middleware.subject
Interface Subject

All Superinterfaces:
Serializable
All Known Implementing Classes:
GrouperSubject, ImportSubjectWrapper, JNDISubject, LazySubject, RegistrySubject, SubjectImpl, SubjectSortWrapper, SubjectWrapper, UnresolvableSubject

public interface Subject
extends Serializable

 A Subject represents an entity, such as a person, group, or organization.
 This class provides common characteristics and behaviors across these entities.
 Note, implementations of this interface shouldnt hold onto sources, since they
 arent serializable, they should lookup with AllSources
 
 Implementors should probably subclass SubjectImpl instead of implement this directly.
 
 Also, implementors should implement toString, equals and hashcode like Subject (based on
 sourceId and subjectId).  There are static methods in subjectImpl which can be used as helper
 methods
 


Method Summary
 Map<String,Set<String>> getAttributes()
          Gets a map attribute names and values.
 String getAttributeValue(String attributeName)
          Returns the value of a single-valued attribute.
 String getAttributeValueOrCommaSeparated(String attributeName)
           Returns the attribute value if single-valued, or if multi-valued, returns the values comma separated (with a space too).
 Set<String> getAttributeValues(String attributeName)
          Returns the values of a multi-valued attribute, or a set of size one for a single valued attribute.
 String getAttributeValueSingleValued(String attributeName)
          Returns the attribute value if single-valued, or if multi-valued, throws an exception.
 String getDescription()
          Gets this Subject's description.
 String getId()
          Gets this Subject's ID.
 String getName()
          Gets this Subject's name.
 Source getSource()
          Returns the Source of this Subject.
 String getSourceId()
          get the source id of a subject
 SubjectType getType()
          Gets this Subject's type.
 String getTypeName()
          get the type name
 

Method Detail

getId

String getId()
Gets this Subject's ID.

Returns:
string

getType

SubjectType getType()
Gets this Subject's type.

Returns:
subject type

getTypeName

String getTypeName()
get the type name

Returns:
the type name

getSourceId

String getSourceId()
get the source id of a subject

Returns:
the source id

getName

String getName()
Gets this Subject's name.

Returns:
name or null if not there

getDescription

String getDescription()
Gets this Subject's description.

Returns:
description or null if not there

getAttributeValue

String getAttributeValue(String attributeName)
Returns the value of a single-valued attribute. If multivalued, this returns the first value

Parameters:
attributeName -
Returns:
value or null if not found

getAttributeValues

Set<String> getAttributeValues(String attributeName)
Returns the values of a multi-valued attribute, or a set of size one for a single valued attribute. Note the returned set should not be changed.

Parameters:
attributeName -
Returns:
set or empty set or null if not there

getAttributeValueSingleValued

String getAttributeValueSingleValued(String attributeName)
Returns the attribute value if single-valued, or if multi-valued, throws an exception. Implementors can use the static helper in SubjectImpl

Parameters:
attributeName -
Returns:
value or null if not there

getAttributeValueOrCommaSeparated

String getAttributeValueOrCommaSeparated(String attributeName)
 Returns the attribute value if single-valued, or
 if multi-valued, returns the values comma separated (with a space too).
 So if the values are: a b c; this would return the string: "a, b, c"
 Implementors can use the static helper in SubjectImpl
 

Parameters:
attributeName -
Returns:
value or values or null if not there

getAttributes

Map<String,Set<String>> getAttributes()
Gets a map attribute names and values. The map's key contains the attribute name and the map's value contains a Set of attribute value(s). The returned Map can be augmented or changed

Returns:
map or empty map or null if not there

getSource

Source getSource()
Returns the Source of this Subject.

Returns:
source