add dmaap alarm entity
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / api / stat / VesAlarm.java
1 /*
2  * Copyright 2017 ZTE Corporation.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.holmes.common.api.stat;
18
19 import java.io.Serializable;
20 import java.util.ArrayList;
21 import java.util.List;
22 import lombok.Getter;
23 import lombok.Setter;
24
25 @Getter
26 @Setter
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;
43     private Long version;
44
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
55     @Override
56     public int hashCode() {
57         return this.version.hashCode();
58     }
59
60     @Override
61     public boolean equals(Object object) {
62         if (object == null || !(object instanceof VesAlarm)) {
63             return false;
64         }
65         return this.version.equals(((VesAlarm) object).getVersion());
66     }
67
68     @Override
69     public Object clone() throws CloneNotSupportedException {
70         VesAlarm vesAlarm = new VesAlarm();
71
72         vesAlarm.setDomain(this.domain);
73         vesAlarm.setEventId(this.getEventId());
74         vesAlarm.setEventName(this.getEventName());
75         vesAlarm.setEventType(this.getEventType());
76         vesAlarm.setInternalHeaderFields(this.getInternalHeaderFields());
77         vesAlarm.setLastEpochMicrosec(this.getLastEpochMicrosec());
78         vesAlarm.setNfcNamingCode(this.nfcNamingCode);
79         vesAlarm.setNfNamingCode(this.getNfNamingCode());
80         vesAlarm.setPriority(this.getPriority());
81         vesAlarm.setReportingEntityId(this.getReportingEntityId());
82         vesAlarm.setReportingEntityName(this.reportingEntityName);
83         vesAlarm.setSequence(this.getSequence());
84         vesAlarm.setSourceId(this.getSourceId());
85         vesAlarm.setSourceName(this.getSourceName());
86         vesAlarm.setStartEpochMicrosec(this.getStartEpochMicrosec());
87         vesAlarm.setVersion(this.getVersion());
88
89         if (alarmAdditionalInformation != null) {
90             List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>();
91             alarmAdditionalInformation.forEach(alarmAdditionalField -> {
92                 AlarmAdditionalField alarmAdditionalField1 = new AlarmAdditionalField();
93                 alarmAdditionalField1.setName(alarmAdditionalField.getName());
94                 alarmAdditionalField1.setName(alarmAdditionalField.getValue());
95                 alarmAdditionalFields.add(alarmAdditionalField1);
96             });
97             vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields);
98         }
99
100         vesAlarm.setAlarmCondition(this.getAlarmCondition());
101         vesAlarm.setAlarmInterfaceA(this.getAlarmInterfaceA());
102         vesAlarm.setEventCategory(this.getEventCategory());
103         vesAlarm.setEventSeverity(this.getEventSeverity());
104         vesAlarm.setEventSourceType(this.getEventSourceType());
105         vesAlarm.setFaultFieldsVersion(this.getFaultFieldsVersion());
106         vesAlarm.setSpecificProblem(this.getSpecificProblem());
107         vesAlarm.setVfStatus(this.vfStatus);
108
109         return vesAlarm;
110     }
111 }