edu.internet2.middleware.grouper.subj
Class LazySubject

java.lang.Object
  extended by edu.internet2.middleware.grouper.subj.LazySubject
All Implemented Interfaces:
Subject, Serializable

public class LazySubject
extends Object
implements Subject

Subject from a Membership - getMember().getSubject() only called if necessary i.e. the UI pages results and so it is often not necessary to instantiate all the Subjects (and Members)

Version:
$Id: LazySubject.java,v 1.11 2009-10-31 16:27:12 mchyzer Exp $
Author:
Gary Brown.
See Also:
Serialized Form

Constructor Summary
LazySubject(Member member)
           
LazySubject(Membership ms)
           
 
Method Summary
 boolean equals(Object obj)
           
 Map getAttributes()
          Gets a map attribute names and values.
 String getAttributeValue(String name)
          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 getAttributeValues(String name)
          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.
 Membership getMembership()
           
 String getName()
          Gets this Subject's name.
 Source getSource()
          Returns the Source of this Subject.
 String getSourceId()
          get the source id
 SubjectType getType()
          Gets this Subject's type.
 String getTypeName()
          get the type name
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LazySubject

public LazySubject(Membership ms)
Parameters:
ms -

LazySubject

public LazySubject(Member member)
Parameters:
member -
Method Detail

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

getAttributes

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

Specified by:
getAttributes in interface Subject
Returns:
map or empty map or null if not there
See Also:
Subject.getAttributes()

getAttributeValue

public String getAttributeValue(String name)
Description copied from interface: Subject
Returns the value of a single-valued attribute. If multivalued, this returns the first value

Specified by:
getAttributeValue in interface Subject
Returns:
value or null if not found
See Also:
Subject.getAttributeValue(java.lang.String)

getAttributeValues

public Set getAttributeValues(String name)
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.

Specified by:
getAttributeValues in interface Subject
Returns:
set or empty set or null if not there
See Also:
Subject.getAttributeValues(java.lang.String)

getDescription

public String getDescription()
Description copied from interface: Subject
Gets this Subject's description.

Specified by:
getDescription in interface Subject
Returns:
description or null if not there
See Also:
Subject.getDescription()

getId

public String getId()
Description copied from interface: Subject
Gets this Subject's ID.

Specified by:
getId in interface Subject
Returns:
string
See Also:
Subject.getId()

getName

public String getName()
Description copied from interface: Subject
Gets this Subject's name.

Specified by:
getName in interface Subject
Returns:
name or null if not there
See Also:
Subject.getName()

getSource

public Source getSource()
Description copied from interface: Subject
Returns the Source of this Subject.

Specified by:
getSource in interface Subject
Returns:
source
See Also:
Subject.getSource()

getSourceId

public String getSourceId()
get the source id

Specified by:
getSourceId in interface Subject
Returns:
the soruce id

getType

public SubjectType getType()
Description copied from interface: Subject
Gets this Subject's type.

Specified by:
getType in interface Subject
Returns:
subject type
See Also:
Subject.getType()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getMembership

public Membership getMembership()
Returns:
membership

getTypeName

public String getTypeName()
Description copied from interface: Subject
get the type name

Specified by:
getTypeName in interface Subject
Returns:
the type name
See Also:
Subject.getTypeName()

getAttributeValueOrCommaSeparated

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

Specified by:
getAttributeValueOrCommaSeparated in interface Subject
Returns:
value or values or null if not there
See Also:
Subject.getAttributeValueOrCommaSeparated(java.lang.String)

getAttributeValueSingleValued

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

Specified by:
getAttributeValueSingleValued in interface Subject
Returns:
value or null if not there
See Also:
Subject.getAttributeValueSingleValued(java.lang.String)