[CLAMP-1] Initial ONAP CLAMP seed code commit
[clamp.git] / src / main / java / org / onap / clamp / clds / model / prop / TcaThreshhold.java
1 package org.onap.clamp.clds.model.prop;
2
3 import java.util.logging.Logger;
4
5 import com.fasterxml.jackson.databind.JsonNode;
6
7 /**
8  * Parse Tca Threshhold json properties.
9  * 
10  * Example json: {"TCA_0lm6cix":{"Narra":[{"name":"tname","value":"Narra"},{"name":"tcaEnab","value":"on"},{"name":"tcaPol","value":"Polcicy1"},{"name":"tcaPolId","value":"1"},{"name":"tcaInt","value":"1"},{"name":"tcaSev","value":"Critical"},{"name":"tcaVio","value":"1"},{"serviceConfigurations":[["FIELDPATH_test_1",">","4"],["FIELDPATH_test_1","=","5"]]}],"Srini":[{"name":"tname","value":"Srini"},{"name":"tcaEnab","value":"on"},{"name":"tcaPol","value":"Policy1"},{"name":"tcaPolId","value":"1"},{"name":"tcaInt","value":"1"},{"name":"tcaSev","value":"Major"},{"name":"tcaVio","value":"1"},{"serviceConfigurations":[["FIELDPATH_test_2","=","3"],["FIELDPATH_test_1",">","2"]]}]}}
11  * 
12  *
13  */
14 public class TcaThreshhold {
15
16         private static final Logger logger = Logger.getLogger(TcaThreshhold.class.getName());
17         
18         private String metric;
19         private String fieldPath;
20         private String operator;
21         private Integer threshhold;
22         
23         /**
24          * Parse Tca Threshhold given json node
25          * 
26          * @param node
27          */
28         public TcaThreshhold(JsonNode node) {
29                 
30                 if(node.get(0) != null){
31                         metric = node.get(0).asText();
32                 }
33                 if(node.get(1) != null){
34                         operator = node.get(1).asText();
35                 }
36                 if(node.get(2) != null){
37                         threshhold = Integer.valueOf(node.get(2).asText());
38                 }
39                 if(node.get(3) != null){
40                         fieldPath = node.get(3).asText();
41                 }
42         }
43
44         public String getMetric() {
45                 return metric;
46         }
47
48         public void setMetric(String metric) {
49                 this.metric = metric;
50         }
51
52         public String getFieldPath() {
53                 return fieldPath;
54         }
55
56         public void setFieldPath(String fieldPath) {
57                 this.fieldPath = fieldPath;
58         }
59
60         public String getOperator() {
61                 return operator;
62         }
63
64         public void setOperator(String operator) {
65                 this.operator = operator;
66         }
67
68         public Integer getThreshhold() {
69                 return threshhold;
70         }
71
72         public void setThreshhold(Integer threshhold) {
73                 this.threshhold = threshhold;
74         }
75         
76 }