edu.internet2.middleware.grouper
Class GroupType

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

public class GroupType
extends GrouperAPI
implements Serializable, Comparable

Schema specification for a Group type.

Version:
$Id: GroupType.java,v 1.89 2009-06-10 05:31:35 mchyzer Exp $
Author:
blair christensen.
See Also:
Serialized Form

Field Summary
static String COLUMN_OLD_ID
          old id col for id conversion
static String COLUMN_OLD_TYPE_UUID
          old uuid id col for id conversion
static String COLUMN_TYPE_UUID
          uuid col in db
static String FIELD_CREATE_TIME
          constant for field name for: createTime
static String FIELD_NAME
          constant for field name for: name
static String FIELD_UUID
          constant for field name for: uuid
static long serialVersionUID
           
static String TABLE_OLD_GROUPER_TYPES
          name of table for grouper_types
 
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
GroupType()
           
 
Method Summary
 AttributeDefName addAttribute(GrouperSession s, String name)
          Deprecated.  
 AttributeDefName addAttribute(GrouperSession s, String name, boolean exceptionIfExists)
          Deprecated.  
 AttributeDefName addAttribute(GrouperSession s, String name, boolean exceptionIfExists, String uuid)
          Deprecated.  
 Field addList(GrouperSession s, String name, Privilege read, Privilege write)
          Deprecated.  
 GroupType clone()
          deep clone the fields in this object
 int compareTo(Object o)
           
static GroupType createType(GrouperSession s, String name)
          Deprecated.  
static GroupType createType(GrouperSession s, String name, boolean exceptionIfExists)
          Deprecated.  
static GroupType createType(GrouperSession s, String name, boolean exceptionIfExists, String uuid)
          Deprecated.  
 void delete(GrouperSession s)
          Deprecated.  
 void deleteField(GrouperSession s, String name)
          Deprecated.  
 boolean equals(Object other)
           
 AttributeDefName getAttributeDefName()
           
 String getContextId()
          context id of the transaction
 long getCreateTime()
           
 Set<Field> getFields()
           
 Set<AttributeDefName> getLegacyAttributes()
           
 String getName()
           
 String getUuid()
           
 int hashCode()
           
 Field internal_addList(GrouperSession s, String name, Privilege read, Privilege write, String fieldId, boolean exceptionIfExists)
           
static GroupType internal_createType(GrouperSession s, String name, boolean exceptionIfExists, boolean[] changed, String uuid)
           
 AttributeDef internal_getAttributeDefForAttributes()
           
 AttributeDef internal_getAttributeDefForCustomLists()
           
 AttributeDefName internal_getAttributeDefNameForCustomLists()
           
static GroupType internal_getGroupType(AttributeDefName attribute, boolean exceptionIfNotLegacyGroupType)
           
 void internalSetAttributeDefName(AttributeDefName attributeDefName1)
           
 boolean isSystemType()
           
 void setContextId(String contextId1)
          context id of the transaction
 void setCreateTime(long createTime)
           
 void setFields(Set fields)
           
 void setName(String name)
           
 void setUuid(String uuid)
           
 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
 

Field Detail

TABLE_OLD_GROUPER_TYPES

public static final String TABLE_OLD_GROUPER_TYPES
name of table for grouper_types

See Also:
Constant Field Values

COLUMN_TYPE_UUID

public static final String COLUMN_TYPE_UUID
uuid col in db

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_TYPE_UUID

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

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_NAME

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

See Also:
Constant Field Values

FIELD_UUID

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

See Also:
Constant Field Values

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

GroupType

public GroupType()
Method Detail

createType

public static GroupType createType(GrouperSession s,
                                   String name)
                            throws InsufficientPrivilegeException,
                                   SchemaException
Deprecated. 

Create a new GroupType.

Create a new custom group type that can be assigned to existing or new groups. If the type already exists, a SchemaException will be thrown. If the subject is not root-like, an InsufficientPrivilegeException will be thrown.

 try {
   GroupType type = GroupType.createType(s, "my custom type");
 }
 catch (InsufficientPrivilegeException eIP) {
   // Subject not privileged to add group types.
 }
 catch (SchemaException eS) {
   // Type not created
 }
 

Parameters:
s - Create type within this session context.
name - Create type with this name.
Returns:
New GroupType.
Throws:
InsufficientPrivilegeException
SchemaException

createType

public static GroupType createType(GrouperSession s,
                                   String name,
                                   boolean exceptionIfExists)
                            throws InsufficientPrivilegeException,
                                   SchemaException
Deprecated. 

Create a new GroupType.

Create a new custom group type that can be assigned to existing or new groups. If the type already exists, a SchemaException will be thrown. If the subject is not root-like, an InsufficientPrivilegeException will be thrown.

 try {
   GroupType type = GroupType.createType(s, "my custom type");
 }
 catch (InsufficientPrivilegeException eIP) {
   // Subject not privileged to add group types.
 }
 catch (SchemaException eS) {
   // Type not created
 }
 

Parameters:
s - Create type within this session context.
name - Create type with this name.
exceptionIfExists -
Returns:
New GroupType.
Throws:
InsufficientPrivilegeException
SchemaException

createType

public static GroupType createType(GrouperSession s,
                                   String name,
                                   boolean exceptionIfExists,
                                   String uuid)
                            throws InsufficientPrivilegeException,
                                   SchemaException
Deprecated. 

Create a new GroupType.

Create a new custom group type that can be assigned to existing or new groups. If the type already exists, a SchemaException will be thrown. If the subject is not root-like, an InsufficientPrivilegeException will be thrown.

 try {
   GroupType type = GroupType.createType(s, "my custom type");
 }
 catch (InsufficientPrivilegeException eIP) {
   // Subject not privileged to add group types.
 }
 catch (SchemaException eS) {
   // Type not created
 }
 

Parameters:
s - Create type within this session context.
name - Create type with this name.
exceptionIfExists -
uuid -
Returns:
New GroupType.
Throws:
InsufficientPrivilegeException
SchemaException

getContextId

public String getContextId()
context id of the transaction

Returns:
context id

setContextId

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

Parameters:
contextId1 -

addAttribute

public AttributeDefName addAttribute(GrouperSession s,
                                     String name)
                              throws InsufficientPrivilegeException,
                                     SchemaException
Deprecated. 

Add a custom attribute Field to a custom GroupType. try { Field myAttr = type.addAttribute( "my attribute", AccessPrivilege.VIEW, AccessPrivilege.UPDATE, false ); } catch (InsufficientPrivilegeException eIP) { // Not privileged to add attribute } catch (SchemaException eS) { // Invalid schema }

Parameters:
s - Add attribute within this session context.
name - Name of attribute.
Returns:
field
Throws:
InsufficientPrivilegeException
SchemaException

addAttribute

public AttributeDefName addAttribute(GrouperSession s,
                                     String name,
                                     boolean exceptionIfExists)
                              throws InsufficientPrivilegeException,
                                     SchemaException
Deprecated. 

Add a custom attribute Field to a custom GroupType. try { Field myAttr = type.addAttribute( "my attribute", AccessPrivilege.VIEW, AccessPrivilege.UPDATE, false ); } catch (InsufficientPrivilegeException eIP) { // Not privileged to add attribute } catch (SchemaException eS) { // Invalid schema }

Parameters:
s - Add attribute within this session context.
name - Name of attribute.
exceptionIfExists -
Returns:
field
Throws:
InsufficientPrivilegeException
SchemaException

addAttribute

public AttributeDefName addAttribute(GrouperSession s,
                                     String name,
                                     boolean exceptionIfExists,
                                     String uuid)
                              throws InsufficientPrivilegeException,
                                     SchemaException
Deprecated. 

Add a custom attribute Field to a custom GroupType. try { Field myAttr = type.addAttribute( "my attribute", AccessPrivilege.VIEW, AccessPrivilege.UPDATE, false ); } catch (InsufficientPrivilegeException eIP) { // Not privileged to add attribute } catch (SchemaException eS) { // Invalid schema }

Parameters:
s - Add attribute within this session context.
name - Name of attribute.
exceptionIfExists -
uuid -
Returns:
field
Throws:
InsufficientPrivilegeException
SchemaException

addList

public Field addList(GrouperSession s,
                     String name,
                     Privilege read,
                     Privilege write)
              throws InsufficientPrivilegeException,
                     SchemaException
Deprecated. 

Add a custom list Field to a custom GroupType. try { Field myList = type.addList( s, "my list", AccessPrivilege.VIEW, AccessPrivilege.UPDATE ); } catch (InsufficientPrivilegeException eIP) { // Not privileged to add list } catch (SchemaException eS) { // Invalid schema }

Parameters:
s - Add list within this session context.
name - Name of list.
read - Privilege required to write to this Field.
write - Privilege required to write to this Field.
Returns:
field
Throws:
InsufficientPrivilegeException
SchemaException

internal_addList

public Field internal_addList(GrouperSession s,
                              String name,
                              Privilege read,
                              Privilege write,
                              String fieldId,
                              boolean exceptionIfExists)
                       throws InsufficientPrivilegeException,
                              SchemaException
Parameters:
s -
name -
read -
write -
fieldId -
exceptionIfExists -
Returns:
field
Throws:
InsufficientPrivilegeException
SchemaException

delete

public void delete(GrouperSession s)
            throws InsufficientPrivilegeException,
                   SchemaException
Deprecated. 

Delete a custom GroupType definition.

 try {
   aGroupType.delete(s);
 }
 catch (InsufficientPrivilegeException eIP) {
   // Subject not privileged to delete group type.
 }
 catch (SchemaException eS) {
   // Type could not be deleted
 }
 

Parameters:
s - Delete type within this session context.
Throws:
InsufficientPrivilegeException
SchemaException
Since:
1.0

deleteField

public void deleteField(GrouperSession s,
                        String name)
                 throws InsufficientPrivilegeException,
                        SchemaException
Deprecated. 

Delete a custom Field from a custom GroupType.

Delete a field from this group type. If the field does not exist in this type a SchemaException will be thrown. If the subject is not root-like, an InsufficientPrivilegeException will be thrown.

 try {
   type.deleteField(s, "my field");
   );
 }
 catch (InsufficientPrivilegeException eIP) {
   // Not privileged to delete field
 }
 catch (SchemaException eS) {
   // Invalid schema
 }
 

Parameters:
s - Delete field within this session context.
name - Name of field to delete.
Throws:
InsufficientPrivilegeException
SchemaException

isSystemType

public boolean isSystemType()
Returns:
true if system type

internal_createType

public static GroupType internal_createType(GrouperSession s,
                                            String name,
                                            boolean exceptionIfExists,
                                            boolean[] changed,
                                            String uuid)
                                     throws InsufficientPrivilegeException,
                                            SchemaException
Parameters:
s -
name -
exceptionIfExists -
changed - boolean array, the fisrt index will be in it existed already
uuid - to use or null for one to be assigned
Returns:
the type
Throws:
InsufficientPrivilegeException
SchemaException

equals

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

getCreateTime

public long getCreateTime()
Returns:
create time
Since:
1.2.0

getFields

public Set<Field> getFields()
Returns:
fields
Since:
1.2.0

getName

public String getName()
Returns:
name
Since:
1.2.0

getUuid

public String getUuid()
Returns:
uuid
Since:
1.2.0

hashCode

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

setCreateTime

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

setFields

public void setFields(Set fields)
Parameters:
fields -
Since:
1.2.0

setName

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

setUuid

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

toString

public String toString()
Overrides:
toString in class Object
Returns:
string
Since:
1.2.0

clone

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

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

getAttributeDefName

public AttributeDefName getAttributeDefName()
Returns:
attributeDefName that corresponds to this group type

internalSetAttributeDefName

public void internalSetAttributeDefName(AttributeDefName attributeDefName1)
Parameters:
attributeDefName1 -

internal_getGroupType

public static GroupType internal_getGroupType(AttributeDefName attribute,
                                              boolean exceptionIfNotLegacyGroupType)
Parameters:
attribute -
exceptionIfNotLegacyGroupType -
Returns:
groupType

internal_getAttributeDefForAttributes

public AttributeDef internal_getAttributeDefForAttributes()
Returns:
the attributeDef for attribute assignments

internal_getAttributeDefForCustomLists

public AttributeDef internal_getAttributeDefForCustomLists()
Returns:
the attributeDef for custom lists

internal_getAttributeDefNameForCustomLists

public AttributeDefName internal_getAttributeDefNameForCustomLists()
Returns:
the attributeDefName for custom lists

getLegacyAttributes

public Set<AttributeDefName> getLegacyAttributes()
Returns:
legacy attributes