edu.internet2.middleware.grouper
Class RegistrySubject

java.lang.Object
  extended by edu.internet2.middleware.grouper.GrouperAPI
      extended by edu.internet2.middleware.grouper.RegistrySubject
All Implemented Interfaces:
HibGrouperLifecycle, GrouperCloneable, GrouperUtil.FieldValuable, edu.internet2.middleware.subject.Subject, Serializable, org.hibernate.classic.Lifecycle

public class RegistrySubject
extends GrouperAPI
implements edu.internet2.middleware.subject.Subject

A Subject local to the Groups Registry.

NOTE: THIS CLASS IS NOT CONSIDERED STABLE AND MAY CHANGE IN FUTURE RELEASES.

Since:
1.2.0
Version:
$Id: RegistrySubject.java,v 1.19 2009-09-02 05:57:26 mchyzer Exp $
Author:
blair christensen.
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, FIELD_DB_VERSION, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
RegistrySubject()
           
 
Method Summary
static RegistrySubject add(GrouperSession s, String id, String type, String name)
          Add a Subject to a Source within the Groups Registry.
 RegistrySubject clone()
          deep clone the fields in this object
 void delete(GrouperSession s)
          Delete existing RegistrySubject.
 boolean equals(Object obj)
           
 Map<String,Set<String>> getAttributes()
           
 Map<String,Set<String>> getAttributes(boolean excludeInternalAttributes)
           
 String getAttributeValue(String name)
          Return the value of the specified attribute.
 String getAttributeValue(String attributeName, boolean excludeInternalAttributes)
           
 String getAttributeValueOrCommaSeparated(String attributeName)
           
 String getAttributeValueOrCommaSeparated(String attributeName, boolean excludeInternalAttributes)
           
 Set<String> getAttributeValues(String name)
          Return the values for the specified attribute.
 Set<String> getAttributeValues(String attributeName, boolean excludeInternalAttributes)
           
 String getAttributeValueSingleValued(String attributeName)
           
 String getAttributeValueSingleValued(String attributeName, boolean excludeInternalAttributes)
           
 String getDescription()
          Return this subject's description.
 String getId()
          Return the subject id.
 String getName()
          Return the subject's name.
 edu.internet2.middleware.subject.Source getSource()
          Return the source.
 String getSourceId()
           
 edu.internet2.middleware.subject.SubjectType getType()
          Return this subject's SubjectType.
 String getTypeName()
           
 String getTypeString()
           
 int hashCode()
           
 void setId(String id)
           
 void setName(String name)
           
 void setTypeString(String type)
           
 String toString()
           
 
Methods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersion, dbVersionClear, dbVersionDifferentFields, dbVersionIsDifferent, dbVersionReset, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onPostDelete, onPostSave, onPostUpdate, onPreDelete, onPreSave, onPreUpdate, onSave, onUpdate, setHibernateVersionNumber
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegistrySubject

public RegistrySubject()
Method Detail

clone

public RegistrySubject clone()
Description copied from class: GrouperAPI
deep clone the fields in this object

Specified by:
clone in interface GrouperCloneable
Specified by:
clone in class GrouperAPI
Returns:
the clone of the object
See Also:
GrouperAPI.clone()

add

public static RegistrySubject add(GrouperSession s,
                                  String id,
                                  String type,
                                  String name)
                           throws GrouperException,
                                  InsufficientPrivilegeException
Add a Subject to a Source within the Groups Registry.

Subjects may only be added within a root-like session.

 try {
   RegistrySubject subj = RegistrySubject.add(s, "subject id", "person", "name");
 }
 catch (GrouperException eG) {
   // unable to add subject
 }
 catch (InsufficientPrivilegeException eIP) {
   // not privileged to add subject
 }
 

Parameters:
s - Create subject within this session context.
id - The subject id to assign to the subject.
type - The subject type to assign to the subject.
name - The name to assign to the subject.
Returns:
The created RegistrySubject.
Throws:
GrouperException
InsufficientPrivilegeException
Since:
1.2.0

delete

public void delete(GrouperSession s)
            throws GrouperException,
                   IllegalStateException,
                   InsufficientPrivilegeException
Delete existing RegistrySubject.
 try {
   rSubj.delete(s);
 }
 catch (GrouperException eG) {
   // failed to delete this RegistrySubject
 }
 catch (InsufficientPrivilegeException eIP) {
   // not privileged to delete this RegistrySubject
 }
 

Parameters:
s - Delete RegistrySubject within this GrouperSession context.
Throws:
GrouperException - if RegistrySubject cannot be deleted.
IllegalStateException - if GrouperSession is null.
InsufficientPrivilegeException - if not privileged to delete RegistrySubjects.
Since:
1.2.0

getAttributeValue

public String getAttributeValue(String name)
Return the value of the specified attribute.

Specified by:
getAttributeValue in interface edu.internet2.middleware.subject.Subject
Parameters:
name -
Returns:
attribute value

getAttributeValues

public Set<String> getAttributeValues(String name)
Return the values for the specified attribute.

Specified by:
getAttributeValues in interface edu.internet2.middleware.subject.Subject
Parameters:
name -
Returns:
attributes

getDescription

public String getDescription()
Return this subject's description.

Specified by:
getDescription in interface edu.internet2.middleware.subject.Subject
Returns:
description

getId

public String getId()
Return the subject id.

Specified by:
getId in interface edu.internet2.middleware.subject.Subject
Returns:
id

getName

public String getName()
Return the subject's name.

Specified by:
getName in interface edu.internet2.middleware.subject.Subject
Returns:
the name

getSource

public edu.internet2.middleware.subject.Source getSource()
                                                  throws IllegalStateException
Return the source.

NOTE: The current implementation is very crude and inefficient. It attempts to query for the subject to identify the source.

Specified by:
getSource in interface edu.internet2.middleware.subject.Subject
Returns:
the source
Throws:
IllegalStateException - if source cannot be returned.
Since:
1.2.0

getType

public edu.internet2.middleware.subject.SubjectType getType()
Return this subject's SubjectType.

Specified by:
getType in interface edu.internet2.middleware.subject.Subject
Returns:
type

getTypeString

public String getTypeString()
Returns:
type string

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

setId

public void setId(String id)
Parameters:
id -

setName

public void setName(String name)
Parameters:
name -

setTypeString

public void setTypeString(String type)
Parameters:
type -

toString

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

getAttributeValueOrCommaSeparated

public String getAttributeValueOrCommaSeparated(String attributeName)
Specified by:
getAttributeValueOrCommaSeparated in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributeValueOrCommaSeparated(java.lang.String)

getAttributeValueSingleValued

public String getAttributeValueSingleValued(String attributeName)
Specified by:
getAttributeValueSingleValued in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributeValueSingleValued(java.lang.String)

getSourceId

public String getSourceId()
Specified by:
getSourceId in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getSourceId()

getTypeName

public String getTypeName()
Specified by:
getTypeName in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getTypeName()

getAttributes

public Map<String,Set<String>> getAttributes()
Specified by:
getAttributes in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributes()

getAttributeValue

public String getAttributeValue(String attributeName,
                                boolean excludeInternalAttributes)
Specified by:
getAttributeValue in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributeValue(java.lang.String, boolean)

getAttributeValueOrCommaSeparated

public String getAttributeValueOrCommaSeparated(String attributeName,
                                                boolean excludeInternalAttributes)
Specified by:
getAttributeValueOrCommaSeparated in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributeValueOrCommaSeparated(java.lang.String, boolean)

getAttributeValueSingleValued

public String getAttributeValueSingleValued(String attributeName,
                                            boolean excludeInternalAttributes)
Specified by:
getAttributeValueSingleValued in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributeValueSingleValued(java.lang.String, boolean)

getAttributeValues

public Set<String> getAttributeValues(String attributeName,
                                      boolean excludeInternalAttributes)
Specified by:
getAttributeValues in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributeValues(java.lang.String, boolean)

getAttributes

public Map<String,Set<String>> getAttributes(boolean excludeInternalAttributes)
Specified by:
getAttributes in interface edu.internet2.middleware.subject.Subject
See Also:
Subject.getAttributes(boolean)