f15c62493adc9a643c628c815767e132d4c642c6
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7  * Modifications Copyright (c) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.so.adapters.vnfrest;
24
25
26 import java.util.Map;
27
28 import javax.xml.bind.annotation.XmlRootElement;
29
30 import org.onap.so.openstack.beans.VnfStatus;
31
32 import com.fasterxml.jackson.databind.ObjectMapper;
33 import com.fasterxml.jackson.databind.SerializationFeature;
34
35 import org.slf4j.Logger;
36 import org.slf4j.LoggerFactory;
37
38 @XmlRootElement(name = "queryVolumeGroupResponse")
39 public class QueryVolumeGroupResponse {
40         private static final Logger logger = LoggerFactory.getLogger(QueryVolumeGroupResponse.class);
41         private String volumeGroupId;
42         private String volumeGroupStackId;
43         private VnfStatus volumeGroupStatus;
44         private Map<String,String> volumeGroupOutputs;
45
46         public QueryVolumeGroupResponse() {
47         }
48
49         public QueryVolumeGroupResponse(
50                         String volumeGroupId,
51                         String volumeGroupStackId,
52                         VnfStatus volumeGroupStatus,
53                         Map<String, String> volumeGroupOutputs)
54         {
55                 super();
56                 this.volumeGroupId = volumeGroupId;
57                 this.volumeGroupStackId = volumeGroupStackId;
58                 this.volumeGroupStatus = volumeGroupStatus;
59                 this.volumeGroupOutputs = volumeGroupOutputs;
60         }
61
62         public String getVolumeGroupId() {
63                 return volumeGroupId;
64         }
65
66         public void setVolumeGroupId(String volumeGroupId) {
67                 this.volumeGroupId = volumeGroupId;
68         }
69
70         public String getVolumeGroupStackId() {
71                 return volumeGroupStackId;
72         }
73
74         public void setVolumeGroupStackId(String volumeGroupStackId) {
75                 this.volumeGroupStackId = volumeGroupStackId;
76         }
77
78         public VnfStatus getVolumeGroupStatus() {
79                 return volumeGroupStatus;
80         }
81
82         public void setVolumeGroupStatus(VnfStatus volumeGroupStatus) {
83                 this.volumeGroupStatus = volumeGroupStatus;
84         }
85
86         public Map<String, String> getVolumeGroupOutputs() {
87                 return volumeGroupOutputs;
88         }
89
90         public void setVolumeGroupOutputs(Map<String, String> volumeGroupOutputs) {
91                 this.volumeGroupOutputs = volumeGroupOutputs;
92         }
93
94         public String toJsonString() {
95                 String jsonString = null;
96                 try {
97                         ObjectMapper mapper = new ObjectMapper();
98                         mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
99                         jsonString = mapper.writeValueAsString(this);
100                 }
101                 catch (Exception e) {
102                         logger.debug("Exception :", e);
103                 }
104                 return jsonString;
105         }
106 }