Package net.solarnetwork.node.dao.jdbc
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.solarnetwork.node.dao.BatchableDao
net.solarnetwork.node.dao.BatchableDao.BatchCallback<T extends Object>, net.solarnetwork.node.dao.BatchableDao.BatchCallbackResult, net.solarnetwork.node.dao.BatchableDao.BatchOptions, net.solarnetwork.node.dao.BatchableDao.BatchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe SQL resource for a a batch fetch.static final StringThe SQL resource for a fetch for update.static final StringThe SQL resource for a search.static final StringThe SQL resource for a fetch for date.static final StringThe SQL resource for a fetch for most recent date.static final StringThe SQL resource for a non-typed fetch.static final StringThe SQL resource for a typed fetch.Fields inherited from class net.solarnetwork.node.dao.jdbc.AbstractBatchableJdbcDao
logFields inherited from class org.springframework.dao.support.DaoSupport
loggerFields inherited from interface net.solarnetwork.node.dao.SettingDao
EVENT_TOPIC_SETTING_CHANGED, SETTING_KEY, SETTING_TYPE, SETTING_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteSetting(String key) booleandeleteSetting(String key, String type) protected StringgetBatchJdbcStatement(net.solarnetwork.node.dao.BatchableDao.BatchOptions options) Get the SQL statement to use for batch processing.protected net.solarnetwork.node.domain.SettinggetBatchRowEntity(net.solarnetwork.node.dao.BatchableDao.BatchOptions options, ResultSet resultSet, int rowCount) Get an entity from the current row in a ResultSet for batch processing.net.solarnetwork.service.OptionalService<org.osgi.service.event.EventAdmin>Get the EventAdmin service.getSetting(String key) getSetting(String key, String type) getSettingModificationDate(String key, String type) List<net.solarnetwork.domain.KeyValuePair>getSettingValues(String key) net.solarnetwork.node.domain.SettingreadSetting(String key, String type) voidsetEventAdmin(net.solarnetwork.service.OptionalService<org.osgi.service.event.EventAdmin> eventAdmin) An optionalEventAdminservice to use.voidstoreSetting(String key, String value) voidstoreSetting(String key, String type, String value) voidstoreSetting(net.solarnetwork.node.domain.Setting setting) protected voidupdateBatchRowEntity(net.solarnetwork.node.dao.BatchableDao.BatchOptions options, ResultSet resultSet, int rowCount, net.solarnetwork.node.domain.Setting entity) Update the current row in a ResulSet for batch processing.Methods inherited from class net.solarnetwork.node.dao.jdbc.AbstractBatchableJdbcDao
batchProcess, getBatchSqlResource, getSqlForUpdateSuffix, getSqlResource, getSqlResource, getSqlResourcePrefix, getTransactionTemplate, setSqlForUpdateSuffix, setSqlResourcePrefix, setTransactionTemplateMethods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplateMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDaoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.node.dao.BatchableDao
batchProcess
-
Field Details
-
SQL_RESOURCE_NON_TYPED_GET
The SQL resource for a non-typed fetch.- See Also:
-
SQL_RESOURCE_TYPED_GET
The SQL resource for a typed fetch.- See Also:
-
SQL_RESOURCE_FIND
The SQL resource for a search.- See Also:
-
SQL_RESOURCE_BATCH_GET_FOR_UPDATE
The SQL resource for a fetch for update.- See Also:
-
SQL_RESOURCE_BATCH_GET
The SQL resource for a a batch fetch.- See Also:
-
SQL_RESOURCE_GET_DATE
The SQL resource for a fetch for date.- See Also:
-
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
- Specified by:
deleteSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
getSetting
- Specified by:
getSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
storeSetting
- Specified by:
storeSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
deleteSetting
- Specified by:
deleteSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
getSetting
- Specified by:
getSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
getSettingValues
- Specified by:
getSettingValuesin interfacenet.solarnetwork.node.dao.SettingDao
-
storeSetting
- Specified by:
storeSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
storeSetting
public void storeSetting(net.solarnetwork.node.domain.Setting setting) - Specified by:
storeSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
readSetting
- Specified by:
readSettingin interfacenet.solarnetwork.node.dao.SettingDao
-
getSettingModificationDate
- Specified by:
getSettingModificationDatein interfacenet.solarnetwork.node.dao.SettingDao
-
getMostRecentModificationDate
- Specified by:
getMostRecentModificationDatein interfacenet.solarnetwork.node.dao.SettingDao
-
getBatchJdbcStatement
Description copied from class:AbstractBatchableJdbcDaoGet the SQL statement to use for batch processing.- Specified by:
getBatchJdbcStatementin classAbstractBatchableJdbcDao<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:AbstractBatchableJdbcDaoGet an entity from the current row in a ResultSet for batch processing.- Specified by:
getBatchRowEntityin classAbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting>- Parameters:
options- the requested batch optionsresultSet- the current ResultSet, positioned on the next rowrowCount- 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:AbstractBatchableJdbcDaoUpdate the current row in a ResulSet for batch processing.The
ResultSet.updateRow()method should not be called within this method.- Specified by:
updateBatchRowEntityin classAbstractBatchableJdbcDao<net.solarnetwork.node.domain.Setting>- Parameters:
options- the requested batch optionsresultSet- the current ResultSet, positioned on the next rowrowCount- 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 optionalEventAdminservice to use.- Parameters:
eventAdmin- The event admin service to use.
-