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.dao;
\r
17 import java.util.List;
\r
18 import java.util.Map;
\r
19 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
\r
20 import org.springframework.beans.factory.annotation.Autowired;
\r
21 import org.springframework.jdbc.core.JdbcTemplate;
\r
22 import com.att.eelf.configuration.EELFLogger;
\r
23 import com.att.eelf.configuration.EELFManager;
\r
25 public class QueryExecutorDaoImpl implements QueryExecutorDao {
\r
27 private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);
\r
28 private static final String CLASS_NAME = "QueryExecutorDaoImpl";
\r
30 @Autowired(required = true)
\r
31 private JdbcTemplate jdbcTemplate;
\r
33 public QueryExecutorDaoImpl(JdbcTemplate jdbcTemplate) {
\r
34 this.jdbcTemplate = jdbcTemplate;
\r
35 logger.info("{} Constructor initialised..", CLASS_NAME);
\r
39 public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {
\r
40 logger.debug("Query ({}) with data ({})", sql, data);
\r
41 return jdbcTemplate.queryForList(sql, data);
\r
45 public int update(String sql, Object[] data) throws SvcLogicException {
\r
46 logger.debug("Query ({}) with data ({})", sql, data);
\r
47 return jdbcTemplate.update(sql, data);
\r