Package edu.internet2.middleware.grouper
Class Field
java.lang.Object
edu.internet2.middleware.grouper.GrouperAPI
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 $
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
colstatic final String
uuid col in dbstatic final String
colstatic final String
colstatic final String
colstatic final String
old uuid id col for id conversionstatic final String
old id col for id conversionstatic final String
colstatic final String
colstatic final String
colstatic final String
constant for field name for: dbVersionstatic final String
constant for field name for: namestatic final String
field name for adminsstatic final String
field name for attr adminsstatic final String
field name for attrDefAttrReadersstatic final String
field name for attrDefAttrUpdatersstatic final String
field name for attr optinsstatic final String
field name for attr optoutsstatic final String
field name for attr readersstatic final String
field name for attr updatersstatic final String
field name for attr viewersstatic final String
field name for creatorsstatic final String
field name for groupAttrReadersstatic final String
field name for groupAttrUpdatersstatic final String
field name for optinsstatic final String
field name for optoutsstatic final String
field name for readersstatic final String
field name for stemAdminsstatic final String
field name for stemAttrReadersstatic final String
field name for stemAttrUpdatersstatic final String
field name for stemViewersstatic final String
field name for stemmersstatic final String
field name for updatersstatic final String
field name for viewersstatic final String
constant for field name for: readPrivilegestatic final String
constant for field name for: typestatic final String
constant for field name for: uuidstatic final String
constant for field name for: writePrivilegestatic final String
constant for property name for: internalIdstatic final String
constant for property name for: uuidstatic final long
static final String
table name for fieldsFields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, dbVersion, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Field>
calculateInheritedPrivileges
(Collection<Field> fields, boolean includeInheritedPrivileges) see if there are inherited privileges to also includeclone()
deep clone the fields in this objectint
save the state when retrieving from DBnote, these are massaged so that name, extension, etc look like normal fields.void
take a snapshot of the data since this is what is in the dbboolean
static String
fieldNames
(Collection<Field> collection) print out a collection of fieldscontext id of the transactiongetGroupType
(boolean exceptionIfNoGroupType) getId()
return the uuidget the fields that this field implies by inheritancegetName()
getType()
getUuid()
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 thereboolean
see if this is a list of members field for attributeDefsboolean
Deprecated.boolean
see if this is a list of members field for groupsboolean
see if this is privilege field for groupsboolean
see if this is a list of members field for groupsboolean
boolean
see if this is a list of members field for stemsvoid
onPostDelete
(HibernateSession hibernateSession) after a delete occursvoid
onPostSave
(HibernateSession hibernateSession) after a save (insert) occursvoid
onPostUpdate
(HibernateSession hibernateSession) after an update occursvoid
onPreDelete
(HibernateSession hibernateSession) before a delete (insert) occursvoid
onPreSave
(HibernateSession hibernateSession) before a save (insert) occursvoid
onPreUpdate
(HibernateSession hibernateSession) before an update occursvoid
setContextId
(String contextId1) context id of the transactionvoid
setInternalId
(Long internalId) void
void
setReadPrivilege
(Privilege readPrivilege) void
setReadPrivilege
(String readPrivilege) void
void
setTypeString
(String type) void
void
setWritePrivilege
(Privilege writePrivilege) void
setWritePrivilege
(String writePrivilege) void
store()
store this object to the DB.toString()
void
xmlCopyBusinessPropertiesToExisting
(Field existingRecord) copy business (non update) properties to an existing recordboolean
see if the non update cols are different (e.g.boolean
see if the update cols are different (e.g.xmlGetId()
set id key in dbretrieve from db by id or key.xmlSaveBusinessProperties
(Field existingRecord) save the business properties (not update properties)void
save the udpate properties (e.g.void
set id key in dbxmlToExportField
(GrouperVersion grouperVersion) convert to xml bean for exportconvert to string for logMethods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersionClear, dbVersionIsDifferent, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onSave, onUpdate, setHibernateVersionNumber
-
Field Details
-
FIELD_NAME_CREATORS
field name for creators- See Also:
-
FIELD_NAME_STEMMERS
field name for stemmers- See Also:
-
FIELD_NAME_VIEWERS
field name for viewers- See Also:
-
FIELD_NAME_ATTR_VIEWERS
field name for attr viewers- See Also:
-
FIELD_NAME_ADMINS
field name for admins- See Also:
-
FIELD_NAME_ATTR_ADMINS
field name for attr admins- See Also:
-
FIELD_NAME_READERS
field name for readers- See Also:
-
FIELD_NAME_ATTR_READERS
field name for attr readers- See Also:
-
FIELD_NAME_UPDATERS
field name for updaters- See Also:
-
FIELD_NAME_ATTR_UPDATERS
field name for attr updaters- See Also:
-
FIELD_NAME_OPTINS
field name for optins- See Also:
-
FIELD_NAME_ATTR_OPTINS
field name for attr optins- See Also:
-
FIELD_NAME_OPTOUTS
field name for optouts- See Also:
-
FIELD_NAME_ATTR_OPTOUTS
field name for attr optouts- See Also:
-
FIELD_NAME_GROUP_ATTR_READERS
field name for groupAttrReaders- See Also:
-
FIELD_NAME_GROUP_ATTR_UPDATERS
field name for groupAttrUpdaters- See Also:
-
FIELD_NAME_ATTR_DEF_ATTR_READERS
field name for attrDefAttrReaders- See Also:
-
FIELD_NAME_ATTR_DEF_ATTR_UPDATERS
field name for attrDefAttrUpdaters- See Also:
-
FIELD_NAME_STEM_ATTR_READERS
field name for stemAttrReaders- See Also:
-
FIELD_NAME_STEM_VIEWERS
field name for stemViewers- See Also:
-
FIELD_NAME_STEM_ATTR_UPDATERS
field name for stemAttrUpdaters- See Also:
-
FIELD_NAME_STEM_ADMINS
field name for stemAdmins- See Also:
-
COLUMN_ID
col- See Also:
-
COLUMN_INTERNAL_ID
col- See Also:
-
COLUMN_NAME
col- See Also:
-
COLUMN_READ_PRIVILEGE
col- See Also:
-
COLUMN_TYPE
col- See Also:
-
COLUMN_WRITE_PRIVILEGE
col- See Also:
-
COLUMN_CONTEXT_ID
col- See Also:
-
TABLE_GROUPER_FIELDS
table name for fields- See Also:
-
COLUMN_FIELD_UUID
uuid col in db- See Also:
-
COLUMN_OLD_ID
old id col for id conversion- See Also:
-
COLUMN_OLD_FIELD_UUID
old uuid id col for id conversion- See Also:
-
FIELD_DB_VERSION
constant for field name for: dbVersion- See Also:
-
FIELD_NAME
constant for field name for: name- See Also:
-
FIELD_READ_PRIVILEGE
constant for field name for: readPrivilege- See Also:
-
FIELD_TYPE
constant for field name for: type- See Also:
-
FIELD_UUID
constant for field name for: uuid- See Also:
-
FIELD_WRITE_PRIVILEGE
constant for field name for: writePrivilege- See Also:
-
PROPERTY_UUID
constant for property name for: uuid- See Also:
-
PROPERTY_INTERNAL_ID
constant for property name for: internalId- See Also:
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
-
Constructor Details
-
Field
public Field()
-
-
Method Details
-
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
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
print out a collection of fields- Parameters:
collection
-- Returns:
- the field names comma separated
-
getContextId
context id of the transaction- Returns:
- context id
-
setContextId
context id of the transaction- Specified by:
setContextId
in interfaceGrouperHasContext
- Parameters:
contextId1
-
-
getInternalId
- Returns:
-
setInternalId
- Parameters:
internalId
-
-
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
- Returns:
- field type
-
getReadPriv
- Returns:
- privilege
-
getWritePriv
- Returns:
- privilege
-
equals
-
getName
- Returns:
- name
- Since:
- 1.2.0
-
getReadPrivilege
- Returns:
- read privilege
- Since:
- 1.2.0
-
getTypeString
- Returns:
- type string
- Since:
- 1.2.0
-
getUuid
- Returns:
- uuid
- Since:
- 1.2.0
-
getWritePrivilege
- Returns:
- write privilege
- Since:
- 1.2.0
-
hashCode
public int hashCode() -
setName
- Parameters:
name
-- Since:
- 1.2.0
-
setReadPrivilege
- Parameters:
readPrivilege
-- Since:
- 1.2.0
-
setReadPrivilege
- Parameters:
readPrivilege
-- Since:
- 1.2.0
-
setType
- Parameters:
type
-- Since:
- 1.2.0
-
setTypeString
- Parameters:
type
-- Since:
- 1.2.0
-
isAttributeName
public boolean isAttributeName()Deprecated.see if this field is an attribute name- Returns:
- true if so
-
setUuid
- Parameters:
uuid
-- Since:
- 1.2.0
-
setWritePrivilege
- Parameters:
writePrivilege
-- Since:
- 1.2.0
-
setWritePrivilege
- Parameters:
writePrivilege
-- Since:
- 1.2.0
-
toString
-
onPostDelete
Description copied from interface:HibGrouperLifecycle
after a delete occurs- Specified by:
onPostDelete
in interfaceHibGrouperLifecycle
- Overrides:
onPostDelete
in classGrouperAPI
- See Also:
-
onPostSave
Description copied from interface:HibGrouperLifecycle
after a save (insert) occurs- Specified by:
onPostSave
in interfaceHibGrouperLifecycle
- Overrides:
onPostSave
in classGrouperAPI
- See Also:
-
onPostUpdate
Description copied from interface:HibGrouperLifecycle
after an update occurs- Specified by:
onPostUpdate
in interfaceHibGrouperLifecycle
- Overrides:
onPostUpdate
in classGrouperAPI
- See Also:
-
onPreDelete
Description copied from interface:HibGrouperLifecycle
before a delete (insert) occurs- Specified by:
onPreDelete
in interfaceHibGrouperLifecycle
- Overrides:
onPreDelete
in classGrouperAPI
- See Also:
-
onPreSave
Description copied from interface:HibGrouperLifecycle
before a save (insert) occurs- Specified by:
onPreSave
in interfaceHibGrouperLifecycle
- Overrides:
onPreSave
in classGrouperAPI
- See Also:
-
onPreUpdate
Description copied from interface:HibGrouperLifecycle
before an update occurs- Specified by:
onPreUpdate
in interfaceHibGrouperLifecycle
- Overrides:
onPreUpdate
in classGrouperAPI
- See Also:
-
dbVersion
save the state when retrieving from DB- Overrides:
dbVersion
in classGrouperAPI
- Returns:
- the dbVersion
-
dbVersionDifferentFields
note, these are massaged so that name, extension, etc look like normal fields. access with fieldValue()- Overrides:
dbVersionDifferentFields
in classGrouperAPI
- Returns:
- a set of attributes changed, or empty set if none
- See Also:
-
dbVersionReset
public void dbVersionReset()take a snapshot of the data since this is what is in the db- Overrides:
dbVersionReset
in classGrouperAPI
-
clone
deep clone the fields in this object- Specified by:
clone
in interfaceGrouperCloneable
- Specified by:
clone
in classGrouperAPI
- Returns:
- the clone of the object
- See Also:
-
store
public void store()store this object to the DB. -
xmlCopyBusinessPropertiesToExisting
Description copied from interface:XmlImportableBase
copy business (non update) properties to an existing record- Specified by:
xmlCopyBusinessPropertiesToExisting
in interfaceXmlImportableBase<Field>
- See Also:
-
xmlDifferentBusinessProperties
Description copied from interface:XmlImportableBase
see if the non update cols are different (e.g. name)- Specified by:
xmlDifferentBusinessProperties
in interfaceXmlImportableBase<Field>
- Parameters:
other
- the one to compare with- Returns:
- true if so
- See Also:
-
xmlDifferentUpdateProperties
Description copied from interface:XmlImportableBase
see if the update cols are different (e.g. last updated)- Specified by:
xmlDifferentUpdateProperties
in interfaceXmlImportableBase<Field>
- Parameters:
other
- the one to compare with- Returns:
- true if so
- See Also:
-
xmlRetrieveByIdOrKey
Description copied from interface:XmlImportable
retrieve from db by id or key. throws exception if duplicate- Specified by:
xmlRetrieveByIdOrKey
in interfaceXmlImportable<Field>
- Returns:
- the object or null if not found
- See Also:
-
xmlSaveBusinessProperties
Description copied from interface:XmlImportableBase
save the business properties (not update properties)- Specified by:
xmlSaveBusinessProperties
in interfaceXmlImportableBase<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:
-
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 interfaceXmlImportableBase<Field>
- See Also:
-
xmlToExportField
convert to xml bean for export- Parameters:
grouperVersion
-- Returns:
- xml bean
-
xmlGetId
Description copied from interface:XmlImportableBase
set id key in db- Specified by:
xmlGetId
in interfaceXmlImportableBase<Field>
- Returns:
- id
- See Also:
-
xmlSetId
Description copied from interface:XmlImportableBase
set id key in db- Specified by:
xmlSetId
in interfaceXmlImportableBase<Field>
- See Also:
-
xmlToString
Description copied from interface:XmlImportableBase
convert to string for log- Specified by:
xmlToString
in interfaceXmlImportableBase<Field>
- Returns:
- the string value for log
- See Also:
-
getGroupType
- Parameters:
exceptionIfNoGroupType
-- Returns:
- group type
-
getGroupType
- Returns:
- group type
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Field>
- See Also:
-
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 nulluuid
-- Returns:
- the field
- Throws:
InsufficientPrivilegeException
SchemaException
-