--- /dev/null
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.vesagent.fault;\r
+\r
+\r
+import java.io.Serializable;\r
+import java.util.Date;\r
+\r
+import org.commscope.tr069adapter.acs.common.ParameterDTO;\r
+import org.commscope.tr069adapter.vesagent.exception.InvalidFaultOperationException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+public class ExpeditedEvent implements Serializable {\r
+ private static final long serialVersionUID = -6862753992876923284L;\r
+\r
+ private Date eventTime;\r
+\r
+ private String alarmIdentifier;\r
+\r
+ private NotificationTypeEnum notificationType;\r
+\r
+ private String managedObjectInstance;\r
+\r
+ private String eventType;\r
+\r
+ private String probableCause;\r
+\r
+ private String specificProblem;\r
+\r
+ private AlarmFrameWorkSeverityEnum perceivedSeverity;\r
+\r
+ private String additionalText;\r
+\r
+ private String additionalInformation;\r
+ private static final Logger logger = LoggerFactory.getLogger(ExpeditedEvent.class);\r
+\r
+ public Date getEventTime() {\r
+ return eventTime;\r
+ }\r
+\r
+ public void setEventTime(Date eventTime) {\r
+ this.eventTime = eventTime;\r
+ }\r
+\r
+ public String getAlarmIdentifier() {\r
+ return alarmIdentifier;\r
+ }\r
+\r
+ public void setAlarmIdentifier(String alarmIdentifier) {\r
+ this.alarmIdentifier = alarmIdentifier;\r
+ }\r
+\r
+ public NotificationTypeEnum getNotificationType() {\r
+ return notificationType;\r
+ }\r
+\r
+ public void setNotificationType(NotificationTypeEnum notificationType) {\r
+ this.notificationType = notificationType;\r
+ }\r
+\r
+ public String getManagedObjectInstance() {\r
+ return managedObjectInstance;\r
+ }\r
+\r
+ public void setManagedObjectInstance(String managedObjectInstance) {\r
+ this.managedObjectInstance = managedObjectInstance;\r
+ }\r
+\r
+ public String getEventType() {\r
+ return eventType;\r
+ }\r
+\r
+ public void setEventType(String eventType) {\r
+ this.eventType = eventType;\r
+ }\r
+\r
+ public String getProbableCause() {\r
+ return probableCause;\r
+ }\r
+\r
+ public void setProbableCause(String probableCause) {\r
+ this.probableCause = probableCause;\r
+ }\r
+\r
+ public String getSpecificProblem() {\r
+ return specificProblem;\r
+ }\r
+\r
+ public void setSpecificProblem(String specificProblem) {\r
+ this.specificProblem = specificProblem;\r
+ }\r
+\r
+ public AlarmFrameWorkSeverityEnum getPerceivedSeverity() {\r
+ return perceivedSeverity;\r
+ }\r
+\r
+ public void setPerceivedSeverity(AlarmFrameWorkSeverityEnum perceivedSeverity) {\r
+ this.perceivedSeverity = perceivedSeverity;\r
+ }\r
+\r
+ public String getAdditionalText() {\r
+ return additionalText;\r
+ }\r
+\r
+ public void setAdditionalText(String additionalText) {\r
+ this.additionalText = additionalText;\r
+ }\r
+\r
+ public String getAdditionalInformation() {\r
+ return additionalInformation;\r
+ }\r
+\r
+ public void setAdditionalInformation(String additionalInformation) {\r
+ this.additionalInformation = additionalInformation;\r
+ }\r
+\r
+ public void parse(ParameterDTO parameter, String tempEEParam)\r
+ throws InvalidFaultOperationException {\r
+ if (null == parameter.getParamValue()) {\r
+ return;\r
+ }\r
+\r
+ if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_ALARMIDENTIFIER)) {\r
+ setAlarmIdentifier(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_NOTIFICATIONTYPE)) {\r
+ validateNotificationType(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_MANAGEDOBJECTINSTANCE)\r
+ || tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_OBJECTINSTANCE)) {\r
+ setManagedObjectInstance(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_EVENTTYPE)) {\r
+ setEventType(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_FAULTCODE)) {\r
+ setEventType(parameter.getParamValue());\r
+ setAlarmIdentifier(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_PROBABLECAUSE)) {\r
+ setProbableCause(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_SPECIFICPROBLEM)\r
+ || tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_ALARMMESSAGE)) {\r
+ setSpecificProblem(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_PERCEIVEDSEVERITY)\r
+ && !parameter.getParamValue().equals("")) {\r
+ validateSeverity(parameter.getParamValue());\r
+ setPerceivedSeverity(\r
+ AlarmFrameWorkSeverityEnum.valueOf(((String) parameter.getParamValue()).toUpperCase()));\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_ADDITIONALTEXT)\r
+ || tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_FAULTCOMPONENT)) {\r
+ setAdditionalText(parameter.getParamValue());\r
+ } else if (tempEEParam.equals(DeviceAlarmConstant.EXPEDITED_EVENT_ADDITIONALINFORMATION)) {\r
+ setAdditionalInformation(parameter.getParamValue());\r
+ }\r
+ }\r
+\r
+ private void validateSeverity(String severity) throws InvalidFaultOperationException {\r
+ try {\r
+ AlarmFrameWorkSeverityEnum.valueOf(severity.toUpperCase());\r
+ logger.debug("Severity is validated successfully : {}", severity);\r
+ } catch (Exception e) {\r
+ logger.error("Invalid Severity: Severity : {}", severity);\r
+ throw new InvalidFaultOperationException(\r
+ "Invalid Severity: Severity " + severity + " is not supported");\r
+ }\r
+ }\r
+\r
+ private void validateNotificationType(String notificationType)\r
+ throws InvalidFaultOperationException {\r
+ try {\r
+ AlarmNotificationTypeEnum.valueOf(notificationType.toUpperCase());\r
+ logger.debug("NotificationType is {} validated successfully", notificationType);\r
+ } catch (Exception e) {\r
+ logger.error("Invalid device alarm notification type: NotificationType : {}",\r
+ notificationType);\r
+ throw new InvalidFaultOperationException(\r
+ "Invalid NotificationType: notificationType <" + notificationType + "> is not supported");\r
+ }\r
+ }\r
+\r
+}\r