Change the groupid from openo to onap
[holmes/rule-management.git] / rulemgt / src / main / java / org / onap / holmes / rulemgt / db / mapper / CorrelationRuleMapper.java
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java
new file mode 100644 (file)
index 0000000..d40253f
--- /dev/null
@@ -0,0 +1,48 @@
+/**\r
+ * Copyright 2017 ZTE Corporation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.onap.holmes.rulemgt.db.mapper;\r
+\r
+import org.onap.holmes.common.api.entity.CorrelationRule;\r
+import org.skife.jdbi.v2.StatementContext;\r
+import org.skife.jdbi.v2.tweak.ResultSetMapper;\r
+\r
+import java.sql.ResultSet;\r
+import java.sql.SQLException;\r
+import java.util.Properties;\r
+\r
+public class CorrelationRuleMapper implements ResultSetMapper<CorrelationRule> {\r
+    @Override\r
+    public CorrelationRule map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {\r
+        CorrelationRule correlationRule = new CorrelationRule();\r
+        correlationRule.setName(resultSet.getString("name"));\r
+        correlationRule.setRid(resultSet.getString("rid"));\r
+        correlationRule.setDescription(resultSet.getString("description"));\r
+        correlationRule.setEnabled(resultSet.getInt("enable"));\r
+        correlationRule.setTemplateID(resultSet.getInt("templateID"));\r
+        correlationRule.setEngineID(resultSet.getString("engineID"));\r
+        correlationRule.setEngineType(resultSet.getString("engineType"));\r
+        correlationRule.setCreator(resultSet.getString("creator"));\r
+        correlationRule.setCreateTime(resultSet.getDate("createTime"));\r
+        correlationRule.setModifier(resultSet.getString("updator"));\r
+        correlationRule.setUpdateTime(resultSet.getDate("updateTime"));\r
+        correlationRule.setParams((Properties)resultSet.getObject("params"));\r
+        correlationRule.setContent(resultSet.getString("content"));\r
+        correlationRule.setVendor(resultSet.getString("vendor"));\r
+        correlationRule.setPackageName(resultSet.getString("package"));\r
+        return correlationRule;\r
+    }\r
+\r
+}\r