2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============================LICENSE_END===========================================
21 package org.onap.dcae.apod.analytics.model.domain.policy.tca;
24 import lombok.EqualsAndHashCode;
25 import org.onap.dcae.apod.analytics.model.domain.cef.EventSeverity;
27 import java.math.BigDecimal;
31 * @author Rajiv Singla . Creation Date: 11/5/2016.
34 @EqualsAndHashCode(callSuper = true)
35 public class Threshold extends BaseTCAPolicyModel {
37 private static final long serialVersionUID = 1L;
40 * Closed Loop Control Name
42 * @param closedLoopControlName New value for Closed Loop Control Name
43 * @return Closed Loop Control Name
45 private String closedLoopControlName;
49 * Closed Loop Event Status
51 * @param closedLoopEventStatus New value for Closed Loop Event Status
52 * @return Closed Loop Event Status
54 private ClosedLoopEventStatus closedLoopEventStatus;
59 * @param version New value for Threshold Version
60 * @return Threshold Version
62 private String version;
65 * Path of the field inside Common Event Format which needs to be monitored by TCA App
66 * for threshold crossing
68 * @param fieldPath New value for Path of the field inside CEF which needs to be monitored for TCA
69 * @return Path of the field inside Common Event Format which needs to be monitored by TCA App
71 private String fieldPath;
76 * @param thresholdValue New value for Threshold Value
77 * @return Threshold Value
79 private Long thresholdValue;
82 * Direction of threshold
84 * @param direction New value for Direction of threshold
85 * @return Direction of threshold
87 private Direction direction;
90 * Severity of Event based on CEF Convention
92 * @param severity New value for Severity of Event based on CEF Convention
93 * @return Severity of Event based on CEF Convention
95 private EventSeverity severity;
99 * Actual Field value that caused the threshold violation. Note: Ignored for serialization / deserialization
102 * @param actualFieldValue new value for actual Field value that caused the violation
103 * @return actual field value that caused the violation
105 private BigDecimal actualFieldValue;
108 * Creates a deep copy of give {@link Threshold}
110 * @param threshold threshold that need to be copied
112 * @return new instance of threshold with copied value for give threshold
114 public static Threshold copy(final Threshold threshold) {
115 final Threshold newThreshold = new Threshold();
116 newThreshold.setClosedLoopControlName(threshold.getClosedLoopControlName());
117 newThreshold.setClosedLoopEventStatus(threshold.getClosedLoopEventStatus());
118 newThreshold.setFieldPath(threshold.getFieldPath());
119 newThreshold.setThresholdValue(threshold.getThresholdValue());
120 newThreshold.setDirection(threshold.getDirection());
121 newThreshold.setSeverity(threshold.getSeverity());
122 newThreshold.setVersion(threshold.getVersion());
123 newThreshold.setActualFieldValue(threshold.getActualFieldValue());