summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src
diff options
context:
space:
mode:
authorGuangrongFu <fu.guangrong@zte.com.cn>2018-08-17 16:24:55 +0800
committerGuangrongFu <fu.guangrong@zte.com.cn>2018-08-17 16:24:55 +0800
commitade8715b85cc4205ba2420cca24e253891a13540 (patch)
tree7b4b39ec13ee09ff207bdae27dde503315fe39c7 /holmes-actions/src
parentca7eb991c910002e2c798d29e52a812caed7729c (diff)
Added a clone Method to a Class
Change-Id: Ifed18ae35ef12148dd4d3d7b9f5fc81999e2548e Issue-ID: HOLMES-159 Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'holmes-actions/src')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java55
1 files changed, 39 insertions, 16 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
index d7965c5..acfae35 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
@@ -1,12 +1,12 @@
/**
* Copyright 2017 ZTE Corporation.
- *
+ * <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,38 +16,30 @@
package org.onap.holmes.common.api.entity;
import com.google.gson.annotations.SerializedName;
+
+import java.io.Closeable;
import java.util.Date;
import java.util.Properties;
+
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
-public class CorrelationRule {
-
+public class CorrelationRule implements Cloneable {
@SerializedName(value = "ruleid")
private String rid;
@SerializedName(value = "rulename")
private String name;
-
private String description;
-
private int enabled;
-
private long templateID;
-
private String engineID;
-
private String engineType;
-
private String creator;
-
private String modifier;
-
private Properties params;
-
private String content;
-
private String vendor;
@SerializedName(value = "createtime")
private Date createTime;
@@ -59,4 +51,35 @@ public class CorrelationRule {
private String closedControlLoopName;
@SerializedName(value = "engineinstance")
private String engineInstance;
+
+ @Override
+ public Object clone() {
+ CorrelationRule r = null;
+ try {
+ r = (CorrelationRule) super.clone();
+ } catch (CloneNotSupportedException e) {
+ // This will never happen.
+ throw new InternalError(e);
+ }
+
+ r.rid = rid == null ? null : rid;
+ r.name = name == null ? null : name;
+ r.description = description == null ? null : description;
+ r.enabled = enabled;
+ r.templateID = templateID;
+ r.engineID = engineID == null ? null : engineID;
+ r.engineType = engineType == null ? null : engineType;
+ r.creator = creator == null ? null : creator;
+ r.modifier = modifier == null ? null : modifier;
+ r.params = params == null ? null : (Properties) params.clone();
+ r.content = content == null ? null : content;
+ r.vendor = vendor == null ? null : vendor;
+ r.createTime = createTime == null ? null : (Date) createTime.clone();
+ r.updateTime = updateTime == null ? null : (Date) updateTime.clone();
+ r.packageName = packageName == null ? null : packageName;
+ r.closedControlLoopName = closedControlLoopName == null ? null : closedControlLoopName;
+ r.engineInstance = engineInstance == null ? null : engineInstance;
+
+ return r;
+ }
}