Removed MsoLogger class
[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
28 import javax.xml.bind.JAXBContext;
29 import javax.xml.bind.Marshaller;
30 import javax.xml.bind.annotation.XmlAccessType;
31 import javax.xml.bind.annotation.XmlAccessorType;
32 import javax.xml.bind.annotation.XmlElement;
33 import javax.xml.bind.annotation.XmlRootElement;
34 import javax.xml.bind.annotation.XmlType;
35
36 import org.onap.so.logger.ErrorCode;
37 import org.onap.so.logger.MessageEnum;
38 import org.slf4j.Logger;
39 import org.slf4j.LoggerFactory;
40
41 /**
42  * <p>Java class for anonymous complex type.
43  *
44  * <p>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 = {
64     "callbackHeader",
65     "requestData"
66 })
67 @XmlRootElement(name = "SDNCAdapterCallbackRequest")
68 public class SDNCAdapterCallbackRequest {
69
70     @XmlElement(name = "CallbackHeader", required = true)
71     protected CallbackHeader callbackHeader;
72     @XmlElement(name = "RequestData")
73     protected Object requestData;
74
75     private static Logger logger = LoggerFactory.getLogger(SDNCAdapterCallbackRequest.class);
76
77     /**
78      * Gets the value of the callbackHeader property.
79      *
80      * @return
81      *     possible object is
82      *     {@link CallbackHeader }
83      *
84      */
85     public CallbackHeader getCallbackHeader() {
86         return callbackHeader;
87     }
88
89     /**
90      * Sets the value of the callbackHeader property.
91      *
92      * @param value
93      *     allowed object is
94      *     {@link CallbackHeader }
95      *
96      */
97     public void setCallbackHeader(CallbackHeader value) {
98         this.callbackHeader = value;
99     }
100
101     /**
102      * Gets the value of the requestData property.
103      *
104      * @return
105      *     possible object is
106      *     {@link Object }
107      *
108      */
109     public Object getRequestData() {
110         return requestData;
111     }
112
113     /**
114      * Sets the value of the requestData property.
115      *
116      * @param value
117      *     allowed object is
118      *     {@link Object }
119      *
120      */
121     public void setRequestData(Object value) {
122         this.requestData = value;
123     }
124
125         @Override
126         public String toString() {
127                 try {
128                         JAXBContext ctx = JAXBContext.newInstance("org.onap.so.adapters.sdnc.client");
129                         Marshaller m = ctx.createMarshaller();
130                         m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
131                         m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
132                         StringWriter w = new StringWriter();
133                         m.marshal(this, w);
134                         return w.toString();
135                 }
136                 catch (Exception e)
137                 {
138         logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(),
139             "Exception - MARSHING_ERROR", e);
140     }
141                 return "";
142         }
143 }