Catalog alignment
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / common / api / HealthCheckInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.common.api;
22
23 import com.google.gson.Gson;
24 import com.google.gson.reflect.TypeToken;
25
26 import java.lang.reflect.Type;
27 import java.util.List;
28
29 public class HealthCheckInfo {
30         
31         private String healthCheckComponent;
32         private HealthCheckStatus healthCheckStatus;
33         private String version;
34         private String description;
35         private List<HealthCheckInfo> componentsInfo;
36
37         public void setHealthCheckComponent(String healthCheckComponent) {
38                 this.healthCheckComponent = healthCheckComponent;
39         }
40
41         public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
42                         String version, String description) {
43                 super();
44                 this.healthCheckComponent = healthCheckComponent;
45                 this.healthCheckStatus = healthCheckStatus;
46                 this.version = version;
47                 this.description = description;
48         }
49
50         public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
51                                                    String version, String description, List<HealthCheckInfo> componentsInfo) {
52                 super();
53                 this.healthCheckComponent = healthCheckComponent;
54                 this.healthCheckStatus = healthCheckStatus;
55                 this.version = version;
56                 this.description = description;
57                 this.componentsInfo = componentsInfo;
58 }
59
60         public HealthCheckInfo() {
61                 super();
62         }
63
64         public String getHealthCheckComponent() {
65                 return healthCheckComponent;
66         }
67
68         public HealthCheckStatus getHealthCheckStatus() {
69                 return healthCheckStatus;
70         }
71
72         public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) {
73                 this.healthCheckStatus = healthCheckStatus;
74         }
75
76         public List<HealthCheckInfo> getComponentsInfo() {
77                 return componentsInfo;
78         }
79
80         public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
81                 this.componentsInfo = componentsInfo;
82         }
83
84         public String getVersion() {
85                 return version;
86         }
87
88         public void setVersion(String version) {
89                 this.version = version;
90         }
91
92         public String getDescription() {
93                 return description;
94         }
95
96         public void setDescription(String description) {
97                 this.description = description;
98         }
99
100         /*public enum HealthCheckComponent {
101                 FE, BE, JANUSGRAPH, DE, ON_BOARDING, CASSANDRA, DCAE,
102                 CAS, ZU;//Amdocs components
103         }*/
104
105         public enum HealthCheckStatus {
106                 UP, DOWN, UNKNOWN;
107         }
108
109         @Override
110         public String toString() {
111                 return "HealthCheckInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus="
112                                 + healthCheckStatus + ", version=" + version + ", description=" + description + ", componentsInfo="
113                                 + componentsInfo + "]";
114         }
115         
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());
121         }
122 }