Class SettingEntity

java.lang.Object
ai.nervemind.app.database.model.SettingEntity

@Entity public class SettingEntity extends Object
JPA Entity for Application Settings. Stores user preferences and application configuration as key-value pairs. Sensitive values (type=PASSWORD) are stored encrypted.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor for JPA entity instantiation.
     
    SettingEntity(String key, String value, ai.nervemind.common.enums.SettingCategory category, ai.nervemind.common.enums.SettingType type)
    Creates a new setting entity with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    ai.nervemind.common.enums.SettingCategory
    Gets the category this setting belongs to.
    Gets the timestamp when this setting was first created.
    Gets the description of this setting.
    Gets the display order for this setting within its category.
    Gets the unique identifier of this setting.
    Gets the unique key identifier for this setting.
    Gets the human-readable label for this setting.
    ai.nervemind.common.enums.SettingType
    Gets the data type of this setting's value.
    Gets the timestamp when this setting was last updated.
    Gets the validation rules for this setting's value.
    Gets the value of this setting as a string.
    boolean
    Checks if changing this setting requires an application restart.
    boolean
    Checks if this setting should be visible in the UI.
    protected void
    Lifecycle callback executed before the entity is persisted.
    protected void
    Lifecycle callback executed before the entity is updated.
    void
    setCategory(ai.nervemind.common.enums.SettingCategory category)
    Sets the category this setting belongs to.
    void
    setDescription(String description)
    Sets the description of this setting.
    void
    setDisplayOrder(Integer displayOrder)
    Sets the display order for this setting within its category.
    void
    setId(Long id)
    Sets the unique identifier of this setting.
    void
    Sets the unique key identifier for this setting.
    void
    Sets the human-readable label for this setting.
    void
    setRequiresRestart(boolean requiresRestart)
    Sets whether changing this setting requires an application restart.
    void
    setType(ai.nervemind.common.enums.SettingType type)
    Sets the data type of this setting's value.
    void
    setValidationRules(String validationRules)
    Sets the validation rules for this setting's value.
    void
    Sets the value of this setting.
    void
    setVisible(boolean visible)
    Sets whether this setting should be visible in the UI.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SettingEntity

      protected SettingEntity()
      Default constructor for JPA entity instantiation. Required for JPA proxy creation and deserialization.
    • SettingEntity

      public SettingEntity(String key, String value, ai.nervemind.common.enums.SettingCategory category, ai.nervemind.common.enums.SettingType type)
      Creates a new setting entity with the specified parameters. Timestamps are automatically set to current time.
      Parameters:
      key - the unique setting key identifier
      value - the setting value as a string
      category - the category this setting belongs to
      type - the data type of the setting value
  • Method Details

    • onCreate

      protected void onCreate()
      Lifecycle callback executed before the entity is persisted. Initializes timestamps if not already set.
    • onUpdate

      protected void onUpdate()
      Lifecycle callback executed before the entity is updated. Updates the last modified timestamp.
    • getId

      public Long getId()
      Gets the unique identifier of this setting.
      Returns:
      the setting ID, or null if not yet persisted
    • setId

      public void setId(Long id)
      Sets the unique identifier of this setting. This method is primarily used by JPA and should not be called directly.
      Parameters:
      id - the setting ID to set
    • getKey

      public String getKey()
      Gets the unique key identifier for this setting.
      Returns:
      the setting key (e.g., "general.theme")
    • setKey

      public void setKey(String key)
      Sets the unique key identifier for this setting.
      Parameters:
      key - the setting key to set (e.g., "general.theme")
    • getValue

      public String getValue()
      Gets the value of this setting as a string. For PASSWORD type settings, this returns the encrypted value.
      Returns:
      the setting value as a string
    • setValue

      public void setValue(String value)
      Sets the value of this setting. For PASSWORD type settings, the value should be pre-encrypted.
      Parameters:
      value - the setting value to set as a string
    • getCategory

      public ai.nervemind.common.enums.SettingCategory getCategory()
      Gets the category this setting belongs to.
      Returns:
      the setting category
    • setCategory

      public void setCategory(ai.nervemind.common.enums.SettingCategory category)
      Sets the category this setting belongs to.
      Parameters:
      category - the setting category to set
    • getType

      public ai.nervemind.common.enums.SettingType getType()
      Gets the data type of this setting's value.
      Returns:
      the setting type
    • setType

      public void setType(ai.nervemind.common.enums.SettingType type)
      Sets the data type of this setting's value.
      Parameters:
      type - the setting type to set
    • getLabel

      public String getLabel()
      Gets the human-readable label for this setting.
      Returns:
      the setting label for UI display
    • setLabel

      public void setLabel(String label)
      Sets the human-readable label for this setting.
      Parameters:
      label - the setting label for UI display
    • getDescription

      public String getDescription()
      Gets the description of this setting.
      Returns:
      the setting description explaining its purpose
    • setDescription

      public void setDescription(String description)
      Sets the description of this setting.
      Parameters:
      description - the setting description explaining its purpose
    • isVisible

      public boolean isVisible()
      Checks if this setting should be visible in the UI.
      Returns:
      true if the setting should be displayed in the UI, false otherwise
    • setVisible

      public void setVisible(boolean visible)
      Sets whether this setting should be visible in the UI.
      Parameters:
      visible - true if the setting should be displayed in the UI, false otherwise
    • isRequiresRestart

      public boolean isRequiresRestart()
      Checks if changing this setting requires an application restart.
      Returns:
      true if the application needs to be restarted after changing this setting
    • setRequiresRestart

      public void setRequiresRestart(boolean requiresRestart)
      Sets whether changing this setting requires an application restart.
      Parameters:
      requiresRestart - true if the application needs to be restarted after changing this setting
    • getDisplayOrder

      public Integer getDisplayOrder()
      Gets the display order for this setting within its category.
      Returns:
      the display order (lower numbers appear first), or null for default ordering
    • setDisplayOrder

      public void setDisplayOrder(Integer displayOrder)
      Sets the display order for this setting within its category.
      Parameters:
      displayOrder - the display order (lower numbers appear first), or null for default ordering
    • getValidationRules

      public String getValidationRules()
      Gets the validation rules for this setting's value.
      Returns:
      the validation rules as a string, or null if no validation is required
    • setValidationRules

      public void setValidationRules(String validationRules)
      Sets the validation rules for this setting's value.
      Parameters:
      validationRules - the validation rules as a string, or null if no validation is required
    • getCreatedAt

      public Instant getCreatedAt()
      Gets the timestamp when this setting was first created.
      Returns:
      the creation timestamp
    • getUpdatedAt

      public Instant getUpdatedAt()
      Gets the timestamp when this setting was last updated.
      Returns:
      the last update timestamp