2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.common.api;
23 import com.google.gson.Gson;
24 import com.google.gson.reflect.TypeToken;
26 import java.lang.reflect.Type;
27 import java.util.List;
29 public class HealthCheckInfo {
31 private String healthCheckComponent;
32 private HealthCheckStatus healthCheckStatus;
33 private String version;
34 private String description;
35 private List<HealthCheckInfo> componentsInfo;
37 public void setHealthCheckComponent(String healthCheckComponent) {
38 this.healthCheckComponent = healthCheckComponent;
41 public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
42 String version, String description) {
44 this.healthCheckComponent = healthCheckComponent;
45 this.healthCheckStatus = healthCheckStatus;
46 this.version = version;
47 this.description = description;
50 public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
51 String version, String description, List<HealthCheckInfo> componentsInfo) {
53 this.healthCheckComponent = healthCheckComponent;
54 this.healthCheckStatus = healthCheckStatus;
55 this.version = version;
56 this.description = description;
57 this.componentsInfo = componentsInfo;
60 public HealthCheckInfo() {
64 public String getHealthCheckComponent() {
65 return healthCheckComponent;
68 public HealthCheckStatus getHealthCheckStatus() {
69 return healthCheckStatus;
72 public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) {
73 this.healthCheckStatus = healthCheckStatus;
76 public List<HealthCheckInfo> getComponentsInfo() {
77 return componentsInfo;
80 public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
81 this.componentsInfo = componentsInfo;
84 public String getVersion() {
88 public void setVersion(String version) {
89 this.version = version;
92 public String getDescription() {
96 public void setDescription(String description) {
97 this.description = description;
100 /*public enum HealthCheckComponent {
101 FE, BE, JANUSGRAPH, DE, ON_BOARDING, CASSANDRA, DCAE,
102 CAS, ZU;//Amdocs components
105 public enum HealthCheckStatus {
110 public String toString() {
111 return "HealthCheckInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus="
112 + healthCheckStatus + ", version=" + version + ", description=" + description + ", componentsInfo="
113 + componentsInfo + "]";
116 public static void main(String[] args) {
117 String des = "[{healthCheckComponent=BE4, healthCheckStatus=UP, version=0.0.1-SNAPSHOT, description=OK}, {healthCheckComponent=BE, healthCheckStatus=UP, version=1710.0.0-SNAPSHOT, description=OK}, {healthCheckComponent=BE5, healthCheckStatus=UP, version=2.1.9, description=OK}]";
118 Type listType = new TypeToken<List<HealthCheckInfo>>(){}.getType();
119 List<HealthCheckInfo> componentsInfo = new Gson().fromJson(des.toString(), listType);
120 System.out.println(componentsInfo.toString());