Merge "Improved the UT coverage"
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / api / entity / CorrelationRule.java
index eb9273a..14a3f07 100644 (file)
@@ -1,12 +1,12 @@
 /**\r
  * Copyright 2017 ZTE Corporation.\r
- *\r
+ * <p>\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
+ * <p>\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * <p>\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
  */\r
 package org.onap.holmes.common.api.entity;\r
 \r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
+import com.google.gson.annotations.SerializedName;\r
+\r
 import java.util.Date;\r
 import java.util.Properties;\r
+\r
 import lombok.Getter;\r
 import lombok.Setter;\r
 \r
 @Getter\r
 @Setter\r
-public class CorrelationRule {\r
-\r
-    @JsonProperty(value = "ruleid")\r
+public class CorrelationRule implements Cloneable {\r
+    @SerializedName(value = "ruleid")\r
     private String rid;\r
-    @JsonProperty(value = "rulename")\r
+    @SerializedName(value = "rulename")\r
     private String name;\r
-    @JsonProperty\r
     private String description;\r
-    @JsonProperty\r
     private int enabled;\r
-    @JsonProperty\r
     private long templateID;\r
     private String engineID;\r
-    @JsonProperty\r
     private String engineType;\r
-    @JsonProperty\r
     private String creator;\r
-    @JsonProperty\r
     private String modifier;\r
-    @JsonProperty\r
     private Properties params;\r
-    @JsonProperty\r
     private String content;\r
-    @JsonProperty\r
     private String vendor;\r
-    @JsonProperty(value = "createtime")\r
+    @SerializedName(value = "createtime")\r
     private Date createTime;\r
-    @JsonProperty(value = "updatetime")\r
+    @SerializedName(value = "updatetime")\r
     private Date updateTime;\r
-    @JsonProperty(value = "package")\r
+    @SerializedName(value = "package")\r
     private String packageName;\r
-    @JsonProperty(value = "controlloopname")\r
+    @SerializedName(value = "controlloopname")\r
     private String closedControlLoopName;\r
+    @SerializedName(value = "engineinstance")\r
+    private String engineInstance;\r
+\r
+    @Override\r
+    public Object clone() {\r
+        CorrelationRule r = null;\r
+        try {\r
+            r = (CorrelationRule) super.clone();\r
+        } catch (CloneNotSupportedException e) {\r
+            // This will never happen.\r
+            throw new InternalError(e);\r
+        }\r
+\r
+        r.rid = rid;\r
+        r.name = name;\r
+        r.description = description;\r
+        r.enabled = enabled;\r
+        r.templateID = templateID;\r
+        r.engineID = engineID;\r
+        r.engineType = engineType;\r
+        r.creator = creator;\r
+        r.modifier = modifier;\r
+        r.params = params == null ? null : (Properties) params.clone();\r
+        r.content = content;\r
+        r.vendor = vendor;\r
+        r.createTime = createTime == null ? null : (Date) createTime.clone();\r
+        r.updateTime = updateTime == null ? null : (Date) updateTime.clone();\r
+        r.packageName = packageName;\r
+        r.closedControlLoopName = closedControlLoopName;\r
+        r.engineInstance = engineInstance;\r
+\r
+        return r;\r
+    }\r
 }\r