2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
6 * Copyright (C) 2018 CMCC All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.adapters.vfc.model;
23 import java.io.ByteArrayOutputStream;
25 import javax.xml.bind.JAXBContext;
26 import javax.xml.bind.Marshaller;
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import com.fasterxml.jackson.databind.SerializationFeature;
30 import org.openecomp.mso.logger.MsoLogger;
33 * NS Create Input Parameter For VFC Adapter<br>
37 * @version ONAP Amsterdam Release 2017/1/7
39 public class NSResourceInputParameter {
41 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
43 private NsOperationKey nsOperationKey;
45 private String nsServiceName;
47 private String nsServiceDescription;
49 private String nsServiceModelUUID;
51 private NsParameters nsParameters;
53 private NsScaleParameters nsScaleParameters;
57 * @return Returns the nsServiceName.
59 public String getNsServiceName() {
65 * @param nsServiceName The nsServiceName to set.
67 public void setNsServiceName(String nsServiceName) {
68 this.nsServiceName = nsServiceName;
73 * @return Returns the nsServiceDescription.
75 public String getNsServiceDescription() {
76 return nsServiceDescription;
81 * @param nsServiceDescription The nsServiceDescription to set.
83 public void setNsServiceDescription(String nsServiceDescription) {
84 this.nsServiceDescription = nsServiceDescription;
88 * @return Returns the nsParameters.
90 public NsParameters getNsParameters() {
95 * @param nsParameters The nsParameters to set.
97 public void setNsParameters(NsParameters nsParameters) {
98 this.nsParameters = nsParameters;
101 public NsOperationKey getNsOperationKey() {
102 return nsOperationKey;
105 public void setNsOperationKey(NsOperationKey nsOperationKey) {
106 this.nsOperationKey = nsOperationKey;
108 public String toJsonString() {
109 String jsonString = null;
111 ObjectMapper mapper = new ObjectMapper();
112 mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
113 jsonString = mapper.writeValueAsString(this);
114 } catch (Exception e) {
115 LOGGER.debug("Exception:", e);
120 public String toXmlString() {
122 ByteArrayOutputStream bs = new ByteArrayOutputStream();
123 JAXBContext context = JAXBContext.newInstance(this.getClass());
124 Marshaller marshaller = context.createMarshaller();
125 marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML
126 marshaller.marshal(this, bs);
127 return bs.toString();
128 } catch (Exception e) {
129 LOGGER.debug("Exception:", e);
134 public NsScaleParameters getNsScaleParameters() {
135 return nsScaleParameters;
138 public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
139 this.nsScaleParameters = nsScaleParameters;
143 public String getNsServiceModelUUID() {
144 return nsServiceModelUUID;
148 public void setNsServiceModelUUID(String nsServiceModelUUID) {
149 this.nsServiceModelUUID = nsServiceModelUUID;