Class SubjectImpl
java.lang.Object
edu.internet2.middleware.subject.provider.SubjectImpl
- All Implemented Interfaces:
Subject
,Serializable
- Direct Known Subclasses:
GrouperSubject
,JNDISubject
,UnresolvableSubject
Base Subject implementation. Subclass this to change behavior
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor called by SourceManager.SubjectImpl
(String id1, String name1, String description1, String typeName1, String sourceId1, String nameAttribute1, String descriptionAttribute1) Constructor called by SourceManager.SubjectImpl
(String id1, String name1, String description1, String typeName1, String sourceId1, Map<String, Set<String>> attributes1) Constructor called by SourceManager.SubjectImpl
(String id1, String name1, String description1, String typeName1, String sourceId1, Map<String, Set<String>> attributes1, String nameAttribute1, String descriptionAttribute1) Constructor called by SourceManager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear the state for attributes initted, i.e.static String
attributeValueOrCommaSeparated
(Subject subject, String attributeName) static String
attributeValueOrCommaSeparated
(Subject subject, String attributeName, boolean excludeInternalAttributes) static Subject
cloneSubject
(Subject subject) boolean
static boolean
equalsStatic
(Subject subject, Object obj) Gets a map attribute names and values.getAttributes
(boolean excludeInternalAttributes) Gets a map attribute names and values.getAttributeValue
(String name1) Returns the value of a single-valued attribute.getAttributeValue
(String name1, 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 name1) Returns the values of a multi-valued attribute, or a set of size one for a single valued attribute.getAttributeValues
(String name1, 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.sourceIdwe 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 nameint
hashCode()
static int
hashcodeStatic
(Subject subject) boolean
static String
runScriptStatic
(String script, Map<String, Object> translationMap) void
setAttributes
(Map<String, Set<String>> attributes1) void
setDescription
(String descriptionOverride) void
void
void
setResolvedFromSource
(boolean isResolvedFromSource) true if resolved from source (rather than cache)void
setSourceId
(String sourceId1) sourceIdvoid
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 translationvoid
setTypeName
(String typeName1) toAttributeMap
(String... strings) turn some strings into a map, every other is a name or value of attributetoString()
static String
toStringStatic
(Subject subject) toString
-
Constructor Details
-
SubjectImpl
public SubjectImpl(String id1, String name1, String description1, String typeName1, String sourceId1) Constructor called by SourceManager. Will create an empty map for attributes- Parameters:
id1
-name1
-description1
-typeName1
-sourceId1
-
-
SubjectImpl
public SubjectImpl(String id1, String name1, String description1, String typeName1, String sourceId1, Map<String, Set<String>> attributes1) Constructor called by SourceManager.- Parameters:
id1
-name1
-description1
-typeName1
-sourceId1
-attributes1
-
-
SubjectImpl
public SubjectImpl(String id1, String name1, String description1, String typeName1, String sourceId1, String nameAttribute1, String descriptionAttribute1) Constructor called by SourceManager. Will create an empty map for attributes- Parameters:
id1
-name1
-description1
-typeName1
-sourceId1
-nameAttribute1
-descriptionAttribute1
-
-
SubjectImpl
public SubjectImpl(String id1, String name1, String description1, String typeName1, String sourceId1, Map<String, Set<String>> attributes1, String nameAttribute1, String descriptionAttribute1) Constructor called by SourceManager.- Parameters:
id1
-name1
-description1
-typeName1
-sourceId1
-attributes1
-nameAttribute1
-descriptionAttribute1
-
-
-
Method Details
-
toAttributeMap
turn some strings into a map, every other is a name or value of attribute- Parameters:
strings
-- Returns:
- the map (never null)
-
toString
-
toStringStatic
toString- Parameters:
subject
-- Returns:
- string
-
getSourceId
sourceId- Specified by:
getSourceId
in interfaceSubject
- Returns:
- the sourceId
-
setSourceId
sourceId- Parameters:
sourceId1
- the sourceId to set
-
cloneSubject
- Parameters:
subject
-- Returns:
- the cloned subject
-
runScriptStatic
-
getId
Gets this Subject's ID. -
getType
Gets this Subject's type. -
getName
Gets this Subject's name. -
getDescription
Gets this Subject's description.- Specified by:
getDescription
in interfaceSubject
- Returns:
- description or null if not there
-
getAttributeValue
Description copied from interface:Subject
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- Specified by:
getAttributeValue
in interfaceSubject
- Returns:
- value or null if not found
- See Also:
-
getAttributeValue
Description copied from interface:Subject
Returns the value of a single-valued attribute. If multivalued, this returns the first value. Note, the keys are case-insensitive- Specified by:
getAttributeValue
in interfaceSubject
excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- value or null if not found
- See Also:
-
getAttributeValues
Description copied from interface:Subject
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- Specified by:
getAttributeValues
in interfaceSubject
- Returns:
- set or empty set or null if not there
- See Also:
-
getAttributeValues
Description copied from interface:Subject
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- Specified by:
getAttributeValues
in interfaceSubject
excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- set or empty set or null if not there
- See Also:
-
getTranslationMap
Description copied from interface:Subject
we want to resolve virtual translated attributes when they are needed so store a map of subject and source attributes for that translation- Specified by:
getTranslationMap
in interfaceSubject
- Returns:
-
setTranslationMap
Description copied from interface:Subject
we want to resolve virtual translated attributes when they are needed so store a map of subject and source attributes for that translation- Specified by:
setTranslationMap
in interfaceSubject
-
attributesInittedClear
public void attributesInittedClear()clear the state for attributes initted, i.e. recalculated them -
getAttributes
Description copied from interface:Subject
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- Specified by:
getAttributes
in interfaceSubject
- Returns:
- map or empty map or null if not there
- See Also:
-
getAttributes
Description copied from interface:Subject
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- Specified by:
getAttributes
in interfaceSubject
- Parameters:
excludeInternalAttributes
- if true, internal attributes are not returned- Returns:
- map or empty map or null if not there
- See Also:
-
getSource
Returns the Source of this Subject. -
setAttributes
- Parameters:
attributes1
-
-
getTypeName
Description copied from interface:Subject
get the type name- Specified by:
getTypeName
in interfaceSubject
- Returns:
- the type name
- See Also:
-
setId
- Parameters:
id1
- the id to set
-
setTypeName
- Parameters:
typeName1
- the typeName to set
-
equals
-
equalsStatic
- Parameters:
subject
-obj
-- Returns:
- true if equal
-
hashCode
public int hashCode() -
hashcodeStatic
- Parameters:
subject
-- Returns:
- hash code
-
getAttributeValueOrCommaSeparated
Description copied from interface:Subject
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
- Specified by:
getAttributeValueOrCommaSeparated
in interfaceSubject
- Returns:
- value or values or null if not there
- See Also:
-
getAttributeValueOrCommaSeparated
public String getAttributeValueOrCommaSeparated(String attributeName, boolean excludeInternalAttributes) Description copied from interface:Subject
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
- Specified by:
getAttributeValueOrCommaSeparated
in interfaceSubject
excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- value or values or null if not there
- See Also:
-
attributeValueOrCommaSeparated
- Parameters:
subject
- shouldnt be nullattributeName
-- Returns:
- the string
- See Also:
-
attributeValueOrCommaSeparated
public static String attributeValueOrCommaSeparated(Subject subject, String attributeName, boolean excludeInternalAttributes) - Parameters:
subject
- shouldnt be nullattributeName
-excludeInternalAttributes
-- Returns:
- the string
- See Also:
-
getAttributeValueSingleValued
Description copied from interface:Subject
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- Specified by:
getAttributeValueSingleValued
in interfaceSubject
- Returns:
- value or null if not there
- See Also:
-
getAttributeValueSingleValued
public String getAttributeValueSingleValued(String attributeName, boolean excludeInternalAttributes) Description copied from interface:Subject
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- Specified by:
getAttributeValueSingleValued
in interfaceSubject
excludeInternalAttributes
- if true, values for internal attributes are not returned- Returns:
- value or null if not there
- See Also:
-
getNameOverride
- Returns:
- the nameOverride
-
setName
- Parameters:
nameOverride
- the nameOverride to set
-
getDescriptionOverride
- Returns:
- the descriptionOverride
-
setDescription
- Parameters:
descriptionOverride
- the descriptionOverride to set
-
isResolvedFromSource
public boolean isResolvedFromSource()- Specified by:
isResolvedFromSource
in interfaceSubject
- Returns:
- true if resolved from source (rather than cache)
-
setResolvedFromSource
public void setResolvedFromSource(boolean isResolvedFromSource) true if resolved from source (rather than cache)- Specified by:
setResolvedFromSource
in interfaceSubject
- Parameters:
isResolvedFromSource
-
-