Class JdbcSettingDao

java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.jdbc.core.support.JdbcDaoSupport
net.solarnetwork.node.dao.jdbc.AbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting>
net.solarnetwork.node.dao.jdbc.JdbcSettingDao
All Implemented Interfaces:
net.solarnetwork.node.dao.BatchableDao<net.solarnetwork.node.domain.Setting>, net.solarnetwork.node.dao.SettingDao, org.springframework.beans.factory.InitializingBean

public class JdbcSettingDao extends AbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting> implements net.solarnetwork.node.dao.SettingDao
Simple JDBC-based implementation of SettingDao.

The configurable properties of this class are:

sqlGet
The SQL statement to use for getting a row based on a String primary key. Accepts a single parameter: the String primary key to retrieve.
sqlDelete
The SQL statement to use for deleting an existing row. Accepts a single parameter: the String primary key to delete.
Version:
2.1
Author:
matt
  • Field Details

    • SQL_RESOURCE_NON_TYPED_GET

      public static final String SQL_RESOURCE_NON_TYPED_GET
      The SQL resource for a non-typed fetch.
      See Also:
    • SQL_RESOURCE_TYPED_GET

      public static final String SQL_RESOURCE_TYPED_GET
      The SQL resource for a typed fetch.
      See Also:
    • SQL_RESOURCE_FIND

      public static final String SQL_RESOURCE_FIND
      The SQL resource for a search.
      See Also:
    • SQL_RESOURCE_BATCH_GET_FOR_UPDATE

      public static final String SQL_RESOURCE_BATCH_GET_FOR_UPDATE
      The SQL resource for a fetch for update.
      See Also:
    • SQL_RESOURCE_BATCH_GET

      public static final String SQL_RESOURCE_BATCH_GET
      The SQL resource for a a batch fetch.
      See Also:
    • SQL_RESOURCE_GET_DATE

      public static final String SQL_RESOURCE_GET_DATE
      The SQL resource for a fetch for date.
      See Also:
    • SQL_RESOURCE_GET_MOST_RECENT_DATE

      public static final String SQL_RESOURCE_GET_MOST_RECENT_DATE
      The SQL resource for a fetch for most recent date.
      See Also:
  • Constructor Details

    • JdbcSettingDao

      public JdbcSettingDao()
      Constructor.
  • Method Details

    • deleteSetting

      public boolean deleteSetting(String key)
      Specified by:
      deleteSetting in interface net.solarnetwork.node.dao.SettingDao
    • getSetting

      public String getSetting(String key)
      Specified by:
      getSetting in interface net.solarnetwork.node.dao.SettingDao
    • storeSetting

      public void storeSetting(String key, String value)
      Specified by:
      storeSetting in interface net.solarnetwork.node.dao.SettingDao
    • deleteSetting

      public boolean deleteSetting(String key, String type)
      Specified by:
      deleteSetting in interface net.solarnetwork.node.dao.SettingDao
    • getSetting

      public String getSetting(String key, String type)
      Specified by:
      getSetting in interface net.solarnetwork.node.dao.SettingDao
    • getSettingValues

      public List<net.solarnetwork.domain.KeyValuePair> getSettingValues(String key)
      Specified by:
      getSettingValues in interface net.solarnetwork.node.dao.SettingDao
    • storeSetting

      public void storeSetting(String key, String type, String value)
      Specified by:
      storeSetting in interface net.solarnetwork.node.dao.SettingDao
    • storeSetting

      public void storeSetting(net.solarnetwork.node.domain.Setting setting)
      Specified by:
      storeSetting in interface net.solarnetwork.node.dao.SettingDao
    • readSetting

      public net.solarnetwork.node.domain.Setting readSetting(String key, String type)
      Specified by:
      readSetting in interface net.solarnetwork.node.dao.SettingDao
    • getSettingModificationDate

      public Date getSettingModificationDate(String key, String type)
      Specified by:
      getSettingModificationDate in interface net.solarnetwork.node.dao.SettingDao
    • getMostRecentModificationDate

      public Date getMostRecentModificationDate()
      Specified by:
      getMostRecentModificationDate in interface net.solarnetwork.node.dao.SettingDao
    • getBatchJdbcStatement

      protected String getBatchJdbcStatement(net.solarnetwork.node.dao.BatchableDao.BatchOptions options)
      Description copied from class: AbstractBatchableJdbcDao
      Get the SQL statement to use for batch processing.
      Specified by:
      getBatchJdbcStatement in class AbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting>
      Parameters:
      options - the requested batch options
      Returns:
      the SQL query
    • getBatchRowEntity

      protected net.solarnetwork.node.domain.Setting getBatchRowEntity(net.solarnetwork.node.dao.BatchableDao.BatchOptions options, ResultSet resultSet, int rowCount) throws SQLException
      Description copied from class: AbstractBatchableJdbcDao
      Get an entity from the current row in a ResultSet for batch processing.
      Specified by:
      getBatchRowEntity in class AbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting>
      Parameters:
      options - the requested batch options
      resultSet - the current ResultSet, positioned on the next row
      rowCount - the current count of rows processed (1-based)
      Returns:
      the entity
      Throws:
      SQLException - if any SQL error occurs
    • updateBatchRowEntity

      protected void updateBatchRowEntity(net.solarnetwork.node.dao.BatchableDao.BatchOptions options, ResultSet resultSet, int rowCount, net.solarnetwork.node.domain.Setting entity) throws SQLException
      Description copied from class: AbstractBatchableJdbcDao
      Update the current row in a ResulSet for batch processing.

      The ResultSet.updateRow() method should not be called within this method.

      Specified by:
      updateBatchRowEntity in class AbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting>
      Parameters:
      options - the requested batch options
      resultSet - the current ResultSet, positioned on the next row
      rowCount - the current count of rows processed (1-based)
      entity - the entity data to update
      Throws:
      SQLException - if any SQL error occurs
    • getEventAdmin

      public net.solarnetwork.service.OptionalService<org.osgi.service.event.EventAdmin> getEventAdmin()
      Get the EventAdmin service.
      Returns:
      the EventAdmin service
    • setEventAdmin

      public void setEventAdmin(net.solarnetwork.service.OptionalService<org.osgi.service.event.EventAdmin> eventAdmin)
      An optional EventAdmin service to use.
      Parameters:
      eventAdmin - The event admin service to use.