2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 package org.onap.clamp.clds.model.prop;
26 import java.util.ArrayList;
27 import java.util.Iterator;
28 import java.util.List;
30 import com.att.eelf.configuration.EELFLogger;
31 import com.att.eelf.configuration.EELFManager;
32 import com.fasterxml.jackson.databind.JsonNode;
35 * Parse Tca Item json properties.
38 * {"TCA_0lm6cix":{"Narra":[{"name":"tname","value":"Narra"},{"name":"tcaEnab",
39 * "value":"on"},{"name":"tcaPol","value":"Polcicy1"},{"name":"tcaPolId","value"
40 * :"1"},{"name":"tcaInt","value":"1"},{"name":"tcaSev","value":"Critical"},{
41 * "name":"tcaVio","value":"1"},{"serviceConfigurations":[["FIELDPATH_test_1",
42 * ">","4"],["FIELDPATH_test_1","=","5"]]}],"Srini":[{"name":"tname","value":
43 * "Srini"},{"name":"tcaEnab","value":"on"},{"name":"tcaPol","value":"Policy1"},
44 * {"name":"tcaPolId","value":"1"},{"name":"tcaInt","value":"1"},{"name":
45 * "tcaSev","value":"Major"},{"name":"tcaVio","value":"1"},{
46 * "serviceConfigurations":[["FIELDPATH_test_2","=","3"],["FIELDPATH_test_1",">"
51 public class TcaItem {
53 protected static final EELFLogger logger = EELFManager.getInstance().getLogger(TcaItem.class);
54 protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
56 private String tcaName;
57 private String tcaUuId;
58 private String nfNamingCode;
59 private String tcaEnable;
60 private String policyId;
61 private Integer interval;
62 private String severity;
63 private Integer violations;
64 private List<TcaThreshhold> tcaThreshholds;
67 * Parse Tca Item given json node
71 public TcaItem(JsonNode node) {
73 tcaName = AbstractModelElement.getValueByName(node, "tname");
74 tcaUuId = AbstractModelElement.getValueByName(node, "tuuid");
75 nfNamingCode = AbstractModelElement.getValueByName(node, "tnfc");
76 tcaEnable = AbstractModelElement.getValueByName(node, "tcaEnab");
77 policyId = AbstractModelElement.getValueByName(node, "tcaPolId");
78 if (AbstractModelElement.getValueByName(node, "tcaInt") != null) {
79 interval = Integer.valueOf(AbstractModelElement.getValueByName(node, "tcaInt"));
81 severity = AbstractModelElement.getValueByName(node, "tcaSev");
82 if (AbstractModelElement.getValueByName(node, "tcaVio") != null) {
83 violations = Integer.valueOf(AbstractModelElement.getValueByName(node, "tcaVio"));
86 // process service Configurations
87 JsonNode serviceConfigurationsNode = node.get(node.size() - 1).get("serviceConfigurations");
88 Iterator<JsonNode> itr = serviceConfigurationsNode.elements();
89 tcaThreshholds = new ArrayList<TcaThreshhold>();
90 while (itr.hasNext()) {
91 tcaThreshholds.add(new TcaThreshhold(itr.next()));
95 public String getTcaName() {
99 public void setTcaName(String tcaName) {
100 this.tcaName = tcaName;
103 public String getTcaUuId() {
107 public void setTcaUuId(String tcaUuId) {
108 this.tcaUuId = tcaUuId;
111 public String getNfNamingCode() {
115 public void setNfNamingCode(String nfNamingCode) {
116 this.nfNamingCode = nfNamingCode;
119 public String getTcaEnable() {
123 public void setTcaEnable(String tcaEnable) {
124 this.tcaEnable = tcaEnable;
127 public String getPolicyId() {
131 public void setPolicyId(String policyId) {
132 this.policyId = policyId;
135 public Integer getInterval() {
139 public void setInterval(Integer interval) {
140 this.interval = interval;
143 public String getSeverity() {
147 public void setSeverity(String severity) {
148 this.severity = severity;
151 public Integer getViolations() {
155 public void setViolations(Integer violations) {
156 this.violations = violations;
159 public List<TcaThreshhold> getTcaThreshholds() {
160 return tcaThreshholds;