Added a clone Method to a Class 53/61053/1
authorGuangrongFu <fu.guangrong@zte.com.cn>
Fri, 17 Aug 2018 08:24:55 +0000 (16:24 +0800)
committerGuangrongFu <fu.guangrong@zte.com.cn>
Fri, 17 Aug 2018 08:24:55 +0000 (16:24 +0800)
Change-Id: Ifed18ae35ef12148dd4d3d7b9f5fc81999e2548e
Issue-ID: HOLMES-159
Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java

index d7965c5..acfae35 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
 package org.onap.holmes.common.api.entity;\r
 \r
 import com.google.gson.annotations.SerializedName;\r
+\r
+import java.io.Closeable;\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
+public class CorrelationRule implements Cloneable {\r
     @SerializedName(value = "ruleid")\r
     private String rid;\r
     @SerializedName(value = "rulename")\r
     private String name;\r
-\r
     private String description;\r
-\r
     private int enabled;\r
-\r
     private long templateID;\r
-\r
     private String engineID;\r
-\r
     private String engineType;\r
-\r
     private String creator;\r
-\r
     private String modifier;\r
-\r
     private Properties params;\r
-\r
     private String content;\r
-\r
     private String vendor;\r
     @SerializedName(value = "createtime")\r
     private Date createTime;\r
@@ -59,4 +51,35 @@ public class CorrelationRule {
     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 == null ? null : rid;\r
+        r.name = name == null ? null : name;\r
+        r.description = description == null ? null : description;\r
+        r.enabled = enabled;\r
+        r.templateID = templateID;\r
+        r.engineID = engineID == null ? null : engineID;\r
+        r.engineType = engineType == null ? null : engineType;\r
+        r.creator = creator == null ? null : creator;\r
+        r.modifier = modifier  == null ? null : modifier;\r
+        r.params = params == null ? null : (Properties) params.clone();\r
+        r.content = content  == null ? null : content;\r
+        r.vendor = vendor  == null ? null : vendor;\r
+        r.createTime = createTime == null ? null : (Date) createTime.clone();\r
+        r.updateTime = updateTime == null ? null : (Date) updateTime.clone();\r
+        r.packageName = packageName == null ? null : packageName;\r
+        r.closedControlLoopName = closedControlLoopName == null ? null : closedControlLoopName;\r
+        r.engineInstance = engineInstance == null ? null : engineInstance;\r
+\r
+        return r;\r
+    }\r
 }\r