2 * Copyright 2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.holmes.engine.db.mapper;
18 import java.sql.ResultSet;
19 import java.sql.SQLException;
20 import java.util.Properties;
21 import org.onap.holmes.common.api.entity.CorrelationRule;
22 import org.skife.jdbi.v2.StatementContext;
23 import org.skife.jdbi.v2.tweak.ResultSetMapper;
25 public class CorrelationRuleMapper implements ResultSetMapper<CorrelationRule> {
27 public CorrelationRule map(int i, ResultSet resultSet, StatementContext statementContext)
29 CorrelationRule correlationRule = new CorrelationRule();
30 correlationRule.setName(resultSet.getString("name"));
31 correlationRule.setRid(resultSet.getString("rid"));
32 correlationRule.setDescription(resultSet.getString("description"));
33 correlationRule.setEnabled(resultSet.getInt("enable"));
34 correlationRule.setTemplateID(resultSet.getInt("templateID"));
35 correlationRule.setEngineID(resultSet.getString("engineID"));
36 correlationRule.setEngineType(resultSet.getString("engineType"));
37 correlationRule.setCreator(resultSet.getString("creator"));
38 correlationRule.setCreateTime(resultSet.getDate("createTime"));
39 correlationRule.setModifier(resultSet.getString("updator"));
40 correlationRule.setUpdateTime(resultSet.getDate("updateTime"));
41 correlationRule.setParams((Properties) resultSet.getObject("params"));
42 correlationRule.setContent(resultSet.getString("content"));
43 correlationRule.setVendor(resultSet.getString("vendor"));
44 correlationRule.setPackageName(resultSet.getString("package"));
45 return correlationRule;