Class GrouperConfigHibernate

java.lang.Object
edu.internet2.middleware.grouper.GrouperAPI
edu.internet2.middleware.grouper.cfg.dbConfig.GrouperConfigHibernate
All Implemented Interfaces:
GrouperCacheDatabaseClear, HibGrouperLifecycle, Hib3GrouperVersioned, GrouperCloneable, GrouperUtil.FieldValuable, Serializable, Comparable<GrouperConfigHibernate>, org.hibernate.classic.Lifecycle

public class GrouperConfigHibernate extends GrouperAPI implements Hib3GrouperVersioned, Comparable<GrouperConfigHibernate>, GrouperCacheDatabaseClear
database configuration
See Also:
  • Field Details

    • ESCAPED_PASSWORD

      public static final String ESCAPED_PASSWORD
      See Also:
    • COLUMN_ID

      public static final String COLUMN_ID
      db uuid for this row
      See Also:
    • FIELD_CONFIG_COMMENT

      public static final String FIELD_CONFIG_COMMENT
      constant for field name for: configComment
      See Also:
    • FIELD_CONFIG_ENCRYPTED

      public static final String FIELD_CONFIG_ENCRYPTED
      constant for field name for: configEncrypted
      See Also:
    • FIELD_CONFIG_FILE_HIERARCHY

      public static final String FIELD_CONFIG_FILE_HIERARCHY
      constant for field name for: configFileHierarchy
      See Also:
    • FIELD_CONFIG_FILE_NAME

      public static final String FIELD_CONFIG_FILE_NAME
      constant for field name for: configFileName
      See Also:
    • FIELD_CONFIG_KEY

      public static final String FIELD_CONFIG_KEY
      constant for field name for: configKey
      See Also:
    • FIELD_CONFIG_SEQUENCE

      public static final String FIELD_CONFIG_SEQUENCE
      constant for field name for: configSequence
      See Also:
    • FIELD_CONFIG_VALUE

      public static final String FIELD_CONFIG_VALUE
      constant for field name for: configValue
      See Also:
    • FIELD_CONFIG_VALUE_CLOB

      public static final String FIELD_CONFIG_VALUE_CLOB
      constant for field name for: configValueClob
      See Also:
    • FIELD_CONFIG_VALUE_BYTES

      public static final String FIELD_CONFIG_VALUE_BYTES
      constant for field name for: configValueBytes
      See Also:
    • FIELD_CONFIG_VERSION_INDEX

      public static final String FIELD_CONFIG_VERSION_INDEX
      constant for field name for: configVersionIndex
      See Also:
    • FIELD_CONTEXT_ID

      public static final String FIELD_CONTEXT_ID
      constant for field name for: contextId
      See Also:
    • FIELD_ID

      public static final String FIELD_ID
      constant for field name for: id
      See Also:
    • FIELD_LAST_UPDATED_DB

      public static final String FIELD_LAST_UPDATED_DB
      constant for field name for: lastUpdatedDb
      See Also:
    • COLUMN_HIBERNATE_VERSION_NUMBER

      public static final String COLUMN_HIBERNATE_VERSION_NUMBER
      hibernate version
      See Also:
    • COLUMN_CONFIG_KEY

      public static final String COLUMN_CONFIG_KEY
      key of the property
      See Also:
    • COLUMN_CONFIG_VALUE

      public static final String COLUMN_CONFIG_VALUE
      value of the property
      See Also:
    • COLUMN_CONFIG_VALUE_CLOB

      public static final String COLUMN_CONFIG_VALUE_CLOB
      value when it's too big for config_value
      See Also:
    • COLUMN_CONFIG_VALUE_BYTES

      public static final String COLUMN_CONFIG_VALUE_BYTES
      size of the config value
      See Also:
    • COLUMN_CONFIG_COMMENT

      public static final String COLUMN_CONFIG_COMMENT
      comment of the property
      See Also:
    • COLUMN_CONFIG_SEQUENCE

      public static final String COLUMN_CONFIG_SEQUENCE
      if there is more data than fits in the column this is the 0 indexed order
      See Also:
    • COLUMN_CONFIG_FILE_NAME

      public static final String COLUMN_CONFIG_FILE_NAME
      config file, e.g. grouper.properties
      See Also:
    • COLUMN_CONFIG_FILE_HIERARCHY

      public static final String COLUMN_CONFIG_FILE_HIERARCHY
      config file hierarchy, e.g. BASE, INSTITUTION, ENVIRONMENT, GROUPER_ENGINE
      See Also:
    • COLUMN_LAST_UPDATED

      public static final String COLUMN_LAST_UPDATED
      millis since 1970 this row was last updated
      See Also:
    • COLUMN_CONFIG_VERSION_INDEX

      public static final String COLUMN_CONFIG_VERSION_INDEX
      for built in configs, this is the index that will identify if the database configs should be replaced from the java code
      See Also:
    • COLUMN_CONFIG_ENCRYPTED

      public static final String COLUMN_CONFIG_ENCRYPTED
      if this is a password or for whatever other reason is encrypted
      See Also:
    • TABLE_GROUPER_CONFIG

      public static final String TABLE_GROUPER_CONFIG
      name of the table in the database.
      See Also:
  • Constructor Details

    • GrouperConfigHibernate

      public GrouperConfigHibernate()
  • Method Details

    • 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:
    • getLastUpdated

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

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

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

      public void setLastUpdatedDb(Long lastUpdated1)
      when last updated
      Parameters:
      lastUpdated1 -
    • getConfigVersionIndex

      public int getConfigVersionIndex()
      for built in configs, this is the index that will identify if the database configs should be replaced from the java code
      Returns:
      the configVersionIndex
    • setConfigVersionIndex

      public void setConfigVersionIndex(int configVersionIndex1)
      for built in configs, this is the index that will identify if the database configs should be replaced from the java code
      Parameters:
      configVersionIndex1 - the configVersionIndex to set
    • getConfigValueDb

      public String getConfigValueDb()
      value of the property
      Returns:
      the configValue
    • retrieveValue

      public String retrieveValue()
      retrieve value. based on the size, it will be retrieved from config_value or config_value_clob
      Returns:
    • setValueToSave

      public void setValueToSave(String value)
      set config value to save. based on the size, it will be saved in config_value or config_value_clob
      Parameters:
      value -
    • setConfigValueDb

      public void setConfigValueDb(String configValue1)
      value of the property
      Parameters:
      configValue1 - the configValue to set
    • getConfigValueClobDb

      public String getConfigValueClobDb()
      clob value of the property
      Returns:
      the configValueClob
    • getConfigValueClob

      public String getConfigValueClob()
      clob value of the property
      Returns:
      the configValueClob
    • setConfigValueClobDb

      public void setConfigValueClobDb(String configValueClob1)
      value of the property
      Parameters:
      configValueClob1 - the configValueClob to set
    • getConfigValueBytes

      public Long getConfigValueBytes()
      size of config value in bytes
      Returns:
      the configValueBytes
    • setConfigValueBytes

      public void setConfigValueBytes(Long configValueBytes)
      size of config value in bytes
      Parameters:
      the - configValueBytes
    • getConfigSequence

      public int getConfigSequence()
      if there is more data than fits in the column this is the 0 indexed order
      Returns:
      the configSequence
    • setConfigSequence

      public void setConfigSequence(int configSequence1)
      if there is more data than fits in the column this is the 0 indexed order
      Parameters:
      configSequence1 - the configSequence to set
    • getConfigKey

      public String getConfigKey()
      key of the property
      Returns:
      the configKey
    • setConfigKey

      public void setConfigKey(String configKey1)
      key of the property
      Parameters:
      configKey1 - the configKey to set
    • getConfigFileNameDb

      public String getConfigFileNameDb()
      config file, e.g. grouper.properties
      Returns:
      the configFileName
    • setConfigFileNameDb

      public void setConfigFileNameDb(String configFileName)
      config file, e.g. grouper.properties
      Parameters:
      configFileName - the configFileName to set
    • getConfigFileHierarchyDb

      public String getConfigFileHierarchyDb()
      Returns:
      the configFileHierarchy
    • setConfigFileHierarchyDb

      public void setConfigFileHierarchyDb(String configFileHierarchy)
      Parameters:
      configFileHierarchy - the configFileHierarchy to set
    • getConfigFileHierarchy

      public ConfigFileHierarchy getConfigFileHierarchy()
      Returns:
      the configFileHierarchy
    • setConfigFileHierarchy

      public void setConfigFileHierarchy(ConfigFileHierarchy configFileHierarchyEnum)
      Parameters:
      configFileHierarchyEnum - the configFileHierarchy to set
    • getConfigComment

      public String getConfigComment()
      Returns:
      the configComment
    • setConfigComment

      public void setConfigComment(String configComment1)
      Parameters:
      configComment1 - the configComment to set
    • getConfigEncryptedDb

      public String getConfigEncryptedDb()
      if this is a password or for whatever other reason is encrypted, T|F
      Returns:
      if config encrypted
    • setConfigEncryptedDb

      public void setConfigEncryptedDb(String theConfigEncrypted)
      if this is a password or for whatever other reason is encrypted
      Parameters:
      theConfigEncrypted -
    • isConfigEncrypted

      public boolean isConfigEncrypted()
      if this is a password or for whatever other reason is encrypted
      Returns:
      the configEncrypted
    • setConfigEncrypted

      public void setConfigEncrypted(boolean configEncrypted1)
      if this is a password or for whatever other reason is encrypted
      Parameters:
      configEncrypted1 - the configEncrypted to set
    • setId

      public void setId(String id1)
      Parameters:
      id1 - the id to set
    • getId

      public String getId()
      Returns:
      id
    • getContextId

      public String getContextId()
      Returns:
      context id
    • setContextId

      public void setContextId(String contextId1)
      set context id
      Parameters:
      contextId1 -
    • createNewPITGrouperConfigHibernate

      public static void createNewPITGrouperConfigHibernate(String auditEntryId, String newActiveStatus, GrouperConfigHibernate config, String previousConfigValue, String previousConfigValueClob)
      create a new PIT grouper config entry in the database based on the grouper config
      Parameters:
      auditEntryId -
      config -
    • saveOrUpdate

      public void saveOrUpdate(boolean addNew)
      save or update this object
    • isPassword

      public static boolean isPassword(ConfigFileName configFileName, ConfigItemMetadata configItemMetadata, String key, String value, boolean hasValue, Boolean userSelectedPassword)
      see if password based on various factors
      Parameters:
      configFileName - if known or null if not
      configItemMetadata - if known or null if not
      key - or null if not known
      value - if there is one at this point or null if not
      hasValue - true if there is a value, false if not
      userSelectedPassword - true if the user selected that this is a password. null if NA
      Returns:
      true if password
    • isPasswordHelper

      public static boolean isPasswordHelper(ConfigItemMetadata configItemMetadata)
      see if password based on various factors
      Parameters:
      configItemMetadata -
      Returns:
      true if password
    • isPasswordHelper

      public static boolean isPasswordHelper(ConfigItemMetadata configItemMetadata, String propertyValueString)
      if the value is a file and it exists, then this is not a password to be escaped
      Parameters:
      configItemMetadata -
      propertyValueString -
      Returns:
      true if should be escaped
    • isPasswordHelper

      public static boolean isPasswordHelper(ConfigFileName configFileName, ConfigItemMetadata configItemMetadata, String key, String value, boolean hasValue, Boolean userSelectedPassword)
      see if password based on various factors
      Parameters:
      configFileName -
      configItemMetadata -
      key -
      value -
      hasValue -
      userSelectedPassword -
      Returns:
      true if password
    • delete

      public void delete()
      delete this object
    • registerDatabaseCache

      public static void registerDatabaseCache()
    • updateLastUpdated

      public static void updateLastUpdated()
      update last updated if something changed
    • truncate

      public void truncate()
      make sure this object will fit in the DB
    • setConfigValueClob

      public void setConfigValueClob(String configValueClob1)
      clob value of the property
      Parameters:
      configValueClob1 - the configValueClob to set
    • dbVersionDifferentFields

      public Set<String> dbVersionDifferentFields(boolean failIfNull)
      Parameters:
      failIfNull -
      Returns:
      the set of different fields
      See Also:
    • 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 GrouperConfigHibernate 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:
    • equals

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

      public int compareTo(GrouperConfigHibernate otherConfig)
      Specified by:
      compareTo in interface Comparable<GrouperConfigHibernate>
      See Also:
    • hashCode

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

      public void setConfigFileName(ConfigFileName configFileName)
      config file, e.g. grouper.properties
      Parameters:
      configFileName - the configFileName to set
    • getConfigFileName

      public ConfigFileName getConfigFileName()
      Returns:
      the configFileName
    • clear

      public void clear(GrouperCacheDatabaseClearInput grouperCacheDatabaseClearInput)
      clear the cache when the database tells us to
      Specified by:
      clear in interface GrouperCacheDatabaseClear
    • clearConfigsInMemory

      public static void clearConfigsInMemory()
      clear the cache when the database tells us to