Package edu.internet2.middleware.subject
Interface Subject
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
GrouperSubject
,JNDISubject
,LazySubject
,RegistrySubject
,SubjectImpl
,UnresolvableSubject
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
Modifier and TypeMethodDescriptionGets a map attribute names and values.getAttributes
(boolean excludeInternalAttributes) Gets a map attribute names and values.getAttributeValue
(String attributeName) Returns the value of a single-valued attribute.getAttributeValue
(String attributeName, boolean excludeInternalAttributes) Returns the value of a single-valued attribute.getAttributeValueOrCommaSeparated
(String attributeName) Returns the attribute value if single-valued, or if multi-valued, returns the values comma separated (with a space too).getAttributeValueOrCommaSeparated
(String attributeName, boolean excludeInternalAttributes) Returns the attribute value if single-valued, or if multi-valued, returns the values comma separated (with a space too).getAttributeValues
(String attributeName) Returns the values of a multi-valued attribute, or a set of size one for a single valued attribute.getAttributeValues
(String attributeName, boolean excludeInternalAttributes) Returns the values of a multi-valued attribute, or a set of size one for a single valued attribute.getAttributeValueSingleValued
(String attributeName) Returns the attribute value if single-valued, or if multi-valued, throws an exception.getAttributeValueSingleValued
(String attributeName, boolean excludeInternalAttributes) Returns the attribute value if single-valued, or if multi-valued, throws an exception.Gets this Subject's description.getId()
Gets this Subject's ID.getName()
Gets this Subject's name.Returns the Source of this Subject.get the source id of a subjectwe want to resolve virtual translated attributes when they are needed so store a map of subject and source attributes for that translationgetType()
Gets this Subject's type.get the type nameboolean
void
setResolvedFromSource
(boolean isResolvedFromSource) true if resolved from source (rather than cache)void
setTranslationMap
(Map<String, Object> translationMap) we want to resolve virtual translated attributes when they are needed so store a map of subject and source attributes for that translation
-
Method Details
-
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
Returns the value of a single-valued attribute. If multivalued, this returns the first value. This does not return values for internal attributes. Note, the keys are case-insensitive- Parameters:
attributeName
-- Returns:
- value or null if not found
-
getAttributeValues
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. This does not return values for internal attributes. Note, the keys are case-insensitive- Parameters:
attributeName
-- Returns:
- set or empty set or null if not there
-
getAttributeValueSingleValued
Returns the attribute value if single-valued, or if multi-valued, throws an exception. Implementors can use the static helper in SubjectImpl. This does not return values for internal attributes. Note, the keys are case-insensitive- Parameters:
attributeName
-- Returns:
- value or null if not there
-
getAttributeValueOrCommaSeparated
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. This does not return values for internal attributes. Note, the keys are case-insensitive
- Parameters:
attributeName
-- Returns:
- value or values or null if not there
-
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). This does not return internal attributes. Note, the keys are case-insensitive- Returns:
- map or empty map or null if not there
-
getAttributeValue
Returns the value of a single-valued attribute. If multivalued, this returns the first value. Note, the keys are case-insensitive- Parameters:
attributeName
-excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- value or null if not found
-
getAttributeValues
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. Note, the keys are case-insensitive- Parameters:
attributeName
-excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- set or empty set or null if not there
-
getAttributeValueSingleValued
Returns the attribute value if single-valued, or if multi-valued, throws an exception. Implementors can use the static helper in SubjectImpl. Note, the keys are case-insensitive- Parameters:
attributeName
-excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- value or null if not there
-
getAttributeValueOrCommaSeparated
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. Note, the keys are case-insensitive
- Parameters:
attributeName
-excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- value or values or null if not there
-
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. Note, the keys are case-insensitive- Parameters:
excludeInternalAttributes
- if true, internal attributes are not returned- Returns:
- map or empty map or null if not there
-
getSource
Source getSource()Returns the Source of this Subject.- Returns:
- source
-
getTranslationMap
we want to resolve virtual translated attributes when they are needed so store a map of subject and source attributes for that translation- Returns:
-
setTranslationMap
we want to resolve virtual translated attributes when they are needed so store a map of subject and source attributes for that translation- Parameters:
translationMap
-
-
isResolvedFromSource
boolean isResolvedFromSource()- Returns:
- true if resolved from source (rather than cache)
-
setResolvedFromSource
void setResolvedFromSource(boolean isResolvedFromSource) true if resolved from source (rather than cache)- Parameters:
isResolvedFromSource
-
-