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 HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
38 String version, String description) {
40 this.healthCheckComponent = healthCheckComponent;
41 this.healthCheckStatus = healthCheckStatus;
42 this.version = version;
43 this.description = description;
46 public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
47 String version, String description, List<HealthCheckInfo> componentsInfo) {
49 this.healthCheckComponent = healthCheckComponent;
50 this.healthCheckStatus = healthCheckStatus;
51 this.version = version;
52 this.description = description;
53 this.componentsInfo = componentsInfo;
56 public HealthCheckInfo() {
60 public String getHealthCheckComponent() {
61 return healthCheckComponent;
64 public HealthCheckStatus getHealthCheckStatus() {
65 return healthCheckStatus;
68 public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) {
69 this.healthCheckStatus = healthCheckStatus;
72 public List<HealthCheckInfo> getComponentsInfo() {
73 return componentsInfo;
76 public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
77 this.componentsInfo = componentsInfo;
80 public String getVersion() {
84 public void setVersion(String version) {
85 this.version = version;
88 public String getDescription() {
92 public void setDescription(String description) {
93 this.description = description;
96 /*public enum HealthCheckComponent {
97 FE, BE, JANUSGRAPH, DE, ON_BOARDING, CASSANDRA, DCAE,
98 CAS, ZU;//Amdocs components
101 public enum HealthCheckStatus {
106 public String toString() {
107 return "HealthCheckInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus="
108 + healthCheckStatus + ", version=" + version + ", description=" + description + ", componentsInfo="
109 + componentsInfo + "]";
112 public static void main(String[] args) {
113 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}]";
114 Type listType = new TypeToken<List<HealthCheckInfo>>(){}.getType();
115 List<HealthCheckInfo> componentsInfo = new Gson().fromJson(des.toString(), listType);
116 System.out.println(componentsInfo.toString());