Class SettingEntity
java.lang.Object
ai.nervemind.app.database.model.SettingEntity
JPA Entity for Application Settings.
Stores user preferences and application configuration as key-value pairs.
Sensitive values (type=PASSWORD) are stored encrypted.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault 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 TypeMethodDescriptionai.nervemind.common.enums.SettingCategoryGets 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.getId()Gets the unique identifier of this setting.getKey()Gets the unique key identifier for this setting.getLabel()Gets the human-readable label for this setting.ai.nervemind.common.enums.SettingTypegetType()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.getValue()Gets the value of this setting as a string.booleanChecks if changing this setting requires an application restart.booleanChecks if this setting should be visible in the UI.protected voidonCreate()Lifecycle callback executed before the entity is persisted.protected voidonUpdate()Lifecycle callback executed before the entity is updated.voidsetCategory(ai.nervemind.common.enums.SettingCategory category) Sets the category this setting belongs to.voidsetDescription(String description) Sets the description of this setting.voidsetDisplayOrder(Integer displayOrder) Sets the display order for this setting within its category.voidSets the unique identifier of this setting.voidSets the unique key identifier for this setting.voidSets the human-readable label for this setting.voidsetRequiresRestart(boolean requiresRestart) Sets whether changing this setting requires an application restart.voidsetType(ai.nervemind.common.enums.SettingType type) Sets the data type of this setting's value.voidsetValidationRules(String validationRules) Sets the validation rules for this setting's value.voidSets the value of this setting.voidsetVisible(boolean visible) Sets whether this setting should be visible in the UI.
-
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 identifiervalue- the setting value as a stringcategory- the category this setting belongs totype- 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
Gets the unique identifier of this setting.- Returns:
- the setting ID, or null if not yet persisted
-
setId
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
Gets the unique key identifier for this setting.- Returns:
- the setting key (e.g., "general.theme")
-
setKey
Sets the unique key identifier for this setting.- Parameters:
key- the setting key to set (e.g., "general.theme")
-
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
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
Gets the human-readable label for this setting.- Returns:
- the setting label for UI display
-
setLabel
Sets the human-readable label for this setting.- Parameters:
label- the setting label for UI display
-
getDescription
Gets the description of this setting.- Returns:
- the setting description explaining its purpose
-
setDescription
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
Gets the display order for this setting within its category.- Returns:
- the display order (lower numbers appear first), or null for default ordering
-
setDisplayOrder
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
Gets the validation rules for this setting's value.- Returns:
- the validation rules as a string, or null if no validation is required
-
setValidationRules
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
Gets the timestamp when this setting was first created.- Returns:
- the creation timestamp
-
getUpdatedAt
Gets the timestamp when this setting was last updated.- Returns:
- the last update timestamp
-