Interface Subject

All Superinterfaces:
Serializable
All Known Implementing Classes:
GrouperSubject, JNDISubject, LazySubject, RegistrySubject, SubjectImpl, 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 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

      String getAttributeValue(String attributeName)
      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

      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. 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

      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. This does not return values for internal attributes. Note, the keys are case-insensitive
      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.
       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

      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). This does not return internal attributes. Note, the keys are case-insensitive
      Returns:
      map or empty map or null if not there
    • getAttributeValue

      String getAttributeValue(String attributeName, boolean excludeInternalAttributes)
      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

      Set<String> getAttributeValues(String attributeName, boolean excludeInternalAttributes)
      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

      String getAttributeValueSingleValued(String attributeName, boolean excludeInternalAttributes)
      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

      String 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).
       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

      Map<String,Set<String>> getAttributes(boolean excludeInternalAttributes)
      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

      Map<String,Object> 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

      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
      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 -