f62c984ef981da3c9f37d81d6b6cd5e5a604c218
[so.git] / adapters / mso-sdnc-adapter / src / main / java / org / openecomp / mso / adapters / sdnc / client / SDNCAdapterCallbackRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
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.openecomp.mso.adapters.sdnc.client;
22
23
24 import javax.xml.bind.annotation.XmlAccessType;
25 import javax.xml.bind.annotation.XmlAccessorType;
26 import javax.xml.bind.annotation.XmlElement;
27 import javax.xml.bind.annotation.XmlRootElement;
28 import javax.xml.bind.annotation.XmlType;
29
30 import javax.xml.bind.JAXBContext;
31 import javax.xml.bind.Marshaller;
32 import java.io.StringWriter;
33 import org.openecomp.mso.logger.MsoLogger;
34 import org.openecomp.mso.logger.MessageEnum;
35 /**
36  * <p>Java class for anonymous complex type.
37  *
38  * <p>The following schema fragment specifies the expected content contained within this class.
39  *
40  * <pre>
41  * &lt;complexType>
42  *   &lt;complexContent>
43  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
44  *       &lt;sequence>
45  *         &lt;element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
46  *         &lt;element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
47  *       &lt;/sequence>
48  *     &lt;/restriction>
49  *   &lt;/complexContent>
50  * &lt;/complexType>
51  * </pre>
52  *
53  *
54  */
55 //SDNCAdapter to BPEL Async response
56 @XmlAccessorType(XmlAccessType.FIELD)
57 @XmlType(name = "", propOrder = {
58     "callbackHeader",
59     "requestData"
60 })
61 @XmlRootElement(name = "SDNCAdapterCallbackRequest")
62 public class SDNCAdapterCallbackRequest {
63
64     @XmlElement(name = "CallbackHeader", required = true)
65     protected CallbackHeader callbackHeader;
66     @XmlElement(name = "RequestData")
67     protected Object requestData;
68
69     private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
70
71     /**
72      * Gets the value of the callbackHeader property.
73      *
74      * @return
75      *     possible object is
76      *     {@link CallbackHeader }
77      *
78      */
79     public CallbackHeader getCallbackHeader() {
80         return callbackHeader;
81     }
82
83     /**
84      * Sets the value of the callbackHeader property.
85      *
86      * @param value
87      *     allowed object is
88      *     {@link CallbackHeader }
89      *
90      */
91     public void setCallbackHeader(CallbackHeader value) {
92         this.callbackHeader = value;
93     }
94
95     /**
96      * Gets the value of the requestData property.
97      *
98      * @return
99      *     possible object is
100      *     {@link Object }
101      *
102      */
103     public Object getRequestData() {
104         return requestData;
105     }
106
107     /**
108      * Sets the value of the requestData property.
109      *
110      * @param value
111      *     allowed object is
112      *     {@link Object }
113      *
114      */
115     public void setRequestData(Object value) {
116         this.requestData = value;
117     }
118
119         @Override
120         public String toString() {
121                 try {
122                         JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client");
123                         Marshaller m = ctx.createMarshaller();
124                         m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
125                         m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
126                         StringWriter w = new StringWriter();
127                         m.marshal(this, w);
128                         return (w.toString());
129                 }
130                 catch (Exception e)
131                 {
132                         msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e);
133                 }
134                 return("");
135         }
136 }