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