edu.internet2.middleware.grouper
Class Field

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

public class Field
extends GrouperAPI
implements Comparable<Field>, GrouperHasContext, Hib3GrouperVersioned, XmlImportable<Field>

Schema specification for a Group attribute or list. Reference to members list is: Group.getDefaultList()

Version:
$Id: Field.java,v 1.48 2009-09-24 18:07:16 shilen Exp $
Author:
blair christensen.
See Also:
Serialized Form

Field Summary
static String COLUMN_CONTEXT_ID
          col
static String COLUMN_FIELD_UUID
          uuid col in db
static String COLUMN_ID
          col
static String COLUMN_NAME
          col
static String COLUMN_OLD_FIELD_UUID
          old uuid id col for id conversion
static String COLUMN_OLD_ID
          old id col for id conversion
static String COLUMN_READ_PRIVILEGE
          col
static String COLUMN_TYPE
          col
static String COLUMN_WRITE_PRIVILEGE
          col
static String FIELD_DB_VERSION
          constant for field name for: dbVersion
static String FIELD_NAME
          constant for field name for: name
static String FIELD_NAME_ADMINS
          field name for admins
static String FIELD_NAME_ATTR_ADMINS
          field name for attr admins
static String FIELD_NAME_ATTR_DEF_ATTR_READERS
          field name for attrDefAttrReaders
static String FIELD_NAME_ATTR_DEF_ATTR_UPDATERS
          field name for attrDefAttrUpdaters
static String FIELD_NAME_ATTR_OPTINS
          field name for attr optins
static String FIELD_NAME_ATTR_OPTOUTS
          field name for attr optouts
static String FIELD_NAME_ATTR_READERS
          field name for attr readers
static String FIELD_NAME_ATTR_UPDATERS
          field name for attr updaters
static String FIELD_NAME_ATTR_VIEWERS
          field name for attr viewers
static String FIELD_NAME_CREATORS
          field name for creators
static String FIELD_NAME_GROUP_ATTR_READERS
          field name for groupAttrReaders
static String FIELD_NAME_GROUP_ATTR_UPDATERS
          field name for groupAttrUpdaters
static String FIELD_NAME_OPTINS
          field name for optins
static String FIELD_NAME_OPTOUTS
          field name for optouts
static String FIELD_NAME_READERS
          field name for readers
static String FIELD_NAME_STEM_ADMINS
          field name for stemAdmins
static String FIELD_NAME_STEM_ATTR_READERS
          field name for stemAttrReaders
static String FIELD_NAME_STEM_ATTR_UPDATERS
          field name for stemAttrUpdaters
static String FIELD_NAME_STEMMERS
          field name for stemmers
static String FIELD_NAME_UPDATERS
          field name for updaters
static String FIELD_NAME_VIEWERS
          field name for viewers
static String FIELD_READ_PRIVILEGE
          constant for field name for: readPrivilege
static String FIELD_TYPE
          constant for field name for: type
static String FIELD_UUID
          constant for field name for: uuid
static String FIELD_WRITE_PRIVILEGE
          constant for field name for: writePrivilege
static String PROPERTY_UUID
          constant for property name for: uuid
static long serialVersionUID
           
static String TABLE_GROUPER_FIELDS
          table name for fields
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
Field()
           
 
Method Summary
static Collection<Field> calculateInheritedPrivileges(Collection<Field> fields, boolean includeInheritedPrivileges)
          see if there are inherited privileges to also include
 Field clone()
          deep clone the fields in this object
 int compareTo(Field that)
           
 Field 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
 boolean equals(Object other)
           
static String fieldNames(Collection<Field> collection)
          print out a collection of fields
 String getContextId()
          context id of the transaction
 GroupType getGroupType()
           
 GroupType getGroupType(boolean exceptionIfNoGroupType)
           
 String getId()
          return the uuid
 Collection<Field> getImpliedFields()
          get the fields that this field implies by inheritance
 String getName()
           
 Privilege getReadPriv()
           
 String getReadPrivilege()
           
 FieldType getType()
           
 String getTypeString()
           
 String getUuid()
           
 Privilege getWritePriv()
           
 String getWritePrivilege()
           
 int hashCode()
           
static Field internal_addField(GrouperSession s, String name, FieldType type, Privilege read, Privilege write, boolean exceptionIfExists, boolean updateIfExists, boolean[] changedArray, String uuid)
          add a field if it is not already there
 boolean isAttributeDefListField()
          see if this is a list of members field for attributeDefs
 boolean isAttributeName()
          Deprecated.  
 boolean isEntityListField()
          see if this is a list of members field for groups
 boolean isGroupAccessField()
          see if this is privilege field for groups
 boolean isGroupListField()
          see if this is a list of members field for groups
 boolean isPrivilege()
           
 boolean isStemListField()
          see if this is a list of members field for stems
 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 setContextId(String contextId1)
          context id of the transaction
 void setName(String name)
           
 void setReadPrivilege(Privilege readPrivilege)
           
 void setReadPrivilege(String readPrivilege)
           
 void setType(FieldType type)
           
 void setTypeString(String type)
           
 void setUuid(String uuid)
           
 void setWritePrivilege(Privilege writePrivilege)
           
 void setWritePrivilege(String writePrivilege)
           
 void store()
          store this object to the DB.
 String toString()
           
 void xmlCopyBusinessPropertiesToExisting(Field existingRecord)
          copy business (non update) properties to an existing record
 boolean xmlDifferentBusinessProperties(Field other)
          see if the non update cols are different (e.g.
 boolean xmlDifferentUpdateProperties(Field other)
          see if the update cols are different (e.g.
 String xmlGetId()
          set id key in db
 Field xmlRetrieveByIdOrKey()
          retrieve from db by id or key.
 Field xmlSaveBusinessProperties(Field 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
 XmlExportField xmlToExportField(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

FIELD_NAME_CREATORS

public static final String FIELD_NAME_CREATORS
field name for creators

See Also:
Constant Field Values

FIELD_NAME_STEMMERS

public static final String FIELD_NAME_STEMMERS
field name for stemmers

See Also:
Constant Field Values

FIELD_NAME_VIEWERS

public static final String FIELD_NAME_VIEWERS
field name for viewers

See Also:
Constant Field Values

FIELD_NAME_ATTR_VIEWERS

public static final String FIELD_NAME_ATTR_VIEWERS
field name for attr viewers

See Also:
Constant Field Values

FIELD_NAME_ADMINS

public static final String FIELD_NAME_ADMINS
field name for admins

See Also:
Constant Field Values

FIELD_NAME_ATTR_ADMINS

public static final String FIELD_NAME_ATTR_ADMINS
field name for attr admins

See Also:
Constant Field Values

FIELD_NAME_READERS

public static final String FIELD_NAME_READERS
field name for readers

See Also:
Constant Field Values

FIELD_NAME_ATTR_READERS

public static final String FIELD_NAME_ATTR_READERS
field name for attr readers

See Also:
Constant Field Values

FIELD_NAME_UPDATERS

public static final String FIELD_NAME_UPDATERS
field name for updaters

See Also:
Constant Field Values

FIELD_NAME_ATTR_UPDATERS

public static final String FIELD_NAME_ATTR_UPDATERS
field name for attr updaters

See Also:
Constant Field Values

FIELD_NAME_OPTINS

public static final String FIELD_NAME_OPTINS
field name for optins

See Also:
Constant Field Values

FIELD_NAME_ATTR_OPTINS

public static final String FIELD_NAME_ATTR_OPTINS
field name for attr optins

See Also:
Constant Field Values

FIELD_NAME_OPTOUTS

public static final String FIELD_NAME_OPTOUTS
field name for optouts

See Also:
Constant Field Values

FIELD_NAME_ATTR_OPTOUTS

public static final String FIELD_NAME_ATTR_OPTOUTS
field name for attr optouts

See Also:
Constant Field Values

FIELD_NAME_GROUP_ATTR_READERS

public static final String FIELD_NAME_GROUP_ATTR_READERS
field name for groupAttrReaders

See Also:
Constant Field Values

FIELD_NAME_GROUP_ATTR_UPDATERS

public static final String FIELD_NAME_GROUP_ATTR_UPDATERS
field name for groupAttrUpdaters

See Also:
Constant Field Values

FIELD_NAME_ATTR_DEF_ATTR_READERS

public static final String FIELD_NAME_ATTR_DEF_ATTR_READERS
field name for attrDefAttrReaders

See Also:
Constant Field Values

FIELD_NAME_ATTR_DEF_ATTR_UPDATERS

public static final String FIELD_NAME_ATTR_DEF_ATTR_UPDATERS
field name for attrDefAttrUpdaters

See Also:
Constant Field Values

FIELD_NAME_STEM_ATTR_READERS

public static final String FIELD_NAME_STEM_ATTR_READERS
field name for stemAttrReaders

See Also:
Constant Field Values

FIELD_NAME_STEM_ATTR_UPDATERS

public static final String FIELD_NAME_STEM_ATTR_UPDATERS
field name for stemAttrUpdaters

See Also:
Constant Field Values

FIELD_NAME_STEM_ADMINS

public static final String FIELD_NAME_STEM_ADMINS
field name for stemAdmins

See Also:
Constant Field Values

COLUMN_ID

public static final String COLUMN_ID
col

See Also:
Constant Field Values

COLUMN_NAME

public static final String COLUMN_NAME
col

See Also:
Constant Field Values

COLUMN_READ_PRIVILEGE

public static final String COLUMN_READ_PRIVILEGE
col

See Also:
Constant Field Values

COLUMN_TYPE

public static final String COLUMN_TYPE
col

See Also:
Constant Field Values

COLUMN_WRITE_PRIVILEGE

public static final String COLUMN_WRITE_PRIVILEGE
col

See Also:
Constant Field Values

COLUMN_CONTEXT_ID

public static final String COLUMN_CONTEXT_ID
col

See Also:
Constant Field Values

TABLE_GROUPER_FIELDS

public static final String TABLE_GROUPER_FIELDS
table name for fields

See Also:
Constant Field Values

COLUMN_FIELD_UUID

public static final String COLUMN_FIELD_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_FIELD_UUID

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

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_NAME

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

See Also:
Constant Field Values

FIELD_READ_PRIVILEGE

public static final String FIELD_READ_PRIVILEGE
constant for field name for: readPrivilege

See Also:
Constant Field Values

FIELD_TYPE

public static final String FIELD_TYPE
constant for field name for: type

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_WRITE_PRIVILEGE

public static final String FIELD_WRITE_PRIVILEGE
constant for field name for: writePrivilege

See Also:
Constant Field Values

PROPERTY_UUID

public static final String PROPERTY_UUID
constant for property name for: uuid

See Also:
Constant Field Values

serialVersionUID

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

Field

public Field()
Method Detail

getImpliedFields

public Collection<Field> getImpliedFields()
get the fields that this field implies by inheritance

Returns:
the fields, note, dont change the list after you get it

isPrivilege

public boolean isPrivilege()
Returns:
if this field is a privilege

getId

public String getId()
return the uuid

Returns:
uuid

calculateInheritedPrivileges

public static Collection<Field> calculateInheritedPrivileges(Collection<Field> fields,
                                                             boolean includeInheritedPrivileges)
see if there are inherited privileges to also include

Returns:
the inherited fields

fieldNames

public static String fieldNames(Collection<Field> collection)
print out a collection of fields

Parameters:
collection -
Returns:
the field names comma separated

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 -

isStemListField

public boolean isStemListField()
see if this is a list of members field for stems

Returns:
true if stem list field

isAttributeDefListField

public boolean isAttributeDefListField()
see if this is a list of members field for attributeDefs

Returns:
true if attribute def list field

isGroupListField

public boolean isGroupListField()
see if this is a list of members field for groups

Returns:
true if group list field

isGroupAccessField

public boolean isGroupAccessField()
see if this is privilege field for groups

Returns:
true if group access list field

isEntityListField

public boolean isEntityListField()
see if this is a list of members field for groups

Returns:
true if group list field

getType

public FieldType getType()
Returns:
field type

getReadPriv

public Privilege getReadPriv()
Returns:
privilege

getWritePriv

public Privilege getWritePriv()
Returns:
privilege

equals

public boolean equals(Object other)
Overrides:
equals in class Object
Parameters:
other -
Returns:
if equals
Since:
1.2.0

getName

public String getName()
Returns:
name
Since:
1.2.0

getReadPrivilege

public String getReadPrivilege()
Returns:
read privilege
Since:
1.2.0

getTypeString

public String getTypeString()
Returns:
type string
Since:
1.2.0

getUuid

public String getUuid()
Returns:
uuid
Since:
1.2.0

getWritePrivilege

public String getWritePrivilege()
Returns:
write privilege
Since:
1.2.0

hashCode

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

setName

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

setReadPrivilege

public void setReadPrivilege(Privilege readPrivilege)
Parameters:
readPrivilege -
Since:
1.2.0

setReadPrivilege

public void setReadPrivilege(String readPrivilege)
Parameters:
readPrivilege -
Since:
1.2.0

setType

public void setType(FieldType type)
Parameters:
type -
Since:
1.2.0

setTypeString

public void setTypeString(String type)
Parameters:
type -
Since:
1.2.0

isAttributeName

public boolean isAttributeName()
Deprecated. 

see if this field is an attribute name

Returns:
true if so

setUuid

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

setWritePrivilege

public void setWritePrivilege(Privilege writePrivilege)
Parameters:
writePrivilege -
Since:
1.2.0

setWritePrivilege

public void setWritePrivilege(String writePrivilege)
Parameters:
writePrivilege -
Since:
1.2.0

toString

public String toString()
Overrides:
toString in class Object
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 Field 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 Field 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()

store

public void store()
store this object to the DB.


xmlCopyBusinessPropertiesToExisting

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

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

xmlDifferentBusinessProperties

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

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

xmlDifferentUpdateProperties

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

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

xmlRetrieveByIdOrKey

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

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

xmlSaveBusinessProperties

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

Specified by:
xmlSaveBusinessProperties in interface XmlImportableBase<Field>
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<Field>
See Also:
XmlImportableBase.xmlSaveUpdateProperties()

xmlToExportField

public XmlExportField xmlToExportField(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<Field>
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<Field>
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<Field>
Returns:
the string value for log
See Also:
XmlImportableBase.xmlToString()

getGroupType

public GroupType getGroupType(boolean exceptionIfNoGroupType)
Parameters:
exceptionIfNoGroupType -
Returns:
group type

getGroupType

public GroupType getGroupType()
Returns:
group type

compareTo

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

internal_addField

public static Field internal_addField(GrouperSession s,
                                      String name,
                                      FieldType type,
                                      Privilege read,
                                      Privilege write,
                                      boolean exceptionIfExists,
                                      boolean updateIfExists,
                                      boolean[] changedArray,
                                      String uuid)
                               throws InsufficientPrivilegeException,
                                      SchemaException
add a field if it is not already there

Parameters:
s -
name -
type -
read -
write -
exceptionIfExists -
updateIfExists -
changedArray - is an array of 1 if you want to know if this method changed anything, else null
uuid -
Returns:
the field
Throws:
InsufficientPrivilegeException
SchemaException