Added a clone Method to a Class
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / api / entity / CorrelationRule.java
1 /**\r
2  * Copyright 2017 ZTE Corporation.\r
3  * <p>\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  * <p>\r
8  * http://www.apache.org/licenses/LICENSE-2.0\r
9  * <p>\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 package org.onap.holmes.common.api.entity;\r
17 \r
18 import com.google.gson.annotations.SerializedName;\r
19 \r
20 import java.io.Closeable;\r
21 import java.util.Date;\r
22 import java.util.Properties;\r
23 \r
24 import lombok.Getter;\r
25 import lombok.Setter;\r
26 \r
27 @Getter\r
28 @Setter\r
29 public class CorrelationRule implements Cloneable {\r
30     @SerializedName(value = "ruleid")\r
31     private String rid;\r
32     @SerializedName(value = "rulename")\r
33     private String name;\r
34     private String description;\r
35     private int enabled;\r
36     private long templateID;\r
37     private String engineID;\r
38     private String engineType;\r
39     private String creator;\r
40     private String modifier;\r
41     private Properties params;\r
42     private String content;\r
43     private String vendor;\r
44     @SerializedName(value = "createtime")\r
45     private Date createTime;\r
46     @SerializedName(value = "updatetime")\r
47     private Date updateTime;\r
48     @SerializedName(value = "package")\r
49     private String packageName;\r
50     @SerializedName(value = "controlloopname")\r
51     private String closedControlLoopName;\r
52     @SerializedName(value = "engineinstance")\r
53     private String engineInstance;\r
54 \r
55     @Override\r
56     public Object clone() {\r
57         CorrelationRule r = null;\r
58         try {\r
59             r = (CorrelationRule) super.clone();\r
60         } catch (CloneNotSupportedException e) {\r
61             // This will never happen.\r
62             throw new InternalError(e);\r
63         }\r
64 \r
65         r.rid = rid == null ? null : rid;\r
66         r.name = name == null ? null : name;\r
67         r.description = description == null ? null : description;\r
68         r.enabled = enabled;\r
69         r.templateID = templateID;\r
70         r.engineID = engineID == null ? null : engineID;\r
71         r.engineType = engineType == null ? null : engineType;\r
72         r.creator = creator == null ? null : creator;\r
73         r.modifier = modifier  == null ? null : modifier;\r
74         r.params = params == null ? null : (Properties) params.clone();\r
75         r.content = content  == null ? null : content;\r
76         r.vendor = vendor  == null ? null : vendor;\r
77         r.createTime = createTime == null ? null : (Date) createTime.clone();\r
78         r.updateTime = updateTime == null ? null : (Date) updateTime.clone();\r
79         r.packageName = packageName == null ? null : packageName;\r
80         r.closedControlLoopName = closedControlLoopName == null ? null : closedControlLoopName;\r
81         r.engineInstance = engineInstance == null ? null : engineInstance;\r
82 \r
83         return r;\r
84     }\r
85 }\r