Replaced all tabs with spaces in java and pom.xml
[so.git] / adapters / mso-vfc-adapter / src / main / java / org / onap / so / adapters / vfc / model / NSResourceInputParameter.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
6  * Copyright (C) 2018 CMCC 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.vfc.model;
24
25 import java.io.ByteArrayOutputStream;
26 import javax.xml.bind.JAXBContext;
27 import javax.xml.bind.Marshaller;
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import com.fasterxml.jackson.databind.SerializationFeature;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
32
33 /**
34  * NS Create Input Parameter For VFC Adapter<br>
35  * <p>
36  * </p>
37  * 
38  * @version ONAP Amsterdam Release 2017/1/7
39  */
40 public class NSResourceInputParameter {
41
42     private static final Logger logger = LoggerFactory.getLogger(NSResourceInputParameter.class);
43
44     private NsOperationKey nsOperationKey;
45
46     private String nsServiceName;
47
48     private String nsServiceDescription;
49
50     private String nsServiceModelUUID;
51
52     private NsParameters nsParameters;
53
54     private NsScaleParameters nsScaleParameters;
55
56
57     /**
58      * @return Returns the nsServiceName.
59      */
60     public String getNsServiceName() {
61         return nsServiceName;
62     }
63
64
65     /**
66      * @param nsServiceName The nsServiceName to set.
67      */
68     public void setNsServiceName(String nsServiceName) {
69         this.nsServiceName = nsServiceName;
70     }
71
72
73     /**
74      * @return Returns the nsServiceDescription.
75      */
76     public String getNsServiceDescription() {
77         return nsServiceDescription;
78     }
79
80
81     /**
82      * @param nsServiceDescription The nsServiceDescription to set.
83      */
84     public void setNsServiceDescription(String nsServiceDescription) {
85         this.nsServiceDescription = nsServiceDescription;
86     }
87
88     /**
89      * @return Returns the nsParameters.
90      */
91     public NsParameters getNsParameters() {
92         return nsParameters;
93     }
94
95     /**
96      * @param nsParameters The nsParameters to set.
97      */
98     public void setNsParameters(NsParameters nsParameters) {
99         this.nsParameters = nsParameters;
100     }
101
102     public NsOperationKey getNsOperationKey() {
103         return nsOperationKey;
104     }
105
106     public void setNsOperationKey(NsOperationKey nsOperationKey) {
107         this.nsOperationKey = nsOperationKey;
108     }
109
110     public String toJsonString() {
111         String jsonString = null;
112         try {
113             ObjectMapper mapper = new ObjectMapper();
114             mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
115             jsonString = mapper.writeValueAsString(this);
116         } catch (Exception e) {
117             logger.debug("Exception:", e);
118         }
119         return jsonString;
120     }
121
122     public String toXmlString() {
123         try {
124             ByteArrayOutputStream bs = new ByteArrayOutputStream();
125             JAXBContext context = JAXBContext.newInstance(this.getClass());
126             Marshaller marshaller = context.createMarshaller();
127             marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty print XML
128             marshaller.marshal(this, bs);
129             return bs.toString();
130         } catch (Exception e) {
131             logger.debug("Exception:", e);
132             return "";
133         }
134     }
135
136     public NsScaleParameters getNsScaleParameters() {
137         return nsScaleParameters;
138     }
139
140     public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
141         this.nsScaleParameters = nsScaleParameters;
142     }
143
144
145     public String getNsServiceModelUUID() {
146         return nsServiceModelUUID;
147     }
148
149
150     public void setNsServiceModelUUID(String nsServiceModelUUID) {
151         this.nsServiceModelUUID = nsServiceModelUUID;
152     }
153
154 }