0d6193de21c2d5b1c486737bef90a43af108b155
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / openecomp / dcae / apod / analytics / model / domain / policy / tca / Threshold.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\r
4  * ================================================================================\r
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  *  Licensed under the Apache License, Version 2.0 (the "License");\r
8  *  you may not use this file except in compliance with the License.\r
9  *   You may obtain a copy of the License at\r
10  *\r
11  *          http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  *  Unless required by applicable law or agreed to in writing, software\r
14  *  distributed under the License is distributed on an "AS IS" BASIS,\r
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  *  See the License for the specific language governing permissions and\r
17  *  limitations under the License.\r
18  *  ============================LICENSE_END===========================================\r
19  */\r
20 \r
21 package org.openecomp.dcae.apod.analytics.model.domain.policy.tca;\r
22 \r
23 import lombok.Data;\r
24 import lombok.EqualsAndHashCode;\r
25 import org.openecomp.dcae.apod.analytics.model.domain.cef.EventSeverity;\r
26 \r
27 /**\r
28  *\r
29  * @author Rajiv Singla . Creation Date: 11/5/2016.\r
30  */\r
31 @Data\r
32 @EqualsAndHashCode(callSuper = true)\r
33 public class Threshold extends BaseTCAPolicyModel {\r
34 \r
35     private static final long serialVersionUID = 1L;\r
36 \r
37     /**\r
38      * Closed Loop Control Name\r
39      *\r
40      * @param closedLoopControlName New value for Closed Loop Control Name\r
41      * @return Closed Loop Control Name\r
42      */\r
43     private String closedLoopControlName;\r
44 \r
45 \r
46     /**\r
47      * Closed Loop Event Status\r
48      *\r
49      * @param closedLoopEventStatus New value for Closed Loop Event Status\r
50      * @return Closed Loop Event Status\r
51      */\r
52     private ClosedLoopEventStatus closedLoopEventStatus;\r
53 \r
54     /**\r
55      * Threshold Version\r
56      *\r
57      * @param version New value for Threshold Version\r
58      * @return Threshold Version\r
59      */\r
60     private String version;\r
61 \r
62     /**\r
63      * Path of the field inside Common Event Format which needs to be monitored by TCA App\r
64      * for threshold crossing\r
65      *\r
66      * @param fieldPath New value for Path of the field inside CEF which needs to be monitored for TCA\r
67      * @return Path of the field inside Common Event Format which needs to be monitored by TCA App\r
68      */\r
69     private String fieldPath;\r
70 \r
71     /**\r
72      * Threshold Value\r
73      *\r
74      * @param thresholdValue New value for Threshold Value\r
75      * @return Threshold Value\r
76      */\r
77     private Long thresholdValue;\r
78 \r
79     /**\r
80      * Direction of threshold\r
81      *\r
82      * @param direction New value for Direction of threshold\r
83      * @return Direction of threshold\r
84      */\r
85     private Direction direction;\r
86 \r
87     /**\r
88      * Severity of Event based on CEF Convention\r
89      *\r
90      * @param severity New value for Severity of Event based on CEF Convention\r
91      * @return Severity of Event based on CEF Convention\r
92      */\r
93     private EventSeverity severity;\r
94 \r
95 \r
96     /**\r
97      * Actual Field value that caused the threshold violation. Note: Ignored for serialization / deserialization\r
98      *\r
99      *\r
100      * @param actualFieldValue new value for actual Field value that caused the violation\r
101      * @return actual field value that caused the violation\r
102      */\r
103     private Long actualFieldValue;\r
104 \r
105     /**\r
106      * Creates a deep copy of give {@link Threshold}\r
107      *\r
108      * @param threshold threshold that need to be copied\r
109      *\r
110      * @return new instance of threshold with copied value for give threshold\r
111      */\r
112     public static Threshold copy(final Threshold threshold) {\r
113         final Threshold newThreshold = new Threshold();\r
114         newThreshold.setClosedLoopControlName(threshold.getClosedLoopControlName());\r
115         newThreshold.setClosedLoopEventStatus(threshold.getClosedLoopEventStatus());\r
116         newThreshold.setFieldPath(threshold.getFieldPath());\r
117         newThreshold.setThresholdValue(threshold.getThresholdValue());\r
118         newThreshold.setDirection(threshold.getDirection());\r
119         newThreshold.setSeverity(threshold.getSeverity());\r
120         newThreshold.setActualFieldValue(threshold.getActualFieldValue());\r
121         return newThreshold;\r
122     }\r
123 \r
124 }\r