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

public class TableIndex extends GrouperAPI implements Hib3GrouperVersioned
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 Details

  • Constructor Details

    • TableIndex

      public TableIndex()
  • Method Details

    • assertCanAssignIdIndex

      public static void assertCanAssignIdIndex()
      make sure the current user can assign id index
    • toString

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

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

      public String getId()
      Returns:
      id
    • setId

      public void setId(String id)
      set id
      Parameters:
      id -
    • getType

      public TableIndexType getType()
      type of index, group, stem, attributeDef, attributeDefName, etc
      Returns:
      type
    • getTypeDb

      public String getTypeDb()
      get string value of type for hibernate
      Returns:
      type
    • setType

      public void setType(TableIndexType type1)
      set stem set assignment type
      Parameters:
      type1 -
    • setTypeDb

      public void setTypeDb(String type1)
      type of index, group, stem, attributeDef, attributeDefName, etc
      Parameters:
      type1 -
    • getCreatedOn

      public Timestamp getCreatedOn()
      when created
      Returns:
      timestamp
    • getCreatedOnDb

      public Long getCreatedOnDb()
      when created
      Returns:
      timestamp
    • getLastUpdated

      public Timestamp getLastUpdated()
      when last updated
      Returns:
      timestamp
    • getLastUpdatedDb

      public Long getLastUpdatedDb()
      when last updated
      Returns:
      timestamp
    • saveOrUpdate

      public void saveOrUpdate()
      save or update this object
    • delete

      public void delete()
      delete this object
    • setCreatedOnDb

      public void setCreatedOnDb(Long createdOn1)
      when created
      Parameters:
      createdOn1 -
    • setCreatedOn

      public void setCreatedOn(Timestamp createdOn1)
      when created
      Parameters:
      createdOn1 -
    • setLastUpdated

      public void setLastUpdated(Timestamp lastUpdated1)
      when last updated
      Parameters:
      lastUpdated1 -
    • setLastUpdatedDb

      public void setLastUpdatedDb(Long lastUpdated1)
      when last updated
      Parameters:
      lastUpdated1 -
    • 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:
    • 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:
    • 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

      public TableIndex dbVersion()
      save the statGrouperTableIndexretrieving from DB
      Overrides:
      dbVersion in class GrouperAPI
      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 class GrouperAPI
    • dbVersionDifferentFields

      public Set<String> 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 class GrouperAPI
      Returns:
      a set of attributes changed, or empty set if none
      See Also:
    • clone

      public GrouperAPI clone()
      Description copied from class: GrouperAPI
      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:
    • clearReservedId

      public static void clearReservedId(TableIndexType tableIndexType, long id)
      clear reserved id in case an existing one was used
      Parameters:
      tableIndexType -
    • clearReservedIds

      public static void clearReservedIds(TableIndexType tableIndexType)
      clear all ids
      Parameters:
      tableIndexType -
    • reserveIds

      public static List<Long> reserveIds(TableIndexType tableIndexType, int count)
      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

      public static long reserveId(TableIndexType tableIndexType)
      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