Containerization feature of SO
[so.git] / adapters / mso-sdnc-adapter / src / main / java / org / onap / so / adapters / sdnc / client / SDNCAdapterCallbackRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.adapters.sdnc.client;
22
23
24 import java.io.StringWriter;
25
26 import javax.xml.bind.JAXBContext;
27 import javax.xml.bind.Marshaller;
28 import javax.xml.bind.annotation.XmlAccessType;
29 import javax.xml.bind.annotation.XmlAccessorType;
30 import javax.xml.bind.annotation.XmlElement;
31 import javax.xml.bind.annotation.XmlRootElement;
32 import javax.xml.bind.annotation.XmlType;
33
34 import org.onap.so.logger.MessageEnum;
35 import org.onap.so.logger.MsoLogger;
36 /**
37  * <p>Java class for anonymous complex type.
38  *
39  * <p>The following schema fragment specifies the expected content contained within this class.
40  *
41  * <pre>
42  * &lt;complexType>
43  *   &lt;complexContent>
44  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
45  *       &lt;sequence>
46  *         &lt;element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
47  *         &lt;element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
48  *       &lt;/sequence>
49  *     &lt;/restriction>
50  *   &lt;/complexContent>
51  * &lt;/complexType>
52  * </pre>
53  *
54  *
55  */
56 //SDNCAdapter to BPEL Async response
57 @XmlAccessorType(XmlAccessType.FIELD)
58 @XmlType(name = "", propOrder = {
59     "callbackHeader",
60     "requestData"
61 })
62 @XmlRootElement(name = "SDNCAdapterCallbackRequest")
63 public class SDNCAdapterCallbackRequest {
64
65     @XmlElement(name = "CallbackHeader", required = true)
66     protected CallbackHeader callbackHeader;
67     @XmlElement(name = "RequestData")
68     protected Object requestData;
69
70     private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterCallbackRequest.class);
71
72     /**
73      * Gets the value of the callbackHeader property.
74      *
75      * @return
76      *     possible object is
77      *     {@link CallbackHeader }
78      *
79      */
80     public CallbackHeader getCallbackHeader() {
81         return callbackHeader;
82     }
83
84     /**
85      * Sets the value of the callbackHeader property.
86      *
87      * @param value
88      *     allowed object is
89      *     {@link CallbackHeader }
90      *
91      */
92     public void setCallbackHeader(CallbackHeader value) {
93         this.callbackHeader = value;
94     }
95
96     /**
97      * Gets the value of the requestData property.
98      *
99      * @return
100      *     possible object is
101      *     {@link Object }
102      *
103      */
104     public Object getRequestData() {
105         return requestData;
106     }
107
108     /**
109      * Sets the value of the requestData property.
110      *
111      * @param value
112      *     allowed object is
113      *     {@link Object }
114      *
115      */
116     public void setRequestData(Object value) {
117         this.requestData = value;
118     }
119
120         @Override
121         public String toString() {
122                 try {
123                         JAXBContext ctx = JAXBContext.newInstance("org.onap.so.adapters.sdnc.client");
124                         Marshaller m = ctx.createMarshaller();
125                         m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
126                         m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
127                         StringWriter w = new StringWriter();
128                         m.marshal(this, w);
129                         return w.toString();
130                 }
131                 catch (Exception e)
132                 {
133                         msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e);
134                 }
135                 return "";
136         }
137 }