edu.internet2.middleware.grouper
Class Stem

java.lang.Object
  extended by edu.internet2.middleware.grouper.GrouperAPI
      extended by edu.internet2.middleware.grouper.Stem
All Implemented Interfaces:
AttributeAssignable, GrouperSetElement, HibGrouperLifecycle, Hib3GrouperVersioned, GrouperCloneable, GrouperHasContext, GrouperId, GrouperObject, Owner, GrouperUtil.FieldValuable, XmlImportable<Stem>, XmlImportableBase<Stem>, Serializable, Comparable<Stem>, org.hibernate.classic.Lifecycle

public class Stem
extends GrouperAPI
implements GrouperHasContext, Owner, Hib3GrouperVersioned, Comparable<Stem>, XmlImportable<Stem>, AttributeAssignable, GrouperSetElement, GrouperObject

A namespace within the Groups Registry.

Version:
$Id: Stem.java,v 1.209 2009-12-15 06:47:06 mchyzer Exp $
Author:
blair christensen.
See Also:
Serialized Form

Nested Class Summary
static class Stem.Scope
          Search scope: one-level or subtree.
 
Field Summary
static String COLUMN_ALTERNATE_NAME
          an alternate name for this stem
static String COLUMN_CONTEXT_ID
          context id column name
static String COLUMN_CREATE_TIME
          id col in db
static String COLUMN_CREATOR_ID
          col
static String COLUMN_DESCRIPTION
          id col in db
static String COLUMN_DISPLAY_EXTENSION
          id col in db
static String COLUMN_DISPLAY_NAME
          col
static String COLUMN_EXTENSION
          id col in db
static String COLUMN_HIBERNATE_VERSION_NUMBER
          column for hibernate version number
static String COLUMN_ID
          id col in db
static String COLUMN_ID_INDEX
          unique number for this stem
static String COLUMN_LAST_MEMBERSHIP_CHANGE
          timestamp of the last membership change for this group
static String COLUMN_MODIFIER_ID
          id col in db
static String COLUMN_MODIFY_TIME
          id col in db
static String COLUMN_NAME
          col
static String COLUMN_OLD_ID
          old id col for id conversion
static String COLUMN_OLD_UUID
          old uuid id col for id conversion
static String COLUMN_PARENT_STEM
          col
static String COLUMN_UUID
          uuid col in db (not used anymore)
static String DELIM
          Hierarchy delimiter.
static String FIELD_ALTERNATE_NAME_DB
          constant for field name for: alternateNameDb
static String FIELD_CREATE_TIME
          constant for field name for: createTime
static String FIELD_CREATOR_UUID
          constant for field name for: creatorUUID
static String FIELD_DB_VERSION
          constant for field name for: dbVersion
static String FIELD_DESCRIPTION
          constant for field name for: description
static String FIELD_DISPLAY_EXTENSION
          constant for field name for: displayExtension
static String FIELD_DISPLAY_NAME
          constant for field name for: displayName
static String FIELD_EXTENSION
          constant for field name for: extension
static String FIELD_ID_INDEX
          constant for field name for: idIndex
static String FIELD_LAST_MEMBERSHIP_CHANGE_DB
          constant for field name for: lastMembershipChangeDb
static String FIELD_MODIFIER_UUID
          constant for field name for: modifierUUID
static String FIELD_MODIFY_TIME
          constant for field name for: modifyTime
static String FIELD_NAME
          constant for field name for: name
static String FIELD_PARENT_UUID
          constant for field name for: parentUuid
static String FIELD_UUID
          constant for field name for: uuid
static String ROOT_INT
          root int
static String ROOT_NAME
          Default name of root stem.
static String TABLE_GROUPER_STEMS
          table for stems table in the db
static String VALIDATION_STEM_DESCRIPTION_TOO_LONG_KEY
           
static String VALIDATION_STEM_DISPLAY_EXTENSION_TOO_LONG_KEY
           
static String VALIDATION_STEM_DISPLAY_NAME_TOO_LONG_KEY
           
static String VALIDATION_STEM_EXTENSION_TOO_LONG_KEY
           
static String VALIDATION_STEM_NAME_TOO_LONG_KEY
           
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
Stem()
           
 
Method Summary
 String __getId()
          if of this object
 String __getName()
          name of this object (for logging)
static Stem _createStemAndParentStemsIfNotExist(GrouperSession grouperSession, String stemName, String stemDisplayNameForInserts)
          create stems and parents if not exist.
 void addAlternateName(String alternateName)
          Add an alternate name for this stem.
 AttributeDef addChildAttributeDef(String extension, AttributeDefType attributeDefType)
          Add a new attribute def to the registry.
 AttributeDefName addChildAttributeDefName(AttributeDef attributeDef, String extension, String displayExtension)
          Add a new attribute def to the registry.
 AttributeDefName addChildAttributeDefName(AttributeDef attributeDef, String extension, String displayExtension, String uuid)
          Add a new attribute def to the registry.
 Group addChildGroup(String extension, String displayExtension)
          Add a new group to the registry.
 Role addChildRole(String extension, String displayExtension)
          Add a new role to the registry.
 Stem addChildStem(String extension, String displayExtension)
          Add a new stem to the registry.
 Stem addChildStem(String extension, String displayExtension, String uuid, boolean failIfExists)
          Add a new stem to the registry.
 boolean assignIdIndex(long theIdIndex)
          assign different id index
 boolean canHavePrivilege(edu.internet2.middleware.subject.Subject subject, String privilegeOrListName, boolean secure)
          see if the subject has a privilege or another privilege that implies this privilege.
 Stem clone()
          deep clone the fields in this object
 int compareTo(Stem that)
           
 Stem copy(Stem stem)
          Copy this stem to another Stem.
 Stem dbVersion()
          save the state when retrieving from DB
 Set<String> dbVersionDifferentFields()
          note, these are massaged so that name, extension, etc look like normal fields.
 void dbVersionReset()
          take a snapshot of the data since this is what is in the db
 void delete()
          Delete this stem from the Groups Registry.
 boolean deleteAlternateName(String alternateName)
          Delete the specified alternate name.
static boolean deleteOccuring()
          see if we are in the middle of a delete (e.g.
 boolean equals(Object other)
           
 String getAlternateName()
          Returns the alternate name for the stem.
 String getAlternateNameDb()
          Returns the alternate name for the stem.
 Set<String> getAlternateNames()
          Returns the alternate names for the stem.
 AttributeAssignStemDelegate getAttributeDelegate()
          get the logic delegate
 AttributeValueDelegate getAttributeValueDelegate()
          this delegate works on attributes and values at the same time
 Set getChildGroups()
          Get groups that are immediate children of this stem.
 Set<Group> getChildGroups(Privilege[] privileges, Stem.Scope scope)
          Deprecated. use the overload
 Set<Group> getChildGroups(Stem.Scope scope)
          Get groups that are children of this stem.
 Set<Group> getChildGroups(Stem.Scope scope, Set<Privilege> inPrivSet, QueryOptions queryOptions)
          Get groups that are children of this stem.
 Set<Group> getChildGroups(Stem.Scope scope, Set<Privilege> inPrivSet, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups)
          Get groups that are children of this stem.
 Set<Group> getChildMembershipGroups(Stem.Scope scope, Set<Privilege> inPrivSet, QueryOptions queryOptions)
          Get groups that are children of this stem and there is a list membership.
 Set<Stem> getChildStems()
          Get stems that are immediate children of this stem.
 Set<Stem> getChildStems(Privilege[] privileges, Stem.Scope scope)
          get child stems
 Set<Stem> getChildStems(Stem.Scope scope)
          Get stems that are children of this stem.
 Set<Stem> getChildStems(Stem.Scope scope, QueryOptions queryOptions)
          Get stems that are children of this stem.
 Set<Stem> getChildStems(Stem.Scope scope, Set<Privilege> inPrivSet, QueryOptions queryOptions)
          Get groups that are children of this stem.
 String getContextId()
          context id of the transaction
 edu.internet2.middleware.subject.Subject getCreateSubject()
          Get subject that created this stem.
 Date getCreateTime()
          Get creation time for this stem.
 long getCreateTimeLong()
           
 Set getCreators()
          Get subjects with CREATE privilege on this stem.
 String getCreatorUuid()
           
 String getDescription()
          Get stem description.
 String getDescriptionDb()
           
 String getDisplayExtension()
          Get stem displayExtension.
 String getDisplayExtensionDb()
           
 String getDisplayName()
          Get stem displayName.
 String getDisplayNameDb()
           
 String getExtension()
          Get stem extension.
 String getExtensionDb()
           
 String getId()
          id is same as uuid
 Long getIdIndex()
          id of the group as a unique integer
 Timestamp getLastMembershipChange()
          when the last member has changed
 Long getLastMembershipChangeDb()
          when the last member has changed, used by hibernate
 String getModifierUuid()
           
 edu.internet2.middleware.subject.Subject getModifySubject()
          Get subject that last modified this stem.
 Date getModifyTime()
          Get last modified time for this stem.
 long getModifyTimeLong()
           
 String getName()
          Get stem name.
 String getNameDb()
           
 Stem getParentStem()
          Get parent stem.
 String getParentStemName()
          get the name of the parent stem
 String getParentUuid()
           
 Set<NamingPrivilege> getPrivs(edu.internet2.middleware.subject.Subject subj)
          Get privileges that the specified subject has on this stem.
 Set getStemAdmins()
          Get subjects with STEM_ADMIN privilege on this stem.
 Set getStemAttrReaders()
          Get subjects with STEM_ATTR_READ privilege on this stem.
 Set getStemAttrUpdaters()
          Get subjects with STEM_ATTR_UPDATE privilege on this stem.
 Set getStemmers()
          Get subjects with STEM privilege on this stem.
 String getUuid()
           
 void grantPriv(edu.internet2.middleware.subject.Subject subj, Privilege priv)
          Grant a privilege on this stem.
 boolean grantPriv(edu.internet2.middleware.subject.Subject subj, Privilege priv, boolean exceptionIfAlreadyMember)
          Grant a privilege on this stem.
 boolean grantPrivs(edu.internet2.middleware.subject.Subject subject, boolean stemAdminChecked, boolean createChecked, boolean attrReadChecked, boolean attrUpdateChecked, boolean revokeIfUnchecked)
          grant privs to stem
 boolean hasCreate(edu.internet2.middleware.subject.Subject subj)
          Check whether a subject has the CREATE privilege on this stem.
 int hashCode()
           
 boolean hasPrivilege(edu.internet2.middleware.subject.Subject subject, String privilegeOrListName)
          see if the subject has a privilege
 boolean hasStem(edu.internet2.middleware.subject.Subject subj)
          Check whether a member has the STEM privilege on this stem.
 boolean hasStemAdmin(edu.internet2.middleware.subject.Subject subj)
          Check whether a member has the STEM_ADMIN privilege on this stem.
 boolean hasStemAttrRead(edu.internet2.middleware.subject.Subject subj)
          Check whether a subject has the STEM_ATTR_READ privilege on this stem.
 boolean hasStemAttrUpdate(edu.internet2.middleware.subject.Subject subj)
          Check whether a subject has the STEM_ATTR_UPDATE privilege on this stem.
 AttributeDef internal_addChildAttributeDef(GrouperSession session, String extn, String id, AttributeDefType attributeDefType, String description)
           
 AttributeDefName internal_addChildAttributeDefName(GrouperSession session, AttributeDef attributeDef, String extension, String displayExtension, String id, String description)
           
 Role internal_addChildEntity(String extension, String displayExtension, String uuid)
          Add a new role to the registry.
 Group internal_addChildGroup(String extn, String dExtn, String uuid)
          add child group with uuid
 Group internal_addChildGroup(String extn, String dExtn, String uuid, String description, Set<GroupType> types, Map<String,String> attributes, boolean addDefaultGroupPrivileges, TypeOfGroup typeOfGroup, boolean checkSecurity)
           
 Group internal_addChildGroup(String extn, String dExtn, String uuid, TypeOfGroup typeOfGroup)
          add child group with uuid
 Role internal_addChildRole(String extension, String displayExtension, String uuid)
          Add a new role to the registry.
 Stem internal_addChildStem(String extn, String dExtn, String uuid)
          add child stem with uuid
static Stem internal_addRootStem(GrouperSession s, boolean[] changed)
          add root stem
 boolean internal_grantPriv(edu.internet2.middleware.subject.Subject subj, Privilege priv, boolean exceptionIfAlreadyMember, String uuid)
          Grant a privilege on this stem.
 void internal_setModified()
          set modified
 boolean isChildGroup(Group group)
          TODO 20070813 make public?
 boolean isChildStem(Stem stem)
          TODO 20070813 make public?
 boolean isRootStem()
           
 boolean matchesLowerSearchStrings(Set<String> filterStrings)
          see if this object matches the filter strings
 void move(Stem stem)
          Move this stem to another Stem.
 void obliterate(boolean printOutput, boolean testOnly)
          Delete this stem from the Groups Registry including all sub objects.
 void onPostDelete(HibernateSession hibernateSession)
          after a delete occurs
 void onPostSave(HibernateSession hibernateSession)
          after a save (insert) occurs
 void onPostUpdate(HibernateSession hibernateSession)
          after an update occurs
 void onPreDelete(HibernateSession hibernateSession)
          before a delete (insert) occurs
 void onPreSave(HibernateSession hibernateSession)
          before a save (insert) occurs
 void onPreUpdate(HibernateSession hibernateSession)
          before an update occurs
 void revokePriv(Privilege priv)
          Revoke all privileges of the specified type on this stem.
 void revokePriv(edu.internet2.middleware.subject.Subject subj, Privilege priv)
          Revoke a privilege on this stem.
 boolean revokePriv(edu.internet2.middleware.subject.Subject subj, Privilege priv, boolean exceptionIfAlreadyRevoked)
          Revoke a privilege on this stem.
static Stem saveStem(GrouperSession grouperSession, String stemNameToEdit, String uuid, String name, String displayExtension, String description, SaveMode saveMode, boolean createParentStemsIfNotExist)
           create or update a stem.
 void setAlternateNameDb(String alternateName)
          Set the group's alternate name Used by hibernate.
 void setContextId(String contextId1)
          context id of the transaction
 void setCreateTimeLong(long createTime)
           
 void setCreatorUuid(String creatorUUID)
           
 void setDescription(String value)
          Set stem description.
 void setDescriptionDb(String description)
           
 void setDisplayExtension(String value)
          Set displayExtension.
 void setDisplayExtensionDb(String displayExtension)
           
 void setDisplayName(String displayName)
           
 void setDisplayNameDb(String displayName)
           
 void setExtension(String value)
          Set extension.
 void setExtension(String value, boolean assignAlternateName)
          Set extension.
 void setExtensionDb(String extension)
           
 void setIdIndex(Long idIndex1)
          id of the group as a unique integer
 void setLastMembershipChangeDb(Long theMembershipLastChange)
          when the last member has changed, used by hibernate
 void setModifierUuid(String modifierUUID)
           
 void setModifyTimeLong(long modifyTime)
           
 void setName(String name)
           
 void setNameDb(String name)
           
 void setParentUuid(String parentUUID)
           
 void setUuid(String uuid)
           
 void store()
          will be implemented soon
 String toString()
           
 String toStringDb()
           
 void validate()
           
 void xmlCopyBusinessPropertiesToExisting(Stem existingRecord)
          copy business (non update) properties to an existing record
 boolean xmlDifferentBusinessProperties(Stem other)
          see if the non update cols are different (e.g.
 boolean xmlDifferentUpdateProperties(Stem other)
          see if the update cols are different (e.g.
 String xmlGetId()
          set id key in db
 Stem xmlRetrieveByIdOrKey()
          retrieve from db by id or key.
 Stem xmlSaveBusinessProperties(Stem existingRecord)
          save the business properties (not update properties)
 void xmlSaveUpdateProperties()
          save the udpate properties (e.g.
 void xmlSetId(String theId)
          set id key in db
 XmlExportStem xmlToExportStem(GrouperVersion grouperVersion)
          convert to xml bean for export
 String xmlToString()
          convert to string for log
 
Methods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersionClear, dbVersionIsDifferent, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onSave, onUpdate, setHibernateVersionNumber
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VALIDATION_STEM_NAME_TOO_LONG_KEY

public static final String VALIDATION_STEM_NAME_TOO_LONG_KEY
See Also:
Constant Field Values

VALIDATION_STEM_DISPLAY_NAME_TOO_LONG_KEY

public static final String VALIDATION_STEM_DISPLAY_NAME_TOO_LONG_KEY
See Also:
Constant Field Values

VALIDATION_STEM_EXTENSION_TOO_LONG_KEY

public static final String VALIDATION_STEM_EXTENSION_TOO_LONG_KEY
See Also:
Constant Field Values

VALIDATION_STEM_DISPLAY_EXTENSION_TOO_LONG_KEY

public static final String VALIDATION_STEM_DISPLAY_EXTENSION_TOO_LONG_KEY
See Also:
Constant Field Values

VALIDATION_STEM_DESCRIPTION_TOO_LONG_KEY

public static final String VALIDATION_STEM_DESCRIPTION_TOO_LONG_KEY
See Also:
Constant Field Values

TABLE_GROUPER_STEMS

public static final String TABLE_GROUPER_STEMS
table for stems table in the db

See Also:
Constant Field Values

COLUMN_UUID

public static final String COLUMN_UUID
uuid col in db (not used anymore)

See Also:
Constant Field Values

COLUMN_PARENT_STEM

public static final String COLUMN_PARENT_STEM
col

See Also:
Constant Field Values

COLUMN_NAME

public static final String COLUMN_NAME
col

See Also:
Constant Field Values

COLUMN_DISPLAY_NAME

public static final String COLUMN_DISPLAY_NAME
col

See Also:
Constant Field Values

COLUMN_CREATOR_ID

public static final String COLUMN_CREATOR_ID
col

See Also:
Constant Field Values

COLUMN_ID

public static final String COLUMN_ID
id col in db

See Also:
Constant Field Values

COLUMN_ID_INDEX

public static final String COLUMN_ID_INDEX
unique number for this stem

See Also:
Constant Field Values

COLUMN_CREATE_TIME

public static final String COLUMN_CREATE_TIME
id col in db

See Also:
Constant Field Values

COLUMN_MODIFIER_ID

public static final String COLUMN_MODIFIER_ID
id col in db

See Also:
Constant Field Values

COLUMN_MODIFY_TIME

public static final String COLUMN_MODIFY_TIME
id col in db

See Also:
Constant Field Values

COLUMN_DISPLAY_EXTENSION

public static final String COLUMN_DISPLAY_EXTENSION
id col in db

See Also:
Constant Field Values

COLUMN_EXTENSION

public static final String COLUMN_EXTENSION
id col in db

See Also:
Constant Field Values

COLUMN_DESCRIPTION

public static final String COLUMN_DESCRIPTION
id col in db

See Also:
Constant Field Values

COLUMN_ALTERNATE_NAME

public static final String COLUMN_ALTERNATE_NAME
an alternate name for this stem

See Also:
Constant Field Values

COLUMN_HIBERNATE_VERSION_NUMBER

public static final String COLUMN_HIBERNATE_VERSION_NUMBER
column for hibernate version number

See Also:
Constant Field Values

COLUMN_CONTEXT_ID

public static final String COLUMN_CONTEXT_ID
context id column name

See Also:
Constant Field Values

COLUMN_OLD_ID

public static final String COLUMN_OLD_ID
old id col for id conversion

See Also:
Constant Field Values

COLUMN_OLD_UUID

public static final String COLUMN_OLD_UUID
old uuid id col for id conversion

See Also:
Constant Field Values

COLUMN_LAST_MEMBERSHIP_CHANGE

public static final String COLUMN_LAST_MEMBERSHIP_CHANGE
timestamp of the last membership change for this group

See Also:
Constant Field Values

FIELD_ALTERNATE_NAME_DB

public static final String FIELD_ALTERNATE_NAME_DB
constant for field name for: alternateNameDb

See Also:
Constant Field Values

FIELD_CREATE_TIME

public static final String FIELD_CREATE_TIME
constant for field name for: createTime

See Also:
Constant Field Values

FIELD_CREATOR_UUID

public static final String FIELD_CREATOR_UUID
constant for field name for: creatorUUID

See Also:
Constant Field Values

FIELD_DB_VERSION

public static final String FIELD_DB_VERSION
constant for field name for: dbVersion

See Also:
Constant Field Values

FIELD_DESCRIPTION

public static final String FIELD_DESCRIPTION
constant for field name for: description

See Also:
Constant Field Values

FIELD_DISPLAY_EXTENSION

public static final String FIELD_DISPLAY_EXTENSION
constant for field name for: displayExtension

See Also:
Constant Field Values

FIELD_DISPLAY_NAME

public static final String FIELD_DISPLAY_NAME
constant for field name for: displayName

See Also:
Constant Field Values

FIELD_EXTENSION

public static final String FIELD_EXTENSION
constant for field name for: extension

See Also:
Constant Field Values

FIELD_ID_INDEX

public static final String FIELD_ID_INDEX
constant for field name for: idIndex

See Also:
Constant Field Values

FIELD_MODIFIER_UUID

public static final String FIELD_MODIFIER_UUID
constant for field name for: modifierUUID

See Also:
Constant Field Values

FIELD_MODIFY_TIME

public static final String FIELD_MODIFY_TIME
constant for field name for: modifyTime

See Also:
Constant Field Values

FIELD_NAME

public static final String FIELD_NAME
constant for field name for: name

See Also:
Constant Field Values

FIELD_PARENT_UUID

public static final String FIELD_PARENT_UUID
constant for field name for: parentUuid

See Also:
Constant Field Values

FIELD_UUID

public static final String FIELD_UUID
constant for field name for: uuid

See Also:
Constant Field Values

FIELD_LAST_MEMBERSHIP_CHANGE_DB

public static final String FIELD_LAST_MEMBERSHIP_CHANGE_DB
constant for field name for: lastMembershipChangeDb

See Also:
Constant Field Values

DELIM

public static final String DELIM
Hierarchy delimiter.

See Also:
Constant Field Values

ROOT_NAME

public static final String ROOT_NAME
Default name of root stem.

See Also:
Constant Field Values

ROOT_INT

public static final String ROOT_INT
root int

See Also:
Constant Field Values
Constructor Detail

Stem

public Stem()
Method Detail

getParentStemName

public String getParentStemName()
get the name of the parent stem

Returns:
the name of the parent stem

getId

public String getId()
id is same as uuid

Specified by:
getId in interface GrouperId
Returns:
id

compareTo

public int compareTo(Stem that)
Specified by:
compareTo in interface Comparable<Stem>
See Also:
Comparable.compareTo(java.lang.Object)

getAttributeDelegate

public AttributeAssignStemDelegate getAttributeDelegate()
Description copied from interface: AttributeAssignable
get the logic delegate

Specified by:
getAttributeDelegate in interface AttributeAssignable
Returns:
the delegate

getAttributeValueDelegate

public AttributeValueDelegate getAttributeValueDelegate()
this delegate works on attributes and values at the same time

Specified by:
getAttributeValueDelegate in interface AttributeAssignable
Returns:
the delegate

getContextId

public String getContextId()
context id of the transaction

Returns:
context id

setContextId

public void setContextId(String contextId1)
context id of the transaction

Specified by:
setContextId in interface GrouperHasContext
Parameters:
contextId1 -

addChildGroup

public Group addChildGroup(String extension,
                           String displayExtension)
                    throws GroupAddException,
                           InsufficientPrivilegeException
Add a new group to the registry.
 // Add a group with the extension "edu" beneath this stem.
 try {
   Group edu = ns.addChildGroup("edu", "edu domain");
 }
 catch (GroupAddException eGA) {
   // Group not added
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to add group
 }
 

Parameters:
extension - Group's extension
displayExtension - Groups' displayExtension
Returns:
The added Group
Throws:
GroupAddException
InsufficientPrivilegeException

addChildAttributeDef

public AttributeDef addChildAttributeDef(String extension,
                                         AttributeDefType attributeDefType)
                                  throws InsufficientPrivilegeException
Add a new attribute def to the registry.

Parameters:
extension - attributeDef's extension
attributeDefType -
Returns:
The added AttributeDef
Throws:
InsufficientPrivilegeException

addChildAttributeDefName

public AttributeDefName addChildAttributeDefName(AttributeDef attributeDef,
                                                 String extension,
                                                 String displayExtension)
                                          throws InsufficientPrivilegeException
Add a new attribute def to the registry.

Parameters:
attributeDef - is the definition of this attribute
extension - attributeDef's extension
displayExtension -
Returns:
The added AttributeDef
Throws:
InsufficientPrivilegeException

addChildAttributeDefName

public AttributeDefName addChildAttributeDefName(AttributeDef attributeDef,
                                                 String extension,
                                                 String displayExtension,
                                                 String uuid)
                                          throws InsufficientPrivilegeException
Add a new attribute def to the registry.

Parameters:
attributeDef - is the definition of this attribute
extension - attributeDef's extension
displayExtension -
Returns:
The added AttributeDef
Throws:
InsufficientPrivilegeException

addChildStem

public Stem addChildStem(String extension,
                         String displayExtension,
                         String uuid,
                         boolean failIfExists)
                  throws InsufficientPrivilegeException,
                         StemAddException
Add a new stem to the registry.
 // Add a stem with the extension "edu" beneath this stem.
 try {
   Stem edu = ns.addChildStem("edu", "edu domain");
 }
 catch (StemAddException e) {
   // Stem not added
 }
 

Parameters:
extension - Stem's extension
displayExtension - Stem' displayExtension
uuid - if creating this is the uuid
failIfExists - throws StemAddException if exists, else just return the existing stem
Returns:
The added Stem
Throws:
InsufficientPrivilegeException
StemAddException

addChildStem

public Stem addChildStem(String extension,
                         String displayExtension)
                  throws InsufficientPrivilegeException,
                         StemAddException
Add a new stem to the registry.
 // Add a stem with the extension "edu" beneath this stem.
 try {
   Stem edu = ns.addChildStem("edu", "edu domain");
 }
 catch (StemAddException e) {
   // Stem not added
 }
 

Parameters:
extension - Stem's extension
displayExtension - Stem' displayExtension
Returns:
The added Stem
Throws:
InsufficientPrivilegeException
StemAddException

deleteOccuring

public static boolean deleteOccuring()
see if we are in the middle of a delete (e.g. for hook)

Returns:
true if delete is occurring

delete

public void delete()
            throws InsufficientPrivilegeException,
                   StemDeleteException
Delete this stem from the Groups Registry.
 try {
   ns.delete();
 }
 catch (InsufficientPrivilegeException eIP) {
   // not privileged to delete stem
 }
 catch (StemDeleteException eSD) {
   // unable to delete stem
 }
 

Throws:
InsufficientPrivilegeException
StemDeleteException

getChildGroups

public Set getChildGroups()
Get groups that are immediate children of this stem.

Returns:
Set of Group objects.
See Also:
getChildGroups(Scope)

getChildGroups

public Set<Group> getChildGroups(Stem.Scope scope)
                          throws IllegalArgumentException
Get groups that are children of this stem.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
Returns:
Child groups.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildGroups

public Set<Group> getChildGroups(Stem.Scope scope,
                                 Set<Privilege> inPrivSet,
                                 QueryOptions queryOptions)
Get groups that are children of this stem.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
inPrivSet - set of privileges that the grouper session needs one of for the row to be returned. AccessPrivilege has some pre-baked constant sets for use here
queryOptions -
Returns:
Child groups.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildGroups

public Set<Group> getChildGroups(Stem.Scope scope,
                                 Set<Privilege> inPrivSet,
                                 QueryOptions queryOptions,
                                 Set<TypeOfGroup> typeOfGroups)
                          throws IllegalArgumentException
Get groups that are children of this stem.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
inPrivSet - set of privileges that the grouper session needs one of for the row to be returned. AccessPrivilege has some pre-baked constant sets for use here
typeOfGroups - is the type of groups to get, or null for all
queryOptions -
Returns:
Child groups.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildMembershipGroups

public Set<Group> getChildMembershipGroups(Stem.Scope scope,
                                           Set<Privilege> inPrivSet,
                                           QueryOptions queryOptions)
                                    throws IllegalArgumentException
Get groups that are children of this stem and there is a list membership.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
inPrivSet - set of privileges that the grouper session needs one of for the row to be returned. AccessPrivilege has some pre-baked constant sets for use here
queryOptions -
Returns:
Child groups.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildStems

public Set<Stem> getChildStems(Stem.Scope scope,
                               Set<Privilege> inPrivSet,
                               QueryOptions queryOptions)
                        throws IllegalArgumentException
Get groups that are children of this stem.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
inPrivSet - set of privileges that the grouper session needs one of for the row to be returned. AccessPrivilege has some pre-baked constant sets for use here
queryOptions -
Returns:
Child groups.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildGroups

@Deprecated
public Set<Group> getChildGroups(Privilege[] privileges,
                                            Stem.Scope scope)
                          throws IllegalArgumentException
Deprecated. use the overload

get child groups

Parameters:
privileges - privs
scope - all or direct
Returns:
Child groups where current subject has any of the specified privileges.
Throws:
IllegalArgumentException - if any parameter is null.
Since:
1.2.1

getChildStems

public Set<Stem> getChildStems()
Get stems that are immediate children of this stem.

Returns:
Set of Stem objects.
See Also:
getChildStems(Scope)

getChildStems

public Set<Stem> getChildStems(Stem.Scope scope)
Get stems that are children of this stem.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
Returns:
Child stems.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildStems

public Set<Stem> getChildStems(Stem.Scope scope,
                               QueryOptions queryOptions)
                        throws IllegalArgumentException
Get stems that are children of this stem.

Parameters:
scope - of search: Scope.ONE or Scope.SUB
queryOptions -
Returns:
Child stems.
Throws:
IllegalArgumentException - if null scope.
Since:
1.2.1

getChildStems

public Set<Stem> getChildStems(Privilege[] privileges,
                               Stem.Scope scope)
                        throws IllegalArgumentException
get child stems

Parameters:
privileges - privs
scope - all or direct
Returns:
Child (or deeper) stems where current subject has any of the specified privileges. Parent stems of grandchild (or deeper) groups where the current subject has any of the specified privileges.
Throws:
IllegalArgumentException - if any parameter is null.
Since:
1.2.1

getCreateSubject

public edu.internet2.middleware.subject.Subject getCreateSubject()
                                                          throws edu.internet2.middleware.subject.SubjectNotFoundException
Get subject that created this stem.
 // Get creator of this stem.
 try {
   Subject creator = ns.getCreateSubject();
 }
 catch (SubjectNotFoundException e) {
   // Couldn't find subject
 }
 

Returns:
Subject that created this stem.
Throws:
edu.internet2.middleware.subject.SubjectNotFoundException

getCreateTime

public Date getCreateTime()
Get creation time for this stem.
 // Get create time.
 Date created = ns.getCreateTime();
 

Returns:
Date that this stem was created.

getCreators

public Set getCreators()
                throws GrouperException
Get subjects with CREATE privilege on this stem.
 Set creators = ns.getCreators();
 

Returns:
Set of Subject objects
Throws:
GrouperException

getDescription

public String getDescription()
Get stem description.
 // Get description
 String description = ns.getDescription();
 

Specified by:
getDescription in interface GrouperObject
Returns:
Stem description.

getDisplayExtension

public String getDisplayExtension()
Get stem displayExtension.
 // Get displayExtension
 String displayExtn = ns.getDisplayExtension();
 

Returns:
Stem displayExtension.

getDisplayName

public String getDisplayName()
Get stem displayName.
 // Get displayName
 String displayName = ns.getDisplayName();
 

Specified by:
getDisplayName in interface GrouperObject
Returns:
Stem displayName.

getExtension

public String getExtension()
Get stem extension.
 // Get extension
 String extension = ns.getExtension();
 

Returns:
Stem extension.

getModifySubject

public edu.internet2.middleware.subject.Subject getModifySubject()
                                                          throws edu.internet2.middleware.subject.SubjectNotFoundException
Get subject that last modified this stem.
 // Get last modifier of this stem.
 try {
   Subject modifier = ns.getModifySubject();
 }
 catch (SubjectNotFoundException e) {
   // Couldn't find subject
 }
 

Returns:
Subject that last modified this stem.
Throws:
edu.internet2.middleware.subject.SubjectNotFoundException

getModifyTime

public Date getModifyTime()
Get last modified time for this stem.
 // Get last modified time.
 Date modified = ns.getModifyTime();
 

Returns:
Date that this stem was last modified.

getName

public String getName()
Get stem name.
 // Get name
 String name = ns.getName();
 

Specified by:
getName in interface GrouperObject
Specified by:
getName in interface Owner
Returns:
Stem name.

getParentStem

public Stem getParentStem()
                   throws StemNotFoundException
Get parent stem.
 // Get parent
 Stem parent = ns.getParentStem();
 

Returns:
Parent Stem.
Throws:
StemNotFoundException - if stem not found

getAlternateNameDb

public String getAlternateNameDb()
Returns the alternate name for the stem. Used by hibernate.

Returns:
the alternate name

getAlternateName

public String getAlternateName()
Returns the alternate name for the stem. If multiple, returns the first one

Returns:
the alternate name

setAlternateNameDb

public void setAlternateNameDb(String alternateName)
Set the group's alternate name Used by hibernate.

Parameters:
alternateName -

getAlternateNames

public Set<String> getAlternateNames()
Returns the alternate names for the stem. Only one alternate name is supported currently, so a Set of size 0 or 1 will be returned.

Returns:
Set of alternate names.

addAlternateName

public void addAlternateName(String alternateName)
Add an alternate name for this stem. Only one alternate name is supported currently, so this will replace any existing alternate name. This won't get saved until you call store().

Parameters:
alternateName -

deleteAlternateName

public boolean deleteAlternateName(String alternateName)
Delete the specified alternate name. This won't get saved until you call store().

Parameters:
alternateName -
Returns:
false if the stem does not have the specified alternate name

getPrivs

public Set<NamingPrivilege> getPrivs(edu.internet2.middleware.subject.Subject subj)
Get privileges that the specified subject has on this stem.
 Set privs = ns.getPrivs(subj);
 

Parameters:
subj - Get privileges for this subject.
Returns:
Set of NamingPrivilege objects.

getStemmers

public Set getStemmers()
                throws GrouperException
Get subjects with STEM privilege on this stem.
 Set stemmers = ns.getStemmers();
 

Returns:
Set of Subject objects
Throws:
GrouperException

getStemAdmins

public Set getStemAdmins()
                  throws GrouperException
Get subjects with STEM_ADMIN privilege on this stem.
 Set stemAdmins = ns.getStemAdmins();
 

Returns:
Set of Subject objects
Throws:
GrouperException

getStemAttrReaders

public Set getStemAttrReaders()
                       throws GrouperException
Get subjects with STEM_ATTR_READ privilege on this stem.
 Set subjects = ns.getStemAttrReaders();
 

Returns:
Set of Subject objects
Throws:
GrouperException

getStemAttrUpdaters

public Set getStemAttrUpdaters()
                        throws GrouperException
Get subjects with STEM_ATTR_UPDATE privilege on this stem.
 Set subjects = ns.getStemAttrUpdaters();
 

Returns:
Set of Subject objects
Throws:
GrouperException

getUuid

public String getUuid()
Specified by:
getUuid in interface Owner
Returns:
uuid

grantPriv

public void grantPriv(edu.internet2.middleware.subject.Subject subj,
                      Privilege priv)
               throws GrantPrivilegeException,
                      InsufficientPrivilegeException,
                      SchemaException
Grant a privilege on this stem.
 try {
   ns.grantPriv(subj, NamingPrivilege.CREATE);
 }
 catch (GrantPrivilegeException e) {
   // Error granting privilege
 }
 

Parameters:
subj - Grant privilege to this subject.
priv - Grant this privilege.
Throws:
GrantPrivilegeException
InsufficientPrivilegeException
SchemaException

grantPriv

public boolean grantPriv(edu.internet2.middleware.subject.Subject subj,
                         Privilege priv,
                         boolean exceptionIfAlreadyMember)
                  throws GrantPrivilegeException,
                         InsufficientPrivilegeException,
                         SchemaException
Grant a privilege on this stem.
 try {
   ns.grantPriv(subj, NamingPrivilege.CREATE);
 }
 catch (GrantPrivilegeException e) {
   // Error granting privilege
 }
 

Parameters:
subj - Grant privilege to this subject.
priv - Grant this privilege.
exceptionIfAlreadyMember - if false, and subject is already a member, then dont throw a MemberAddException if the member is already in the group
Returns:
false if it already existed, true if it didnt already exist
Throws:
GrantPrivilegeException
InsufficientPrivilegeException
SchemaException

internal_grantPriv

public boolean internal_grantPriv(edu.internet2.middleware.subject.Subject subj,
                                  Privilege priv,
                                  boolean exceptionIfAlreadyMember,
                                  String uuid)
                           throws GrantPrivilegeException,
                                  InsufficientPrivilegeException,
                                  SchemaException
Grant a privilege on this stem.
 try {
   ns.grantPriv(subj, NamingPrivilege.CREATE);
 }
 catch (GrantPrivilegeException e) {
   // Error granting privilege
 }
 

Parameters:
subj - Grant privilege to this subject.
priv - Grant this privilege.
exceptionIfAlreadyMember - if false, and subject is already a member, then dont throw a MemberAddException if the member is already in the group
uuid -
Returns:
false if it already existed, true if it didnt already exist
Throws:
GrantPrivilegeException
InsufficientPrivilegeException
SchemaException

hasCreate

public boolean hasCreate(edu.internet2.middleware.subject.Subject subj)
Check whether a subject has the CREATE privilege on this stem.
 if (ns.hasCreate(subj)) {
   // Has CREATE
 }
   // Does not have CREATE
 } 
 

Parameters:
subj - Check whether this subject has CREATE.
Returns:
Boolean true if the subject has CREATE.

hasStemAttrRead

public boolean hasStemAttrRead(edu.internet2.middleware.subject.Subject subj)
Check whether a subject has the STEM_ATTR_READ privilege on this stem.
 if (ns.hasStemAttrRead(subj)) {
   // Has STEM_ATTR_READ
 }
   // Does not have STEM_ATTR_READ
 } 
 

Parameters:
subj - Check whether this subject has STEM_ATTR_READ.
Returns:
Boolean true if the subject has STEM_ATTR_READ.

hasStemAttrUpdate

public boolean hasStemAttrUpdate(edu.internet2.middleware.subject.Subject subj)
Check whether a subject has the STEM_ATTR_UPDATE privilege on this stem.
 if (ns.hasStemAttrUpdate(subj)) {
   // Has STEM_ATTR_UPDATE
 }
   // Does not have STEM_ATTR_UPDATE
 } 
 

Parameters:
subj - Check whether this subject has STEM_ATTR_UPDATE.
Returns:
Boolean true if the subject has STEM_ATTR_UPDATE.

hasStem

public boolean hasStem(edu.internet2.middleware.subject.Subject subj)
Check whether a member has the STEM privilege on this stem.
 if (ns.hasStem(subj)) {
   // Has STEM
 }
   // Does not have STEM
 } 
 

Parameters:
subj - check whether this subject has STEM.
Returns:
Boolean true if the subject has STEM.

hasStemAdmin

public boolean hasStemAdmin(edu.internet2.middleware.subject.Subject subj)
Check whether a member has the STEM_ADMIN privilege on this stem.
 if (ns.hasStemAdmin(subj)) {
   // Has STEM_ADMIN
 }
   // Does not have STEM_ADMIN
 } 
 

Parameters:
subj - check whether this subject has STEM_ADMIN.
Returns:
Boolean true if the subject has STEM_ADMIN.

hasPrivilege

public boolean hasPrivilege(edu.internet2.middleware.subject.Subject subject,
                            String privilegeOrListName)
see if the subject has a privilege

Parameters:
subject -
privilegeOrListName -
Returns:
true if has privilege

isChildGroup

public boolean isChildGroup(Group group)
                     throws IllegalArgumentException
TODO 20070813 make public?

Parameters:
group - group
Returns:
True if group is child, at any depth, of this stem.
Throws:
IllegalArgumentException - if group is null.
Since:
1.2.1

isChildStem

public boolean isChildStem(Stem stem)
                    throws IllegalArgumentException
TODO 20070813 make public?

Parameters:
stem - stem
Returns:
True if stem is child, at any depth, of this stem.
Throws:
IllegalArgumentException - if stem is null.
Since:
1.2.1

isRootStem

public boolean isRootStem()
Returns:
Boolean true if this is the root stem of the Groups Registry.
Since:
1.2.0

revokePriv

public void revokePriv(Privilege priv)
                throws InsufficientPrivilegeException,
                       RevokePrivilegeException,
                       SchemaException
Revoke all privileges of the specified type on this stem.
 try {
   ns.revokePriv(NamingPrivilege.CREATE);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to revoke this privilege
 }
 catch (RevokePrivilegeException eRP) {
   // Error revoking privilege
 }
 

Parameters:
priv - Revoke this privilege.
Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException

revokePriv

public void revokePriv(edu.internet2.middleware.subject.Subject subj,
                       Privilege priv)
                throws InsufficientPrivilegeException,
                       RevokePrivilegeException,
                       SchemaException
Revoke a privilege on this stem.
 try {
   ns.revokePriv(subj, NamingPrivilege.CREATE);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to revoke this privilege
 }
 catch (RevokePrivilegeException eRP) {
   // Error revoking privilege
 }
 

Parameters:
subj - Revoke privilege from this subject.
priv - Revoke this privilege.
Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException

revokePriv

public boolean revokePriv(edu.internet2.middleware.subject.Subject subj,
                          Privilege priv,
                          boolean exceptionIfAlreadyRevoked)
                   throws InsufficientPrivilegeException,
                          RevokePrivilegeException,
                          SchemaException
Revoke a privilege on this stem.
 try {
   ns.revokePriv(subj, NamingPrivilege.CREATE);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to revoke this privilege
 }
 catch (RevokePrivilegeException eRP) {
   // Error revoking privilege
 }
 

Parameters:
subj - Revoke privilege from this subject.
priv - Revoke this privilege.
exceptionIfAlreadyRevoked - if false, and subject is already a member, then dont throw a MemberAddException if the member is already in the group
Returns:
false if it was already revoked, true if it wasnt already deleted
Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException

setDescription

public void setDescription(String value)
                    throws InsufficientPrivilegeException,
                           StemModifyException
Set stem description.
 // Set description
 try {
  ns.setDescription(value);
 }
 }
 catch (InsufficientPrivilegeException e0) {
   // Not privileged to set description
 catch (StemModifyException e1) {
   // Error setting description
 }
 

Parameters:
value - Set description to this value.
Throws:
InsufficientPrivilegeException
StemModifyException

store

public void store()
will be implemented soon


validate

public void validate()

setDisplayExtension

public void setDisplayExtension(String value)
                         throws InsufficientPrivilegeException,
                                StemModifyException
Set displayExtension.

This will also update the displayName of all child stems and groups.

 try {
  ns.setDisplayExtension(value);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to set displayExtension
 catch (StemModifyException eNSM) {
   // Error setting displayExtension
 }
 

Parameters:
value - Set displayExtension to this value.
Throws:
InsufficientPrivilegeException
StemModifyException

setExtension

public void setExtension(String value)
                  throws InsufficientPrivilegeException,
                         StemModifyException
Set extension.

This will also update the name of all child stems and groups.

 try {
  ns.setExtension(value);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to set "extension"
 catch (StemModifyException eNSM) {
   // Error setting "extension"
 }
 

Parameters:
value - Set extension to this value.
Throws:
InsufficientPrivilegeException
StemModifyException

setExtension

public void setExtension(String value,
                         boolean assignAlternateName)
                  throws InsufficientPrivilegeException,
                         StemModifyException
Set extension.

This will also update the name of all child stems and groups.

 try {
  ns.setExtension(value, true);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to set "extension"
 catch (StemModifyException eNSM) {
   // Error setting "extension"
 }
 

Parameters:
value - Set extension to this value.
assignAlternateName - Whether to add the old group and stem names as alternate names for any renamed groups and stems.
Throws:
InsufficientPrivilegeException
StemModifyException

toString

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

internal_addRootStem

public static Stem internal_addRootStem(GrouperSession s,
                                        boolean[] changed)
                                 throws GrouperException
add root stem

Parameters:
s - session
changed - if you want to know if it was added, pass in array of size one, else null
Returns:
stem
Throws:
GrouperException - is problem
Since:
1.2.0

internal_setModified

public void internal_setModified()
set modified

Since:
1.2.0

internal_addChildGroup

public Group internal_addChildGroup(String extn,
                                    String dExtn,
                                    String uuid)
                             throws GroupAddException,
                                    InsufficientPrivilegeException
add child group with uuid

Parameters:
extn - extension
dExtn - display extension
uuid - uuid
Returns:
group
Throws:
GroupAddException - if problem
InsufficientPrivilegeException - if problem
Since:
1.2.0

internal_addChildGroup

public Group internal_addChildGroup(String extn,
                                    String dExtn,
                                    String uuid,
                                    TypeOfGroup typeOfGroup)
                             throws GroupAddException,
                                    InsufficientPrivilegeException
add child group with uuid

Parameters:
extn - extension
dExtn - display extension
uuid - uuid
typeOfGroup -
Returns:
group
Throws:
GroupAddException - if problem
InsufficientPrivilegeException - if problem

internal_addChildGroup

public Group internal_addChildGroup(String extn,
                                    String dExtn,
                                    String uuid,
                                    String description,
                                    Set<GroupType> types,
                                    Map<String,String> attributes,
                                    boolean addDefaultGroupPrivileges,
                                    TypeOfGroup typeOfGroup,
                                    boolean checkSecurity)
                             throws GroupAddException,
                                    InsufficientPrivilegeException
Parameters:
extn -
dExtn -
uuid -
description -
types -
attributes -
addDefaultGroupPrivileges -
typeOfGroup - or null for default
checkSecurity -
Returns:
group
Throws:
GroupAddException
InsufficientPrivilegeException

internal_addChildAttributeDefName

public AttributeDefName internal_addChildAttributeDefName(GrouperSession session,
                                                          AttributeDef attributeDef,
                                                          String extension,
                                                          String displayExtension,
                                                          String id,
                                                          String description)
                                                   throws InsufficientPrivilegeException
Parameters:
attributeDef -
session -
extension -
displayExtension -
id -
description -
Returns:
group
Throws:
AttributeDefNameAddException
InsufficientPrivilegeException

internal_addChildAttributeDef

public AttributeDef internal_addChildAttributeDef(GrouperSession session,
                                                  String extn,
                                                  String id,
                                                  AttributeDefType attributeDefType,
                                                  String description)
                                           throws InsufficientPrivilegeException
Parameters:
session -
extn -
id -
attributeDefType -
description -
Returns:
group
Throws:
AttributeDefAddException
InsufficientPrivilegeException

internal_addChildStem

public Stem internal_addChildStem(String extn,
                                  String dExtn,
                                  String uuid)
                           throws StemAddException,
                                  InsufficientPrivilegeException
add child stem with uuid

Parameters:
extn - extension
dExtn - display extension
uuid - uuid
Returns:
the new stem
Throws:
StemAddException - if problem
InsufficientPrivilegeException - if problem
Since:
1.2.0

equals

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

getCreateTimeLong

public long getCreateTimeLong()
Returns:
create time

getCreatorUuid

public String getCreatorUuid()
Returns:
create time

getDescriptionDb

public String getDescriptionDb()
Returns:
description
Since:
1.2.0

getDisplayExtensionDb

public String getDisplayExtensionDb()
Returns:
displayExtension
Since:
1.2.0

getDisplayNameDb

public String getDisplayNameDb()
Returns:
displayName
Since:
1.2.0

getExtensionDb

public String getExtensionDb()
Returns:
extension
Since:
1.2.0

getModifierUuid

public String getModifierUuid()
Returns:
modifier uuid
Since:
1.2.0

getModifyTimeLong

public long getModifyTimeLong()
Returns:
modify time long
Since:
1.2.0

getNameDb

public String getNameDb()
Returns:
name
Since:
1.2.0

getParentUuid

public String getParentUuid()
Returns:
parent uuid
Since:
1.2.0

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
hash code
Since:
1.2.0

setCreateTimeLong

public void setCreateTimeLong(long createTime)
Parameters:
createTime -
Since:
1.2.0

setCreatorUuid

public void setCreatorUuid(String creatorUUID)
Parameters:
creatorUUID -
Since:
1.2.0

setDescriptionDb

public void setDescriptionDb(String description)
Parameters:
description -
Since:
1.2.0

setDisplayExtensionDb

public void setDisplayExtensionDb(String displayExtension)
Parameters:
displayExtension -
Since:
1.2.0

setDisplayName

public void setDisplayName(String displayName)
Parameters:
displayName -
Since:
1.2.0

setDisplayNameDb

public void setDisplayNameDb(String displayName)
Parameters:
displayName -
Since:
1.2.0

setExtensionDb

public void setExtensionDb(String extension)
Parameters:
extension -
Since:
1.2.0

setModifierUuid

public void setModifierUuid(String modifierUUID)
Parameters:
modifierUUID -
Since:
1.2.0

setModifyTimeLong

public void setModifyTimeLong(long modifyTime)
Parameters:
modifyTime -
Since:
1.2.0

setName

public void setName(String name)
Parameters:
name -
Since:
1.2.0

setNameDb

public void setNameDb(String name)
Parameters:
name -
Since:
1.2.0

setParentUuid

public void setParentUuid(String parentUUID)
Parameters:
parentUUID -
Since:
1.2.0

setUuid

public void setUuid(String uuid)
Parameters:
uuid -
Since:
1.2.0

toStringDb

public String toStringDb()
Returns:
string
Since:
1.2.0

onPostDelete

public void onPostDelete(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
after a delete occurs

Specified by:
onPostDelete in interface HibGrouperLifecycle
Overrides:
onPostDelete in class GrouperAPI
See Also:
GrouperAPI.onPostDelete(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPostSave

public void onPostSave(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
after a save (insert) occurs

Specified by:
onPostSave in interface HibGrouperLifecycle
Overrides:
onPostSave in class GrouperAPI
See Also:
GrouperAPI.onPostSave(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPostUpdate

public void onPostUpdate(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
after an update occurs

Specified by:
onPostUpdate in interface HibGrouperLifecycle
Overrides:
onPostUpdate in class GrouperAPI
See Also:
GrouperAPI.onPostUpdate(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPreDelete

public void onPreDelete(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before a delete (insert) occurs

Specified by:
onPreDelete in interface HibGrouperLifecycle
Overrides:
onPreDelete in class GrouperAPI
See Also:
GrouperAPI.onPreDelete(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPreSave

public void onPreSave(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before a save (insert) occurs

Specified by:
onPreSave in interface HibGrouperLifecycle
Overrides:
onPreSave in class GrouperAPI
See Also:
GrouperAPI.onPreSave(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPreUpdate

public void onPreUpdate(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before an update occurs

Specified by:
onPreUpdate in interface HibGrouperLifecycle
Overrides:
onPreUpdate in class GrouperAPI
See Also:
GrouperAPI.onPreUpdate(edu.internet2.middleware.grouper.hibernate.HibernateSession)

dbVersion

public Stem dbVersion()
save the state when retrieving from DB

Overrides:
dbVersion in class GrouperAPI
Returns:
the dbVersion

dbVersionDifferentFields

public Set<String> dbVersionDifferentFields()
note, these are massaged so that name, extension, etc look like normal fields. access with fieldValue()

Overrides:
dbVersionDifferentFields in class GrouperAPI
Returns:
a set of attributes changed, or empty set if none
See Also:
GrouperAPI.dbVersionDifferentFields()

dbVersionReset

public void dbVersionReset()
take a snapshot of the data since this is what is in the db

Overrides:
dbVersionReset in class GrouperAPI

clone

public Stem clone()
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:
Object.clone()

_createStemAndParentStemsIfNotExist

public static Stem _createStemAndParentStemsIfNotExist(GrouperSession grouperSession,
                                                       String stemName,
                                                       String stemDisplayNameForInserts)
                                                throws InsufficientPrivilegeException,
                                                       StemNotFoundException,
                                                       StemAddException
create stems and parents if not exist.

Parameters:
stemName -
grouperSession -
stemDisplayNameForInserts - optional, will use this for display name, and not just default to the name. Note this is only used if creating something, it will not update existing stems
Returns:
the resulting stem
Throws:
InsufficientPrivilegeException
StemNotFoundException
StemAddException

saveStem

public static Stem saveStem(GrouperSession grouperSession,
                            String stemNameToEdit,
                            String uuid,
                            String name,
                            String displayExtension,
                            String description,
                            SaveMode saveMode,
                            boolean createParentStemsIfNotExist)
                     throws StemNotFoundException,
                            InsufficientPrivilegeException,
                            StemAddException,
                            StemModifyException
 create or update a stem.  Note this will not move a stem at this time (might in future)
 
 This is a static method since setters to Stem objects persist to the DB
 
 Steps:
 
 1. Find the stem by stemNameToEdit (if not there then its an insert)
 2. Internally set all the fields of the stem (no need to reset if already the same)
 3. Store the stem (insert or update) if needed
 4. Return the stem object
 
 This occurs in a transaction, so if a part of it fails, it rolls back, and potentially
 rolls back outer transactions too
 

Parameters:
grouperSession - to act as
stemNameToEdit - is the name of the stem to edit (or null if insert)
description - new description for stem
displayExtension - display friendly name for this stem only (parent stems are not specified)
name - this is required, and is the full name of the stem including the names of parent stems. e.g. stem1:stem2:stem3 the parent stem must exist unless createParentStemsIfNotExist. Can rename a stem extension, but not the parent stem name (move)
uuid - of the stem. uuid for an inserted stem
saveMode - to constrain if insert only or update only, if null defaults to INSERT_OR_UPDATE
createParentStemsIfNotExist - true if the stems should be created if they dont exist, false for StemNotFoundException if not exist. Note, the display extension on created stems will equal the extension. This could be dangerous and should probably only be used for testing
Returns:
the stem that was updated or created
Throws:
StemNotFoundException
InsufficientPrivilegeException
StemAddException
StemModifyException

move

public void move(Stem stem)
          throws StemModifyException,
                 InsufficientPrivilegeException
Move this stem to another Stem. If you would like to specify options for the move, use StemMove instead. This will use the default options.

Parameters:
stem -
Throws:
StemModifyException
InsufficientPrivilegeException

copy

public Stem copy(Stem stem)
          throws StemAddException,
                 InsufficientPrivilegeException
Copy this stem to another Stem. If you want to specify options for the copy, use StemCopy. This will use the default options.

Parameters:
stem -
Returns:
the new stem
Throws:
StemAddException
InsufficientPrivilegeException

getLastMembershipChangeDb

public Long getLastMembershipChangeDb()
when the last member has changed, used by hibernate

Returns:
when

setLastMembershipChangeDb

public void setLastMembershipChangeDb(Long theMembershipLastChange)
when the last member has changed, used by hibernate

Parameters:
theMembershipLastChange -

getLastMembershipChange

public Timestamp getLastMembershipChange()
when the last member has changed

Returns:
the membership last change timestamp

addChildRole

public Role addChildRole(String extension,
                         String displayExtension)
                  throws GroupAddException,
                         InsufficientPrivilegeException
Add a new role to the registry.
 // Add a role with the extension "edu" beneath this stem.
 try {
   Group edu = ns.addChildRole("edu", "edu domain");
 }
 catch (GroupAddException eGA) {
   // Group not added
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to add group
 }
 

Parameters:
extension - Role extension
displayExtension - Role displayExtension
Returns:
The added Role
Throws:
GroupAddException
InsufficientPrivilegeException

internal_addChildRole

public Role internal_addChildRole(String extension,
                                  String displayExtension,
                                  String uuid)
                           throws GroupAddException,
                                  InsufficientPrivilegeException
Add a new role to the registry.
 // Add a role with the extension "edu" beneath this stem.
 try {
   Group edu = ns.addChildRole("edu", "edu domain");
 }
 catch (GroupAddException eGA) {
   // Group not added
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to add group
 }
 

Parameters:
extension - Role extension
displayExtension - Role displayExtension
uuid - is uuid or null if generated
Returns:
The added Role
Throws:
GroupAddException
InsufficientPrivilegeException

internal_addChildEntity

public Role internal_addChildEntity(String extension,
                                    String displayExtension,
                                    String uuid)
                             throws GroupAddException,
                                    InsufficientPrivilegeException
Add a new role to the registry.
 // Add a role with the extension "edu" beneath this stem.
 try {
   Group edu = ns.addChildEntity("edu", "edu domain");
 }
 catch (GroupAddException eGA) {
   // Group not added
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to add group
 }
 

Parameters:
extension - Entity extension
displayExtension - Entity displayExtension
uuid - is uuid or null if generated
Returns:
The added Role
Throws:
GroupAddException
InsufficientPrivilegeException

xmlDifferentBusinessProperties

public boolean xmlDifferentBusinessProperties(Stem other)
Description copied from interface: XmlImportableBase
see if the non update cols are different (e.g. name)

Specified by:
xmlDifferentBusinessProperties in interface XmlImportableBase<Stem>
Parameters:
other - the one to compare with
Returns:
true if so
See Also:
XmlImportableBase.xmlDifferentBusinessProperties(java.lang.Object)

xmlDifferentUpdateProperties

public boolean xmlDifferentUpdateProperties(Stem other)
Description copied from interface: XmlImportableBase
see if the update cols are different (e.g. last updated)

Specified by:
xmlDifferentUpdateProperties in interface XmlImportableBase<Stem>
Parameters:
other - the one to compare with
Returns:
true if so
See Also:
XmlImportableBase.xmlDifferentUpdateProperties(java.lang.Object)

xmlCopyBusinessPropertiesToExisting

public void xmlCopyBusinessPropertiesToExisting(Stem existingRecord)
Description copied from interface: XmlImportableBase
copy business (non update) properties to an existing record

Specified by:
xmlCopyBusinessPropertiesToExisting in interface XmlImportableBase<Stem>
See Also:
XmlImportableBase.xmlCopyBusinessPropertiesToExisting(java.lang.Object)

xmlRetrieveByIdOrKey

public Stem xmlRetrieveByIdOrKey()
Description copied from interface: XmlImportable
retrieve from db by id or key. throws exception if duplicate

Specified by:
xmlRetrieveByIdOrKey in interface XmlImportable<Stem>
Returns:
the object or null if not found
See Also:
XmlImportable.xmlRetrieveByIdOrKey()

assignIdIndex

public boolean assignIdIndex(long theIdIndex)
assign different id index

Parameters:
theIdIndex -
Returns:
if it was changed

xmlSaveBusinessProperties

public Stem xmlSaveBusinessProperties(Stem existingRecord)
Description copied from interface: XmlImportableBase
save the business properties (not update properties)

Specified by:
xmlSaveBusinessProperties in interface XmlImportableBase<Stem>
Parameters:
existingRecord - null if insert, the object if exists in DB generally just copy the hibernate version number, and last updated to the object and store it
Returns:
the new object or existing
See Also:
XmlImportableBase.xmlSaveBusinessProperties(java.lang.Object)

xmlSaveUpdateProperties

public void xmlSaveUpdateProperties()
Description copied from interface: XmlImportableBase
save the udpate properties (e.g. last updated). Note, this is done with a sql update statement, not with hibernate

Specified by:
xmlSaveUpdateProperties in interface XmlImportableBase<Stem>
See Also:
XmlImportableBase.xmlSaveUpdateProperties()

xmlToExportStem

public XmlExportStem xmlToExportStem(GrouperVersion grouperVersion)
convert to xml bean for export

Parameters:
grouperVersion -
Returns:
xml bean

xmlGetId

public String xmlGetId()
Description copied from interface: XmlImportableBase
set id key in db

Specified by:
xmlGetId in interface XmlImportableBase<Stem>
Returns:
id
See Also:
XmlImportableBase.xmlGetId()

xmlSetId

public void xmlSetId(String theId)
Description copied from interface: XmlImportableBase
set id key in db

Specified by:
xmlSetId in interface XmlImportableBase<Stem>
See Also:
XmlImportableBase.xmlSetId(java.lang.String)

xmlToString

public String xmlToString()
Description copied from interface: XmlImportableBase
convert to string for log

Specified by:
xmlToString in interface XmlImportableBase<Stem>
Returns:
the string value for log
See Also:
XmlImportableBase.xmlToString()

obliterate

public void obliterate(boolean printOutput,
                       boolean testOnly)
                throws InsufficientPrivilegeException,
                       StemDeleteException
Delete this stem from the Groups Registry including all sub objects.
 try {
   ns.delete();
 }
 catch (InsufficientPrivilegeException eIP) {
   // not privileged to delete stem
 }
 catch (StemDeleteException eSD) {
   // unable to delete stem
 }
 

Parameters:
printOutput -
testOnly -
Throws:
InsufficientPrivilegeException
StemDeleteException

__getId

public String __getId()
Description copied from interface: GrouperSetElement
if of this object

Specified by:
__getId in interface GrouperSetElement
Returns:
id
See Also:
GrouperSetElement.__getId()

__getName

public String __getName()
Description copied from interface: GrouperSetElement
name of this object (for logging)

Specified by:
__getName in interface GrouperSetElement
Returns:
name
See Also:
GrouperSetElement.__getName()

getIdIndex

public Long getIdIndex()
id of the group as a unique integer

Returns:
id

setIdIndex

public void setIdIndex(Long idIndex1)
id of the group as a unique integer

Parameters:
idIndex1 -

matchesLowerSearchStrings

public boolean matchesLowerSearchStrings(Set<String> filterStrings)
Description copied from interface: GrouperObject
see if this object matches the filter strings

Specified by:
matchesLowerSearchStrings in interface GrouperObject
Returns:
true if matches
See Also:
GrouperObject.matchesLowerSearchStrings(Set)

canHavePrivilege

public boolean canHavePrivilege(edu.internet2.middleware.subject.Subject subject,
                                String privilegeOrListName,
                                boolean secure)
see if the subject has a privilege or another privilege that implies this privilege.

Parameters:
subject -
privilegeOrListName -
secure - if the user must be an admin to check
Returns:
true if has privilege

grantPrivs

public boolean grantPrivs(edu.internet2.middleware.subject.Subject subject,
                          boolean stemAdminChecked,
                          boolean createChecked,
                          boolean attrReadChecked,
                          boolean attrUpdateChecked,
                          boolean revokeIfUnchecked)
grant privs to stem

Parameters:
subject - to add
createChecked -
stemAdminChecked -
attrReadChecked -
attrUpdateChecked -
revokeIfUnchecked -
Returns:
if something was changed