2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
23 package org.onap.so.adapters.vfc.model;
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;
34 * NS Create Input Parameter For VFC Adapter<br>
38 * @version ONAP Amsterdam Release 2017/1/7
40 public class NSResourceInputParameter {
42 private static final Logger logger = LoggerFactory.getLogger(NSResourceInputParameter.class);
44 private NsOperationKey nsOperationKey;
46 private String nsServiceName;
48 private String nsServiceDescription;
50 private String nsServiceModelUUID;
52 private NsParameters nsParameters;
54 private NsScaleParameters nsScaleParameters;
58 * @return Returns the nsServiceName.
60 public String getNsServiceName() {
66 * @param nsServiceName The nsServiceName to set.
68 public void setNsServiceName(String nsServiceName) {
69 this.nsServiceName = nsServiceName;
74 * @return Returns the nsServiceDescription.
76 public String getNsServiceDescription() {
77 return nsServiceDescription;
82 * @param nsServiceDescription The nsServiceDescription to set.
84 public void setNsServiceDescription(String nsServiceDescription) {
85 this.nsServiceDescription = nsServiceDescription;
89 * @return Returns the nsParameters.
91 public NsParameters getNsParameters() {
96 * @param nsParameters The nsParameters to set.
98 public void setNsParameters(NsParameters nsParameters) {
99 this.nsParameters = nsParameters;
102 public NsOperationKey getNsOperationKey() {
103 return nsOperationKey;
106 public void setNsOperationKey(NsOperationKey nsOperationKey) {
107 this.nsOperationKey = nsOperationKey;
110 public String toJsonString() {
111 String jsonString = null;
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);
122 public String toXmlString() {
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);
136 public NsScaleParameters getNsScaleParameters() {
137 return nsScaleParameters;
140 public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
141 this.nsScaleParameters = nsScaleParameters;
145 public String getNsServiceModelUUID() {
146 return nsServiceModelUUID;
150 public void setNsServiceModelUUID(String nsServiceModelUUID) {
151 this.nsServiceModelUUID = nsServiceModelUUID;