Merge "Reorder modifiers"
[so.git] / adapters / mso-vfc-adapter / src / main / java / org / openecomp / mso / 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  * ================================================================================
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
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
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=========================================================
20  */
21 package org.openecomp.mso.adapters.vfc.model;
22
23 import java.io.ByteArrayOutputStream;
24
25 import javax.xml.bind.JAXBContext;
26 import javax.xml.bind.Marshaller;
27
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import com.fasterxml.jackson.databind.SerializationFeature;
30 import org.openecomp.mso.logger.MsoLogger;
31
32 /**
33  * NS Create Input Parameter For VFC Adapter<br>
34  * <p>
35  * </p>
36  * 
37  * @version ONAP Amsterdam Release 2017/1/7
38  */
39 public class NSResourceInputParameter {
40
41     private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
42     
43     private NsOperationKey nsOperationKey;
44
45     private String nsServiceName;
46
47     private String nsServiceDescription;
48     
49     private String nsServiceModelUUID;
50
51     private NsParameters nsParameters;
52
53     private NsScaleParameters nsScaleParameters;
54
55
56     /**
57      * @return Returns the nsServiceName.
58      */
59     public String getNsServiceName() {
60         return nsServiceName;
61     }
62
63     
64     /**
65      * @param nsServiceName The nsServiceName to set.
66      */
67     public void setNsServiceName(String nsServiceName) {
68         this.nsServiceName = nsServiceName;
69     }
70
71     
72     /**
73      * @return Returns the nsServiceDescription.
74      */
75     public String getNsServiceDescription() {
76         return nsServiceDescription;
77     }
78
79     
80     /**
81      * @param nsServiceDescription The nsServiceDescription to set.
82      */
83     public void setNsServiceDescription(String nsServiceDescription) {
84         this.nsServiceDescription = nsServiceDescription;
85     }
86
87     /**
88      * @return Returns the nsParameters.
89      */
90     public NsParameters getNsParameters() {
91         return nsParameters;
92     }
93
94     /**
95      * @param nsParameters The nsParameters to set.
96      */
97     public void setNsParameters(NsParameters nsParameters) {
98         this.nsParameters = nsParameters;
99     }
100
101     public NsOperationKey getNsOperationKey() {
102         return nsOperationKey;
103     }
104
105     public void setNsOperationKey(NsOperationKey nsOperationKey) {
106         this.nsOperationKey = nsOperationKey;
107     }
108     public String toJsonString() {
109         String jsonString = null;
110         try {
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);
116         }
117         return jsonString;
118     }
119
120     public String toXmlString() {
121         try {
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);
130             return "";
131         }
132     }
133
134     public NsScaleParameters getNsScaleParameters() {
135         return nsScaleParameters;
136     }
137
138     public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
139         this.nsScaleParameters = nsScaleParameters;
140     }
141
142
143         public String getNsServiceModelUUID() {
144                 return nsServiceModelUUID;
145         }
146
147
148         public void setNsServiceModelUUID(String nsServiceModelUUID) {
149                 this.nsServiceModelUUID = nsServiceModelUUID;
150         }
151     
152 }