diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/db-lib')
-rw-r--r-- | ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt | 16 | ||||
-rw-r--r-- | ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt (renamed from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/service/PrimaryDBLibGenericService.kt) | 18 |
2 files changed, 20 insertions, 14 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt index 86420f9a..aee74d3f 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt @@ -25,4 +25,20 @@ interface BluePrintDBLibGenericService { fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>> fun update(sql: String, params: Map<String, Any>): Int +} + +abstract class AbstractDBLibGenericService(private val namedParameterJdbcTemplate: NamedParameterJdbcTemplate) + : BluePrintDBLibGenericService { + + override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate { + return namedParameterJdbcTemplate + } + + override fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>> { + return namedParameterJdbcTemplate.queryForList(sql, params) + } + + override fun update(sql: String, params: Map<String, Any>): Int { + return namedParameterJdbcTemplate.update(sql, params) + } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/service/PrimaryDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt index 87f32ef2..0e0f1e9c 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/service/PrimaryDBLibGenericService.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt @@ -14,25 +14,15 @@ * limitations under the License. */ -package org.onap.ccsdk.apps.blueprintsprocessor.db.primary.service +package org.onap.ccsdk.apps.blueprintsprocessor.db.primary +import org.onap.ccsdk.apps.blueprintsprocessor.db.AbstractDBLibGenericService import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibGenericService import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate import org.springframework.stereotype.Service @Service -class PrimaryDBLibGenericService(private val primaryNamedParameterJdbcTemplate: NamedParameterJdbcTemplate) - : BluePrintDBLibGenericService { +open class PrimaryDBLibGenericService(private val primaryNamedParameterJdbcTemplate: NamedParameterJdbcTemplate) + : AbstractDBLibGenericService(primaryNamedParameterJdbcTemplate) { - override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate { - return primaryNamedParameterJdbcTemplate - } - - override fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>> { - return primaryNamedParameterJdbcTemplate.queryForList(sql, params) - } - - override fun update(sql: String, params: Map<String, Any>): Int { - return primaryNamedParameterJdbcTemplate.update(sql, params) - } }
\ No newline at end of file |