2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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.properties;
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
28 import com.fasterxml.jackson.databind.JsonNode;
30 import java.util.ArrayList;
31 import java.util.Iterator;
32 import java.util.List;
35 * Parse ONAP Tca Item json properties.
38 public class TcaItem {
40 protected static final EELFLogger logger = EELFManager.getInstance().getLogger(TcaItem.class);
41 protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
43 private String tcaName;
44 private String tcaUuId;
45 private String policyId;
46 private String eventName;
47 private String controlLoopSchemaType;
48 private List<TcaThreshold> tcaThresholds;
51 * Parse Tca Item given json node
55 public TcaItem(JsonNode node) {
57 tcaName = AbstractModelElement.getValueByName(node, "tname");
58 tcaUuId = AbstractModelElement.getValueByName(node, "tuuid");
59 policyId = AbstractModelElement.getValueByName(node, "tcaPolId");
60 eventName = AbstractModelElement.getValueByName(node, "eventName");
61 controlLoopSchemaType = AbstractModelElement.getValueByName(node, "controlLoopSchemaType");
62 // process service Configurations
63 JsonNode serviceConfigurationsNode = node.get(node.size() - 1).get("serviceConfigurations");
64 Iterator<JsonNode> itr = serviceConfigurationsNode.elements();
65 tcaThresholds = new ArrayList<>();
66 while (itr.hasNext()) {
67 tcaThresholds.add(new TcaThreshold(itr.next()));
71 public String getControlLoopSchemaType() {
72 return controlLoopSchemaType;
75 public void setControlLoopSchemaType(String controlLoopSchemaType) {
76 this.controlLoopSchemaType = controlLoopSchemaType;
79 public String getTcaName() {
83 public void setTcaName(String tcaName) {
84 this.tcaName = tcaName;
87 public String getTcaUuId() {
91 public void setTcaUuId(String tcaUuId) {
92 this.tcaUuId = tcaUuId;
95 public String getPolicyId() {
99 public void setPolicyId(String policyId) {
100 this.policyId = policyId;
103 public List<TcaThreshold> getTcaThresholds() {
104 return tcaThresholds;
107 public String getEventName() {
111 public void setEventName(String eventName) {
112 this.eventName = eventName;