new method for policy client
[clamp.git] / src / main / java / org / onap / clamp / clds / model / prop / TcaThreshhold.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23
24 package org.onap.clamp.clds.model.prop;
25
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
28 import com.fasterxml.jackson.databind.JsonNode;
29
30 /**
31  * Parse Tca Threshhold json properties.
32  *
33  * Example json:
34  * {"TCA_0lm6cix":{"Narra":[{"name":"tname","value":"Narra"},{"name":"tcaEnab",
35  * "value":"on"},{"name":"tcaPol","value":"Polcicy1"},{"name":"tcaPolId","value"
36  * :"1"},{"name":"tcaInt","value":"1"},{"name":"tcaSev","value":"Critical"},{
37  * "name":"tcaVio","value":"1"},{"serviceConfigurations":[["FIELDPATH_test_1",
38  * ">","4"],["FIELDPATH_test_1","=","5"]]}],"Srini":[{"name":"tname","value":
39  * "Srini"},{"name":"tcaEnab","value":"on"},{"name":"tcaPol","value":"Policy1"},
40  * {"name":"tcaPolId","value":"1"},{"name":"tcaInt","value":"1"},{"name":
41  * "tcaSev","value":"Major"},{"name":"tcaVio","value":"1"},{
42  * "serviceConfigurations":[["FIELDPATH_test_2","=","3"],["FIELDPATH_test_1",">"
43  * ,"2"]]}]}}
44  *
45  *
46  */
47 public class TcaThreshhold {
48
49     protected static final EELFLogger       logger      = EELFManager.getInstance().getLogger(TcaThreshhold.class);
50     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
51
52     private String                  metric;
53     private String                  fieldPath;
54     private String                  operator;
55     private Integer                 threshhold;
56
57     /**
58      * Parse Tca Threshhold given json node
59      *
60      * @param node
61      */
62     public TcaThreshhold(JsonNode node) {
63
64         if (node.get(0) != null) {
65             metric = node.get(0).asText();
66         }
67         if (node.get(1) != null) {
68             operator = node.get(1).asText();
69         }
70         if (node.get(2) != null) {
71             threshhold = Integer.valueOf(node.get(2).asText());
72         }
73         if (node.get(3) != null) {
74             fieldPath = node.get(3).asText();
75         }
76     }
77
78     public String getMetric() {
79         return metric;
80     }
81
82     public void setMetric(String metric) {
83         this.metric = metric;
84     }
85
86     public String getFieldPath() {
87         return fieldPath;
88     }
89
90     public void setFieldPath(String fieldPath) {
91         this.fieldPath = fieldPath;
92     }
93
94     public String getOperator() {
95         return operator;
96     }
97
98     public void setOperator(String operator) {
99         this.operator = operator;
100     }
101
102     public Integer getThreshhold() {
103         return threshhold;
104     }
105
106     public void setThreshhold(Integer threshhold) {
107         this.threshhold = threshhold;
108     }
109
110 }