2 * Copyright © 2017-2018 AT&T Intellectual Property.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
\r
5 * in compliance with the License. You may obtain a copy of the License at
\r
7 * http://www.apache.org/licenses/LICENSE-2.0
\r
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
\r
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
\r
11 * or implied. See the License for the specific language governing permissions and limitations under
\r
15 package org.onap.ccsdk.config.data.adaptor.service;
\r
17 import java.util.List;
\r
18 import java.util.Map;
\r
19 import org.onap.ccsdk.config.data.adaptor.dao.ConfigPropertyMapDao;
\r
20 import org.onap.ccsdk.config.data.adaptor.dao.ConfigResourceDao;
\r
21 import org.onap.ccsdk.config.data.adaptor.dao.NamedQueryExecutorDao;
\r
22 import org.onap.ccsdk.config.data.adaptor.dao.QueryExecutorDao;
\r
23 import org.onap.ccsdk.config.data.adaptor.dao.TransactionLogDao;
\r
24 import org.onap.ccsdk.config.data.adaptor.domain.ConfigResource;
\r
25 import org.onap.ccsdk.config.data.adaptor.domain.TransactionLog;
\r
26 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
\r
27 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
\r
28 import com.att.eelf.configuration.EELFLogger;
\r
29 import com.att.eelf.configuration.EELFManager;
\r
31 public class ConfigResourceServiceImpl implements ConfigResourceService {
\r
32 private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceServiceImpl.class);
\r
33 private static final String CLASS_NAME = "ConfigResourceServiceImpl";
\r
35 private TransactionLogDao transactionLogDao;
\r
36 private ConfigResourceDao configResourceDao;
\r
37 private QueryExecutorDao queryExecutorDao;
\r
38 private NamedQueryExecutorDao namedQueryExecutorDao;
\r
39 private ConfigPropertyMapDao configPropertyMapDao;
\r
41 @SuppressWarnings("squid:S00107")
\r
42 public ConfigResourceServiceImpl(TransactionLogDao transactionLogDao, ConfigResourceDao configResourceDao,
\r
43 QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao,
\r
44 ConfigPropertyMapDao configPropertyMapDao) {
\r
46 logger.info("{} Constuctor Initated...", CLASS_NAME);
\r
47 this.transactionLogDao = transactionLogDao;
\r
48 this.configResourceDao = configResourceDao;
\r
49 this.queryExecutorDao = queryExecutorDao;
\r
50 this.namedQueryExecutorDao = namedQueryExecutorDao;
\r
51 this.configPropertyMapDao = configPropertyMapDao;
\r
55 public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException {
\r
56 return namedQueryExecutorDao.getNamedParameterJdbcTemplate();
\r
60 public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {
\r
61 return namedQueryExecutorDao.query(sql, parameters);
\r
65 public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {
\r
66 return namedQueryExecutorDao.update(sql, parameters);
\r
70 public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {
\r
71 return queryExecutorDao.query(sql, data);
\r
75 public int update(String sql, Object[] data) throws SvcLogicException {
\r
76 return queryExecutorDao.update(sql, data);
\r
80 public void save(TransactionLog transactionLog) throws SvcLogicException {
\r
81 transactionLogDao.save(transactionLog);
\r
85 public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException {
\r
86 return transactionLogDao.getTransactionsByRequestId(requestId);
\r
90 public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)
\r
91 throws SvcLogicException {
\r
92 return transactionLogDao.getTransactionsByRequestId(requestId, messageType);
\r
96 public List<ConfigResource> getConfigResource(ConfigResource configResource) throws SvcLogicException {
\r
97 return configResourceDao.findByConfigResource(configResource);
\r
101 public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException {
\r
102 return configResourceDao.save(configResource);
\r
106 public String getConfigPropertyByKey(String key) throws SvcLogicException {
\r
107 return configPropertyMapDao.getConfigPropertyByKey(key);
\r