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