From: Shiwei Tian Date: Tue, 12 Sep 2017 07:33:28 +0000 (+0800) Subject: add dmaap alarm entity X-Git-Tag: v1.0.0~43 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=holmes%2Fcommon.git;a=commitdiff_plain;h=f37f7595742b43c5bce7f4400184089ba1fb2d6c add dmaap alarm entity Issue-ID: HOLMES-29 Change-Id: I679997647ac6e2280395ac251d62ee44cfe9ad67 Signed-off-by: Shiwei Tian --- 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 index 0000000..b07a558 --- /dev/null +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java @@ -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 index 0000000..3cdcb88 --- /dev/null +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java @@ -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 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 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; + } +}