Initial TCA commit into DCAEGEN2
[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      * Threshold Version
47      *
48      * @param version New value for Threshold Version
49      * @return Threshold Version
50      */
51     private String version;
52
53     /**
54      * Path of the field inside Common Event Format which needs to be monitored by TCA App
55      * for threshold crossing
56      *
57      * @param fieldPath New value for Path of the field inside CEF which needs to be monitored for TCA
58      * @return Path of the field inside Common Event Format which needs to be monitored by TCA App
59      */
60     private String fieldPath;
61
62     /**
63      * Threshold Value
64      *
65      * @param thresholdValue New value for Threshold Value
66      * @return Threshold Value
67      */
68     private Long thresholdValue;
69
70     /**
71      * Direction of threshold
72      *
73      * @param direction New value for Direction of threshold
74      * @return Direction of threshold
75      */
76     private Direction direction;
77
78     /**
79      * Severity of Event based on CEF Convention
80      *
81      * @param severity New value for Severity of Event based on CEF Convention
82      * @return Severity of Event based on CEF Convention
83      */
84     private EventSeverity severity;
85
86
87     /**
88      * Actual Field value that caused the threshold violation. Ignored for deserialization
89      *
90      *
91      * @param actualFieldValue new value value for actual Field value that caused the violation
92      * @return actual field value that caused the violation
93      */
94     private Long actualFieldValue;
95
96     /**
97      * Creates a copy of give {@link Threshold}
98      *
99      * @param threshold threshold that need to be copied
100      *
101      * @return new instance of threshold with copied value for give threshold
102      */
103     public static Threshold copy(final Threshold threshold) {
104         final Threshold newThreshold = new Threshold();
105         newThreshold.setClosedLoopControlName(threshold.getClosedLoopControlName());
106         newThreshold.setFieldPath(threshold.getFieldPath());
107         newThreshold.setThresholdValue(threshold.getThresholdValue());
108         newThreshold.setDirection(threshold.getDirection());
109         newThreshold.setSeverity(threshold.getSeverity());
110         newThreshold.setActualFieldValue(threshold.getActualFieldValue());
111         return newThreshold;
112     }
113
114 }