Add support for ABATED alerts within CDAP TCA
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / openecomp / dcae / apod / analytics / model / domain / policy / tca / Threshold.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
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
10  *
11  *          http://www.apache.org/licenses/LICENSE-2.0
12  *
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===========================================
19  */
20
21 package org.openecomp.dcae.apod.analytics.model.domain.policy.tca;
22
23 import lombok.Data;
24 import lombok.EqualsAndHashCode;
25 import org.openecomp.dcae.apod.analytics.model.domain.cef.EventSeverity;
26
27 /**
28  *
29  * @author Rajiv Singla . Creation Date: 11/5/2016.
30  */
31 @Data
32 @EqualsAndHashCode(callSuper = true)
33 public class Threshold extends BaseTCAPolicyModel {
34
35     private static final long serialVersionUID = 1L;
36
37     /**
38      * Closed Loop Control Name
39      *
40      * @param closedLoopControlName New value for Closed Loop Control Name
41      * @return Closed Loop Control Name
42      */
43     private String closedLoopControlName;
44
45
46     /**
47      * Closed Loop Event Status
48      *
49      * @param closedLoopEventStatus New value for Closed Loop Event Status
50      * @return Closed Loop Event Status
51      */
52     private ControlLoopEventStatus closedLoopEventStatus;
53
54     /**
55      * Threshold Version
56      *
57      * @param version New value for Threshold Version
58      * @return Threshold Version
59      */
60     private String version;
61
62     /**
63      * Path of the field inside Common Event Format which needs to be monitored by TCA App
64      * for threshold crossing
65      *
66      * @param fieldPath New value for Path of the field inside CEF which needs to be monitored for TCA
67      * @return Path of the field inside Common Event Format which needs to be monitored by TCA App
68      */
69     private String fieldPath;
70
71     /**
72      * Threshold Value
73      *
74      * @param thresholdValue New value for Threshold Value
75      * @return Threshold Value
76      */
77     private Long thresholdValue;
78
79     /**
80      * Direction of threshold
81      *
82      * @param direction New value for Direction of threshold
83      * @return Direction of threshold
84      */
85     private Direction direction;
86
87     /**
88      * Severity of Event based on CEF Convention
89      *
90      * @param severity New value for Severity of Event based on CEF Convention
91      * @return Severity of Event based on CEF Convention
92      */
93     private EventSeverity severity;
94
95
96     /**
97      * Actual Field value that caused the threshold violation. Note: Ignored for serialization / deserialization
98      *
99      *
100      * @param actualFieldValue new value for actual Field value that caused the violation
101      * @return actual field value that caused the violation
102      */
103     private Long actualFieldValue;
104
105     /**
106      * Creates a deep copy of give {@link Threshold}
107      *
108      * @param threshold threshold that need to be copied
109      *
110      * @return new instance of threshold with copied value for give threshold
111      */
112     public static Threshold copy(final Threshold threshold) {
113         final Threshold newThreshold = new Threshold();
114         newThreshold.setClosedLoopControlName(threshold.getClosedLoopControlName());
115         newThreshold.setClosedLoopEventStatus(threshold.getClosedLoopEventStatus());
116         newThreshold.setFieldPath(threshold.getFieldPath());
117         newThreshold.setThresholdValue(threshold.getThresholdValue());
118         newThreshold.setDirection(threshold.getDirection());
119         newThreshold.setSeverity(threshold.getSeverity());
120         newThreshold.setActualFieldValue(threshold.getActualFieldValue());
121         return newThreshold;
122     }
123
124 }