2 * Copyright © 2017-2018 AT&T Intellectual Property.
\r
3 * Modifications Copyright © 2018 IBM.
\r
5 * Licensed under the Apache License, Version 2.0 (the "License");
\r
6 * you may not use this file except in compliance with the License.
\r
7 * You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
18 package org.onap.ccsdk.config.data.adaptor.service;
\r
20 import java.util.List;
\r
21 import java.util.Map;
\r
22 import org.onap.ccsdk.config.data.adaptor.dao.ConfigPropertyMapDao;
\r
23 import org.onap.ccsdk.config.data.adaptor.dao.ConfigResourceDao;
\r
24 import org.onap.ccsdk.config.data.adaptor.dao.NamedQueryExecutorDao;
\r
25 import org.onap.ccsdk.config.data.adaptor.dao.QueryExecutorDao;
\r
26 import org.onap.ccsdk.config.data.adaptor.dao.TransactionLogDao;
\r
27 import org.onap.ccsdk.config.data.adaptor.domain.ConfigResource;
\r
28 import org.onap.ccsdk.config.data.adaptor.domain.TransactionLog;
\r
29 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
\r
30 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
\r
31 import com.att.eelf.configuration.EELFLogger;
\r
32 import com.att.eelf.configuration.EELFManager;
\r
34 public class ConfigResourceServiceImpl implements ConfigResourceService {
\r
35 private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceServiceImpl.class);
\r
36 private static final String CLASS_NAME = "ConfigResourceServiceImpl";
\r
38 private TransactionLogDao transactionLogDao;
\r
39 private ConfigResourceDao configResourceDao;
\r
40 private QueryExecutorDao queryExecutorDao;
\r
41 private NamedQueryExecutorDao namedQueryExecutorDao;
\r
42 private ConfigPropertyMapDao configPropertyMapDao;
\r
44 @SuppressWarnings("squid:S00107")
\r
45 public ConfigResourceServiceImpl(TransactionLogDao transactionLogDao, ConfigResourceDao configResourceDao,
\r
46 QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao,
\r
47 ConfigPropertyMapDao configPropertyMapDao) {
\r
49 logger.info("{} Constuctor Initated...", CLASS_NAME);
\r
50 this.transactionLogDao = transactionLogDao;
\r
51 this.configResourceDao = configResourceDao;
\r
52 this.queryExecutorDao = queryExecutorDao;
\r
53 this.namedQueryExecutorDao = namedQueryExecutorDao;
\r
54 this.configPropertyMapDao = configPropertyMapDao;
\r
58 public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException {
\r
59 return namedQueryExecutorDao.getNamedParameterJdbcTemplate();
\r
63 public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {
\r
64 return namedQueryExecutorDao.query(sql, parameters);
\r
68 public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {
\r
69 return namedQueryExecutorDao.update(sql, parameters);
\r
73 public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {
\r
74 return queryExecutorDao.query(sql, data);
\r
78 public int update(String sql, Object[] data) throws SvcLogicException {
\r
79 return queryExecutorDao.update(sql, data);
\r
83 public void save(TransactionLog transactionLog) throws SvcLogicException {
\r
84 transactionLogDao.save(transactionLog);
\r
88 public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException {
\r
89 return transactionLogDao.getTransactionsByRequestId(requestId);
\r
93 public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)
\r
94 throws SvcLogicException {
\r
95 return transactionLogDao.getTransactionsByRequestId(requestId, messageType);
\r
99 public List<ConfigResource> getConfigResource(ConfigResource configResource) throws SvcLogicException {
\r
100 return configResourceDao.findByConfigResource(configResource);
\r
104 public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException {
\r
105 return configResourceDao.save(configResource);
\r
109 public String getConfigPropertyByKey(String key) throws SvcLogicException {
\r
110 return configPropertyMapDao.getConfigPropertyByKey(key);
\r