bc3901a798ebc386dcca9561a01c4e9d64a81e3e
[ccsdk/features.git] /
1 /*\r
2  * Copyright © 2017-2018 AT&T Intellectual Property.\r
3  * \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
6  * \r
7  * http://www.apache.org/licenses/LICENSE-2.0\r
8  * \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
12  * the License.\r
13  */\r
14 \r
15 package org.onap.ccsdk.config.data.adaptor.dao;\r
16 \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
24 \r
25 public class QueryExecutorDaoImpl implements QueryExecutorDao {\r
26     \r
27     private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);\r
28     private static final String CLASS_NAME = "QueryExecutorDaoImpl";\r
29     \r
30     @Autowired(required = true)\r
31     private JdbcTemplate jdbcTemplate;\r
32     \r
33     public QueryExecutorDaoImpl(JdbcTemplate jdbcTemplate) {\r
34         this.jdbcTemplate = jdbcTemplate;\r
35         logger.info("{} Constructor initialised..", CLASS_NAME);\r
36     }\r
37     \r
38     @Override\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
42     }\r
43     \r
44     @Override\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
48     }\r
49     \r
50 }\r