TCA: Replace any openecomp reference by onap
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / onap / 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.onap.dcae.apod.analytics.model.domain.policy.tca;
22
23 import lombok.Data;
24 import lombok.EqualsAndHashCode;
25 import org.onap.dcae.apod.analytics.model.domain.cef.EventSeverity;
26
27 import java.math.BigDecimal;
28
29 /**
30  *
31  * @author Rajiv Singla . Creation Date: 11/5/2016.
32  */
33 @Data
34 @EqualsAndHashCode(callSuper = true)
35 public class Threshold extends BaseTCAPolicyModel {
36
37     private static final long serialVersionUID = 1L;
38
39     /**
40      * Closed Loop Control Name
41      *
42      * @param closedLoopControlName New value for Closed Loop Control Name
43      * @return Closed Loop Control Name
44      */
45     private String closedLoopControlName;
46
47
48     /**
49      * Closed Loop Event Status
50      *
51      * @param closedLoopEventStatus New value for Closed Loop Event Status
52      * @return Closed Loop Event Status
53      */
54     private ClosedLoopEventStatus closedLoopEventStatus;
55
56     /**
57      * Threshold Version
58      *
59      * @param version New value for Threshold Version
60      * @return Threshold Version
61      */
62     private String version;
63
64     /**
65      * Path of the field inside Common Event Format which needs to be monitored by TCA App
66      * for threshold crossing
67      *
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
70      */
71     private String fieldPath;
72
73     /**
74      * Threshold Value
75      *
76      * @param thresholdValue New value for Threshold Value
77      * @return Threshold Value
78      */
79     private Long thresholdValue;
80
81     /**
82      * Direction of threshold
83      *
84      * @param direction New value for Direction of threshold
85      * @return Direction of threshold
86      */
87     private Direction direction;
88
89     /**
90      * Severity of Event based on CEF Convention
91      *
92      * @param severity New value for Severity of Event based on CEF Convention
93      * @return Severity of Event based on CEF Convention
94      */
95     private EventSeverity severity;
96
97
98     /**
99      * Actual Field value that caused the threshold violation. Note: Ignored for serialization / deserialization
100      *
101      *
102      * @param actualFieldValue new value for actual Field value that caused the violation
103      * @return actual field value that caused the violation
104      */
105     private BigDecimal actualFieldValue;
106
107     /**
108      * Creates a deep copy of give {@link Threshold}
109      *
110      * @param threshold threshold that need to be copied
111      *
112      * @return new instance of threshold with copied value for give threshold
113      */
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());
124         return newThreshold;
125     }
126
127 }