add dmaap alarm entity 77/11877/1
authorShiwei Tian <tian.shiwei@zte.com.cn>
Tue, 12 Sep 2017 07:33:28 +0000 (15:33 +0800)
committerShiwei Tian <tian.shiwei@zte.com.cn>
Tue, 12 Sep 2017 07:33:28 +0000 (15:33 +0800)
Issue-ID: HOLMES-29

Change-Id: I679997647ac6e2280395ac251d62ee44cfe9ad67
Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java [new file with mode: 0644]
holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java [new file with mode: 0644]

diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java
new file mode 100644 (file)
index 0000000..b07a558
--- /dev/null
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.holmes.common.api.stat;
+
+
+import java.io.Serializable;
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class AlarmAdditionalField implements Serializable {
+    private String name;
+    private String value;
+}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java
new file mode 100644 (file)
index 0000000..3cdcb88
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017 ZTE Corporation.
+ *
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.holmes.common.api.stat;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class VesAlarm implements Cloneable, Serializable{
+    private String domain;
+    private String eventId;
+    private String EventName;
+    private String eventType;
+    private Object internalHeaderFields;
+    private Long lastEpochMicrosec;
+    private String nfcNamingCode;
+    private String nfNamingCode;
+    private String priority;
+    private String reportingEntityId;
+    private String reportingEntityName;
+    private Integer sequence;
+    private String sourceId;
+    private String sourceName;
+    private Long startEpochMicrosec;
+    private Long version;
+
+    private List<AlarmAdditionalField> alarmAdditionalInformation;
+    private String alarmCondition;
+    private String alarmInterfaceA;
+    private String eventCategory;
+    private String eventSeverity;
+    private String eventSourceType;
+    private Long faultFieldsVersion;
+    private String specificProblem;
+    private String vfStatus;
+
+    @Override
+    public int hashCode() {
+        return this.version.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (object == null || !(object instanceof VesAlarm)) {
+            return false;
+        }
+        return this.version.equals(((VesAlarm) object).getVersion());
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        VesAlarm vesAlarm = new VesAlarm();
+
+        vesAlarm.setDomain(this.domain);
+        vesAlarm.setEventId(this.getEventId());
+        vesAlarm.setEventName(this.getEventName());
+        vesAlarm.setEventType(this.getEventType());
+        vesAlarm.setInternalHeaderFields(this.getInternalHeaderFields());
+        vesAlarm.setLastEpochMicrosec(this.getLastEpochMicrosec());
+        vesAlarm.setNfcNamingCode(this.nfcNamingCode);
+        vesAlarm.setNfNamingCode(this.getNfNamingCode());
+        vesAlarm.setPriority(this.getPriority());
+        vesAlarm.setReportingEntityId(this.getReportingEntityId());
+        vesAlarm.setReportingEntityName(this.reportingEntityName);
+        vesAlarm.setSequence(this.getSequence());
+        vesAlarm.setSourceId(this.getSourceId());
+        vesAlarm.setSourceName(this.getSourceName());
+        vesAlarm.setStartEpochMicrosec(this.getStartEpochMicrosec());
+        vesAlarm.setVersion(this.getVersion());
+
+        if (alarmAdditionalInformation != null) {
+            List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>();
+            alarmAdditionalInformation.forEach(alarmAdditionalField -> {
+                AlarmAdditionalField alarmAdditionalField1 = new AlarmAdditionalField();
+                alarmAdditionalField1.setName(alarmAdditionalField.getName());
+                alarmAdditionalField1.setName(alarmAdditionalField.getValue());
+                alarmAdditionalFields.add(alarmAdditionalField1);
+            });
+            vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields);
+        }
+
+        vesAlarm.setAlarmCondition(this.getAlarmCondition());
+        vesAlarm.setAlarmInterfaceA(this.getAlarmInterfaceA());
+        vesAlarm.setEventCategory(this.getEventCategory());
+        vesAlarm.setEventSeverity(this.getEventSeverity());
+        vesAlarm.setEventSourceType(this.getEventSourceType());
+        vesAlarm.setFaultFieldsVersion(this.getFaultFieldsVersion());
+        vesAlarm.setSpecificProblem(this.getSpecificProblem());
+        vesAlarm.setVfStatus(this.vfStatus);
+
+        return vesAlarm;
+    }
+}