Interface SettingRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<SettingEntity, Long>, org.springframework.data.jpa.repository.JpaRepository<SettingEntity, Long>, org.springframework.data.repository.ListCrudRepository<SettingEntity, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<SettingEntity, Long>, org.springframework.data.repository.PagingAndSortingRepository<SettingEntity, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<SettingEntity>, org.springframework.data.repository.Repository<SettingEntity, Long>

@Repository public interface SettingRepository extends org.springframework.data.jpa.repository.JpaRepository<SettingEntity, Long>
Repository for Setting entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Delete setting by key.
    boolean
    Check if setting exists by key.
    findByCategoryAndVisibleTrueOrderByDisplayOrderAsc(ai.nervemind.common.enums.SettingCategory category)
    Find all visible settings in a category.
    findByCategoryOrderByDisplayOrderAsc(ai.nervemind.common.enums.SettingCategory category)
    Find all settings in a category.
    Find setting by unique key.
    Find settings by key prefix (e.g., "ai.openai." for all OpenAI settings).
    Find settings requiring restart.
    Find all visible settings.
    Search settings by key or label.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByKey

      Optional<SettingEntity> findByKey(String key)
      Find setting by unique key.
      Parameters:
      key - the setting key to search for
      Returns:
      optional containing the setting if found
    • findByCategoryOrderByDisplayOrderAsc

      List<SettingEntity> findByCategoryOrderByDisplayOrderAsc(ai.nervemind.common.enums.SettingCategory category)
      Find all settings in a category.
      Parameters:
      category - the category to filter by
      Returns:
      list of settings in the category, ordered by display order
    • findByCategoryAndVisibleTrueOrderByDisplayOrderAsc

      List<SettingEntity> findByCategoryAndVisibleTrueOrderByDisplayOrderAsc(ai.nervemind.common.enums.SettingCategory category)
      Find all visible settings in a category.
      Parameters:
      category - the category to filter by
      Returns:
      list of visible settings in the category, ordered by display order
    • findByVisibleTrueOrderByCategoryAscDisplayOrderAsc

      List<SettingEntity> findByVisibleTrueOrderByCategoryAscDisplayOrderAsc()
      Find all visible settings.
      Returns:
      list of all visible settings, ordered by category then display order
    • findByKeyPrefix

      @Query("SELECT s FROM SettingEntity s WHERE s.key LIKE :prefix% ORDER BY s.displayOrder ASC") List<SettingEntity> findByKeyPrefix(String prefix)
      Find settings by key prefix (e.g., "ai.openai." for all OpenAI settings).
      Parameters:
      prefix - the key prefix to search for
      Returns:
      list of settings with keys starting with the prefix
    • deleteByKey

      void deleteByKey(String key)
      Delete setting by key.
      Parameters:
      key - the key of the setting to delete
    • existsByKey

      boolean existsByKey(String key)
      Check if setting exists by key.
      Parameters:
      key - the key to check for existence
      Returns:
      true if a setting with the key exists
    • findByRequiresRestartTrue

      List<SettingEntity> findByRequiresRestartTrue()
      Find settings requiring restart.
      Returns:
      list of settings that require application restart when changed
    • searchSettings

      @Query("SELECT s FROM SettingEntity s WHERE s.visible = true AND (LOWER(s.key) LIKE LOWER(CONCAT('%', :query, '%')) OR LOWER(s.label) LIKE LOWER(CONCAT('%', :query, '%')) OR LOWER(s.description) LIKE LOWER(CONCAT('%', :query, '%')))") List<SettingEntity> searchSettings(String query)
      Search settings by key or label.
      Parameters:
      query - the search query to match against keys and labels
      Returns:
      list of settings matching the search query