Added oparent to sdc main
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / info / OperationalEnvInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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.be.info;
22
23 import com.fasterxml.jackson.annotation.JsonIgnore;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import com.fasterxml.jackson.core.JsonProcessingException;
26 import com.fasterxml.jackson.databind.ObjectMapper;
27 import org.apache.commons.lang3.StringUtils;
28 import org.openecomp.sdc.common.log.wrappers.Logger;
29
30 import java.io.IOException;
31
32 public final class OperationalEnvInfo {
33     @JsonIgnore
34     private static ObjectMapper objectMapper = new ObjectMapper();
35     
36     @JsonIgnore
37     private static final Logger logger = Logger.getLogger(OperationalEnvInfo.class);
38     
39     @JsonProperty("operational-environment-id")
40     private String operationalEnvId;
41
42     @JsonProperty("operational-environment-name")
43     private String operationalEnvName;
44
45     @JsonProperty("operational-environment-type")
46     private String operationalEnvType;
47
48     @JsonProperty("operational-environment-status")
49     private String operationalEnvStatus;
50
51     @JsonProperty("tenant-context")
52     private String tenantContext;
53
54     @JsonProperty("workload-context")
55     private String workloadContext;
56
57     @JsonProperty("resource-version")
58     private String resourceVersion;
59
60     @JsonProperty("relationship-list")
61     private RelationshipList relationships;
62
63     public String getOperationalEnvId() {
64         return operationalEnvId;
65     }
66     
67     public void setOperationalEnvId(String operationalEnvId) {
68         this.operationalEnvId = operationalEnvId;
69     }
70
71     public String getOperationalEnvName() {
72         return operationalEnvName;
73     }
74
75     public void setOperationalEnvName(String operationalEnvName) {
76         this.operationalEnvName = operationalEnvName;
77     }
78
79     public String getOperationalEnvType() {
80         return operationalEnvType;
81     }
82
83     public void setOperationalEnvType(String operationalEnvType) {
84         this.operationalEnvType = operationalEnvType;
85     }
86
87     public String getOperationalEnvStatus() {
88         return operationalEnvStatus;
89     }
90
91     public void setOperationalEnvStatus(String operationalEnvStatus) {
92         this.operationalEnvStatus = operationalEnvStatus;
93     }
94
95     public String getTenantContext() {
96         return tenantContext;
97     }
98
99     public void setTenantContext(String tenantContext) {
100         this.tenantContext = tenantContext;
101     }
102
103     public String getWorkloadContext() {
104         return workloadContext;
105     }
106
107     public void setWorkloadContext(String workloadContext) {
108         this.workloadContext = workloadContext;
109     }
110
111     public String getResourceVersion() {
112         return resourceVersion;
113     }
114
115     public void setResourceVersion(String resourceVersion) {
116         this.resourceVersion = resourceVersion;
117     }
118
119     public RelationshipList getRelationships() {
120         return relationships;
121     }
122
123     public void setRelationships(RelationshipList relationships) {
124         this.relationships = relationships;
125     }
126
127     @Override
128     public String toString() {
129         try {
130             return objectMapper.writeValueAsString(this);
131         }
132         catch (JsonProcessingException e) {
133             logger.debug("Convert object to string failed with exception. ", e);
134             return StringUtils.EMPTY;
135         }
136     }
137     
138     public static OperationalEnvInfo createFromJson(String json) throws IOException {
139         return objectMapper.readValue(json, OperationalEnvInfo.class);
140     }
141     
142 }