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.namedparam.NamedParameterJdbcTemplate;
\r
22 import com.att.eelf.configuration.EELFLogger;
\r
23 import com.att.eelf.configuration.EELFManager;
\r
25 public class NamedQueryExecutorDaoImpl implements NamedQueryExecutorDao {
\r
26 private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);
\r
27 private static final String CLASS_NAME = "NamedQueryExecutorDaoImpl";
\r
29 @Autowired(required = true)
\r
30 private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
\r
32 public NamedQueryExecutorDaoImpl(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
\r
33 this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
\r
34 logger.info("{} Constructor initialised..", CLASS_NAME);
\r
38 public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {
\r
39 logger.debug("Query ({}) with parameters ({})", sql, parameters);
\r
40 return namedParameterJdbcTemplate.queryForList(sql, parameters);
\r
44 public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
\r
45 return namedParameterJdbcTemplate;
\r
49 public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {
\r
50 logger.debug("update ({}) with parameters ({})", sql, parameters);
\r
51 return namedParameterJdbcTemplate.update(sql, parameters);
\r