Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7473 vikram.rag 1
 
2
package com.amazonservices.mws.orders.model;
3
 
4
import javax.xml.bind.annotation.XmlAccessType;
5
import javax.xml.bind.annotation.XmlAccessorType;
6
import javax.xml.bind.annotation.XmlElement;
7
import javax.xml.bind.annotation.XmlRootElement;
8
import javax.xml.bind.annotation.XmlSchemaType;
9
import javax.xml.bind.annotation.XmlType;
10
import javax.xml.datatype.XMLGregorianCalendar;
11
 
12
 
13
/**
14
 * <p>Java class for anonymous complex type.
15
 * 
16
 * <p>The following schema fragment specifies the expected content contained within this class.
17
 * 
18
 * <pre>
19
 * &lt;complexType>
20
 *   &lt;complexContent>
21
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
22
 *       &lt;sequence>
23
 *         &lt;element name="Status" type="{https://mws.amazonservices.com/Orders/2011-01-01}ServiceStatusEnum" minOccurs="0"/>
24
 *         &lt;element name="Timestamp" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
25
 *         &lt;element name="MessageId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
26
 *         &lt;element name="Messages" type="{https://mws.amazonservices.com/Orders/2011-01-01}MessageList" minOccurs="0"/>
27
 *       &lt;/sequence>
28
 *     &lt;/restriction>
29
 *   &lt;/complexContent>
30
 * &lt;/complexType>
31
 * </pre>
32
 * 
33
 * 
34
 */
35
@XmlAccessorType(XmlAccessType.FIELD)
36
@XmlType(name = "", propOrder = {
37
    "status",
38
    "timestamp",
39
    "messageId",
40
    "messages"
41
})
42
@XmlRootElement(name = "GetServiceStatusResult")
43
public class GetServiceStatusResult {
44
 
45
    @XmlElement(name = "Status")
46
    protected ServiceStatusEnum status;
47
    @XmlElement(name = "Timestamp")
48
    @XmlSchemaType(name = "dateTime")
49
    protected XMLGregorianCalendar timestamp;
50
    @XmlElement(name = "MessageId")
51
    protected String messageId;
52
    @XmlElement(name = "Messages")
53
    protected MessageList messages;
54
 
55
    /**
56
     * Default constructor
57
     * 
58
     */
59
    public GetServiceStatusResult() {
60
        super();
61
    }
62
 
63
    /**
64
     * Value constructor
65
     * 
66
     */
67
    public GetServiceStatusResult(final ServiceStatusEnum status, final XMLGregorianCalendar timestamp, final String messageId, final MessageList messages) {
68
        this.status = status;
69
        this.timestamp = timestamp;
70
        this.messageId = messageId;
71
        this.messages = messages;
72
    }
73
 
74
    /**
75
     * Gets the value of the status property.
76
     * 
77
     * @return
78
     *     possible object is
79
     *     {@link ServiceStatusEnum }
80
     *     
81
     */
82
    public ServiceStatusEnum getStatus() {
83
        return status;
84
    }
85
 
86
    /**
87
     * Sets the value of the status property.
88
     * 
89
     * @param value
90
     *     allowed object is
91
     *     {@link ServiceStatusEnum }
92
     *     
93
     */
94
    public void setStatus(ServiceStatusEnum value) {
95
        this.status = value;
96
    }
97
 
98
    public boolean isSetStatus() {
99
        return (this.status!= null);
100
    }
101
 
102
    /**
103
     * Gets the value of the timestamp property.
104
     * 
105
     * @return
106
     *     possible object is
107
     *     {@link XMLGregorianCalendar }
108
     *     
109
     */
110
    public XMLGregorianCalendar getTimestamp() {
111
        return timestamp;
112
    }
113
 
114
    /**
115
     * Sets the value of the timestamp property.
116
     * 
117
     * @param value
118
     *     allowed object is
119
     *     {@link XMLGregorianCalendar }
120
     *     
121
     */
122
    public void setTimestamp(XMLGregorianCalendar value) {
123
        this.timestamp = value;
124
    }
125
 
126
    public boolean isSetTimestamp() {
127
        return (this.timestamp!= null);
128
    }
129
 
130
    /**
131
     * Gets the value of the messageId property.
132
     * 
133
     * @return
134
     *     possible object is
135
     *     {@link String }
136
     *     
137
     */
138
    public String getMessageId() {
139
        return messageId;
140
    }
141
 
142
    /**
143
     * Sets the value of the messageId property.
144
     * 
145
     * @param value
146
     *     allowed object is
147
     *     {@link String }
148
     *     
149
     */
150
    public void setMessageId(String value) {
151
        this.messageId = value;
152
    }
153
 
154
    public boolean isSetMessageId() {
155
        return (this.messageId!= null);
156
    }
157
 
158
    /**
159
     * Gets the value of the messages property.
160
     * 
161
     * @return
162
     *     possible object is
163
     *     {@link MessageList }
164
     *     
165
     */
166
    public MessageList getMessages() {
167
        return messages;
168
    }
169
 
170
    /**
171
     * Sets the value of the messages property.
172
     * 
173
     * @param value
174
     *     allowed object is
175
     *     {@link MessageList }
176
     *     
177
     */
178
    public void setMessages(MessageList value) {
179
        this.messages = value;
180
    }
181
 
182
    public boolean isSetMessages() {
183
        return (this.messages!= null);
184
    }
185
 
186
    /**
187
     * Sets the value of the Status property.
188
     * 
189
     * @param value
190
     * @return
191
     *     this instance
192
     */
193
    public GetServiceStatusResult withStatus(ServiceStatusEnum value) {
194
        setStatus(value);
195
        return this;
196
    }
197
 
198
    /**
199
     * Sets the value of the Timestamp property.
200
     * 
201
     * @param value
202
     * @return
203
     *     this instance
204
     */
205
    public GetServiceStatusResult withTimestamp(XMLGregorianCalendar value) {
206
        setTimestamp(value);
207
        return this;
208
    }
209
 
210
    /**
211
     * Sets the value of the MessageId property.
212
     * 
213
     * @param value
214
     * @return
215
     *     this instance
216
     */
217
    public GetServiceStatusResult withMessageId(String value) {
218
        setMessageId(value);
219
        return this;
220
    }
221
 
222
    /**
223
     * Sets the value of the Messages property.
224
     * 
225
     * @param value
226
     * @return
227
     *     this instance
228
     */
229
    public GetServiceStatusResult withMessages(MessageList value) {
230
        setMessages(value);
231
        return this;
232
    }
233
 
234
 
235
 
236
    /**
237
     * 
238
     * XML fragment representation of this object
239
     * 
240
     * @return XML fragment for this object. Name for outer
241
     * tag expected to be set by calling method. This fragment
242
     * returns inner properties representation only
243
     */
244
    public String toXMLFragment() {
245
        StringBuffer xml = new StringBuffer();
246
        if (isSetStatus()) {
247
            xml.append("<Status>");
248
            xml.append(getStatus().value());
249
            xml.append("</Status>");
250
        }
251
        if (isSetTimestamp()) {
252
            xml.append("<Timestamp>");
253
            xml.append(getTimestamp() + "");
254
            xml.append("</Timestamp>");
255
        }
256
        if (isSetMessageId()) {
257
            xml.append("<MessageId>");
258
            xml.append(escapeXML(getMessageId()));
259
            xml.append("</MessageId>");
260
        }
261
        if (isSetMessages()) {
262
            MessageList  messages = getMessages();
263
            xml.append("<Messages>");
264
            xml.append(messages.toXMLFragment());
265
            xml.append("</Messages>");
266
        } 
267
        return xml.toString();
268
    }
269
 
270
    /**
271
     * 
272
     * Escape XML special characters
273
     */
274
    private String escapeXML(String string) {
275
        if (string == null)
276
            return "null";
277
        StringBuffer sb = new StringBuffer();
278
        int length = string.length();
279
        for (int i = 0; i < length; ++i) {
280
            char c = string.charAt(i);
281
            switch (c) {
282
            case '&':
283
                sb.append("&amp;");
284
                break;
285
            case '<':
286
                sb.append("&lt;");
287
                break;
288
            case '>':
289
                sb.append("&gt;");
290
                break;
291
            case '\'':
292
                sb.append("&#039;");
293
                break;
294
            case '"':
295
                sb.append("&quot;");
296
                break;
297
            default:
298
                sb.append(c);
299
            }
300
        }
301
        return sb.toString();
302
    }
303
 
304
 
305
 
306
    /**
307
     *
308
     * JSON fragment representation of this object
309
     *
310
     * @return JSON fragment for this object. Name for outer
311
     * object expected to be set by calling method. This fragment
312
     * returns inner properties representation only
313
     *
314
     */
315
    protected String toJSONFragment() {
316
        StringBuffer json = new StringBuffer();
317
        boolean first = true;
318
        if (isSetStatus()) {
319
            if (!first) json.append(", ");
320
            json.append(quoteJSON("Status"));
321
            json.append(" : ");
322
            json.append(quoteJSON(getStatus().value()));
323
            first = false;
324
        }
325
        if (isSetTimestamp()) {
326
            if (!first) json.append(", ");
327
            json.append(quoteJSON("Timestamp"));
328
            json.append(" : ");
329
            json.append(quoteJSON(getTimestamp() + ""));
330
            first = false;
331
        }
332
        if (isSetMessageId()) {
333
            if (!first) json.append(", ");
334
            json.append(quoteJSON("MessageId"));
335
            json.append(" : ");
336
            json.append(quoteJSON(getMessageId()));
337
            first = false;
338
        }
339
        if (isSetMessages()) {
340
            if (!first) json.append(", ");
341
            json.append("\"Messages\" : {");
342
            MessageList  messages = getMessages();
343
 
344
 
345
            json.append(messages.toJSONFragment());
346
            json.append("}");
347
            first = false;
348
        }
349
        return json.toString();
350
    }
351
 
352
    /**
353
     *
354
     * Quote JSON string
355
     */
356
    private String quoteJSON(String string) {
357
        if (string == null)
358
            return "null";
359
        StringBuffer sb = new StringBuffer();
360
        sb.append("\"");
361
        int length = string.length();
362
        for (int i = 0; i < length; ++i) {
363
            char c = string.charAt(i);
364
            switch (c) {
365
            case '"':
366
                sb.append("\\\"");
367
                break;
368
            case '\\':
369
                sb.append("\\\\");
370
                break;
371
            case '/':
372
                sb.append("\\/");
373
                break;
374
            case '\b':
375
                sb.append("\\b");
376
                break;
377
            case '\f':
378
                sb.append("\\f");
379
                break;
380
            case '\n':
381
                sb.append("\\n");
382
                break;
383
            case '\r':
384
                sb.append("\\r");
385
                break;
386
            case '\t':
387
                sb.append("\\t");
388
                break;
389
            default:
390
                if (c <  ' ') {
391
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
392
                } else {
393
                sb.append(c);
394
            }
395
        }
396
        }
397
        sb.append("\"");
398
        return sb.toString();
399
    }
400
 
401
 
402
}