2 * Copyright 2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.holmes.common.api.stat;
19 import java.io.Serializable;
20 import java.util.ArrayList;
21 import java.util.List;
27 public class VesAlarm implements Cloneable, Serializable{
28 private String domain;
29 private String eventId;
30 private String eventName;
31 private String eventType;
32 private Object internalHeaderFields;
33 private Long lastEpochMicrosec;
34 private String nfcNamingCode;
35 private String nfNamingCode;
36 private String priority;
37 private String reportingEntityId;
38 private String reportingEntityName;
39 private Integer sequence;
40 private String sourceId;
41 private String sourceName;
42 private Long startEpochMicrosec;
45 private List<AlarmAdditionalField> alarmAdditionalInformation;
46 private String alarmCondition;
47 private String alarmInterfaceA;
48 private String eventCategory;
49 private String eventSeverity;
50 private String eventSourceType;
51 private Long faultFieldsVersion;
52 private String specificProblem;
53 private String vfStatus;
54 private String parentId;
55 private int alarmIsCleared = 0; //mark as 1 when alarm type is cleared, else mark as 0
56 private int rootFlag = 0; // mark as 1 when alarm is a root alarm , else mark as 0
59 public int hashCode() {
60 return this.version.hashCode();
64 public boolean equals(Object object) {
65 if (object == null || !(object instanceof VesAlarm)) {
68 return this.version.equals(((VesAlarm) object).getVersion());
72 public Object clone() throws CloneNotSupportedException {
73 VesAlarm vesAlarm = new VesAlarm();
75 vesAlarm.setDomain(this.domain);
76 vesAlarm.setEventId(this.getEventId());
77 vesAlarm.setEventName(this.getEventName());
78 vesAlarm.setEventType(this.getEventType());
79 vesAlarm.setInternalHeaderFields(this.getInternalHeaderFields());
80 vesAlarm.setLastEpochMicrosec(this.getLastEpochMicrosec());
81 vesAlarm.setNfcNamingCode(this.nfcNamingCode);
82 vesAlarm.setNfNamingCode(this.getNfNamingCode());
83 vesAlarm.setPriority(this.getPriority());
84 vesAlarm.setReportingEntityId(this.getReportingEntityId());
85 vesAlarm.setReportingEntityName(this.reportingEntityName);
86 vesAlarm.setSequence(this.getSequence());
87 vesAlarm.setSourceId(this.getSourceId());
88 vesAlarm.setSourceName(this.getSourceName());
89 vesAlarm.setStartEpochMicrosec(this.getStartEpochMicrosec());
90 vesAlarm.setVersion(this.getVersion());
92 if (alarmAdditionalInformation != null) {
93 List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>();
94 alarmAdditionalInformation.forEach(alarmAdditionalField -> {
95 AlarmAdditionalField alarmAdditionalField1 = new AlarmAdditionalField();
96 alarmAdditionalField1.setName(alarmAdditionalField.getName());
97 alarmAdditionalField1.setName(alarmAdditionalField.getValue());
98 alarmAdditionalFields.add(alarmAdditionalField1);
100 vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields);
103 vesAlarm.setAlarmCondition(this.getAlarmCondition());
104 vesAlarm.setAlarmInterfaceA(this.getAlarmInterfaceA());
105 vesAlarm.setEventCategory(this.getEventCategory());
106 vesAlarm.setEventSeverity(this.getEventSeverity());
107 vesAlarm.setEventSourceType(this.getEventSourceType());
108 vesAlarm.setFaultFieldsVersion(this.getFaultFieldsVersion());
109 vesAlarm.setSpecificProblem(this.getSpecificProblem());
110 vesAlarm.setVfStatus(this.vfStatus);
111 vesAlarm.setAlarmIsCleared(this.alarmIsCleared);
112 vesAlarm.setRootFlag(this.rootFlag);