Class TableIndex
java.lang.Object
edu.internet2.middleware.grouper.GrouperAPI
edu.internet2.middleware.grouper.tableIndex.TableIndex
- All Implemented Interfaces:
HibGrouperLifecycle
,Hib3GrouperVersioned
,GrouperCloneable
,GrouperUtil.FieldValuable
,Serializable
,org.hibernate.classic.Lifecycle
Keep track of last index for groups, stems, attribute definitions, and attribute names
grab a certain number of indices, and update the table in an autonomous transaction.
If it doesnt work, try again some more (20 times?). This holds the type and
last index. The static methods in this class will allow safe access to an index
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
constant for field name for: createdOnDbstatic final String
constant for field name for: idstatic final String
columnstatic final String
constant for field name for: lastUpdatedDbstatic final String
constant for field name for: typestatic final String
name of the grouper table index tableFields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, dbVersion, FIELD_DB_VERSION, 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 void
make sure the current user can assign id indexstatic void
clearReservedId
(TableIndexType tableIndexType, long id) clear reserved id in case an existing one was usedstatic void
clearReservedIds
(TableIndexType tableIndexType) clear all idsclone()
deep clone the fields in this objectsave the statGrouperTableIndexretrieving from DBsee which fields have changed compared to the DB state (last known) note that attributes will print out: attribute__attributeNamevoid
take a snapshot of the data since this is what is in the dbvoid
delete()
delete this objectboolean
when createdwhen createdgetId()
long
last index reserved, stored in JVMwhen last updatedwhen last updatedgetType()
type of index, group, stem, attributeDef, attributeDefName, etcget string value of type for hibernateint
hashCode()
void
onPreSave
(HibernateSession hibernateSession) before a save (insert) occursvoid
onPreUpdate
(HibernateSession hibernateSession) before an update occursstatic long
reserveId
(TableIndexType tableIndexType) get an id for this type of object, if needed, increment the index in the databasereserveIds
(TableIndexType tableIndexType, int count) get ids for this type of object, if needed, increment the index in the databasevoid
save or update this objectvoid
setCreatedOn
(Timestamp createdOn1) when createdvoid
setCreatedOnDb
(Long createdOn1) when createdvoid
set idvoid
setLastIndexReserved
(long lastIndexReserved1) last index reserved, stored in JVMvoid
setLastUpdated
(Timestamp lastUpdated1) when last updatedvoid
setLastUpdatedDb
(Long lastUpdated1) when last updatedvoid
setType
(TableIndexType type1) set stem set assignment typevoid
type of index, group, stem, attributeDef, attributeDefName, etctoString()
Methods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersionClear, dbVersionIsDifferent, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onPostDelete, onPostSave, onPostUpdate, onPreDelete, onSave, onUpdate, setHibernateVersionNumber
-
Field Details
-
TABLE_GROUPER_TABLE_INDEX
name of the grouper table index table- See Also:
-
COLUMN_CREATED_ON
column- See Also:
-
COLUMN_LAST_UPDATED
column- See Also:
-
COLUMN_ID
column- See Also:
-
COLUMN_TYPE
column- See Also:
-
COLUMN_LAST_INDEX_RESERVED
column- See Also:
-
FIELD_CREATED_ON_DB
constant for field name for: createdOnDb- See Also:
-
FIELD_ID
constant for field name for: id- See Also:
-
FIELD_LAST_UPDATED_DB
constant for field name for: lastUpdatedDb- See Also:
-
FIELD_TYPE
constant for field name for: type- See Also:
-
FIELD_LAST_INDEX_RESERVED
column- See Also:
-
-
Constructor Details
-
TableIndex
public TableIndex()
-
-
Method Details
-
assertCanAssignIdIndex
public static void assertCanAssignIdIndex()make sure the current user can assign id index -
toString
-
equals
-
hashCode
public int hashCode() -
getId
- Returns:
- id
-
setId
set id- Parameters:
id
-
-
getType
type of index, group, stem, attributeDef, attributeDefName, etc- Returns:
- type
-
getTypeDb
get string value of type for hibernate- Returns:
- type
-
setType
set stem set assignment type- Parameters:
type1
-
-
setTypeDb
type of index, group, stem, attributeDef, attributeDefName, etc- Parameters:
type1
-
-
getCreatedOn
when created- Returns:
- timestamp
-
getCreatedOnDb
when created- Returns:
- timestamp
-
getLastUpdated
when last updated- Returns:
- timestamp
-
getLastUpdatedDb
when last updated- Returns:
- timestamp
-
saveOrUpdate
public void saveOrUpdate()save or update this object -
delete
public void delete()delete this object -
setCreatedOnDb
when created- Parameters:
createdOn1
-
-
setCreatedOn
when created- Parameters:
createdOn1
-
-
setLastUpdated
when last updated- Parameters:
lastUpdated1
-
-
setLastUpdatedDb
when last updated- Parameters:
lastUpdated1
-
-
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:
-
getLastIndexReserved
public long getLastIndexReserved()last index reserved, stored in JVM- Returns:
-
setLastIndexReserved
public void setLastIndexReserved(long lastIndexReserved1) last index reserved, stored in JVM- Parameters:
lastIndexReserved1
-
-
dbVersion
save the statGrouperTableIndexretrieving from DB- Overrides:
dbVersion
in classGrouperAPI
- Returns:
- the db version
-
dbVersionReset
public void dbVersionReset()take a snapshot of the data since this is what is in the db- Overrides:
dbVersionReset
in classGrouperAPI
-
dbVersionDifferentFields
Description copied from class:GrouperAPI
see which fields have changed compared to the DB state (last known) note that attributes will print out: attribute__attributeName- Overrides:
dbVersionDifferentFields
in classGrouperAPI
- Returns:
- a set of attributes changed, or empty set if none
- See Also:
-
clone
Description copied from class:GrouperAPI
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:
-
clearReservedId
clear reserved id in case an existing one was used- Parameters:
tableIndexType
-
-
clearReservedIds
clear all ids- Parameters:
tableIndexType
-
-
reserveIds
get ids for this type of object, if needed, increment the index in the database- Parameters:
tableIndexType
-count
-- Returns:
- the id that can be used for the type of object
-
reserveId
get an id for this type of object, if needed, increment the index in the database- Parameters:
tableIndexType
-- Returns:
- the id that can be used for the type of object
-