Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8224 manish.sha 1
 
2
package com.amazonaws.mws.model;
3
 
4
import java.io.InputStream;
5
 
6
import javax.xml.bind.annotation.XmlAccessType;
7
import javax.xml.bind.annotation.XmlAccessorType;
8
import javax.xml.bind.annotation.XmlElement;
9
import javax.xml.bind.annotation.XmlRootElement;
10
import javax.xml.bind.annotation.XmlType;
11
import javax.xml.bind.annotation.XmlTransient;
12
 
13
/**
14
 * Generated by AWS Code Generator, but contains hand additions for streaming and Content-MD5 support
15
 * <p/>
16
 * Tue Feb 03 16:00:09 PST 2009
17
 * 
18
 */
19
@XmlAccessorType(XmlAccessType.FIELD)
20
@XmlType(name = "", propOrder = {
21
    "marketplace",
22
    "marketplaceIdList",
23
    "merchant",
24
    "feedContent",
25
    "contentMD5",
26
    "feedType",
27
    "purgeAndReplace"
28
})
29
@XmlRootElement(name = "SubmitFeedRequest")
30
public class SubmitFeedRequest {
31
 
32
    @XmlElement(name = "Marketplace")
33
    protected String marketplace;
34
    @XmlElement(name = "MarketplaceIdList")
35
    protected IdList marketplaceIdList;
36
    @XmlElement(name = "Merchant", required = true)
37
    protected String merchant;
38
    @XmlElement(name = "FeedContent", required = true)
39
    protected InputStream feedContent;
40
    @XmlElement(name = "ContentMD5", required = true)
41
    protected String contentMD5;
42
    @XmlElement(name = "FeedType", required = true)
43
    protected String feedType;
44
    @XmlElement(name = "PurgeAndReplace")
45
    protected Boolean purgeAndReplace;
46
 
47
    @XmlTransient
48
    protected ContentType contentType = null;
49
 
50
    /**
51
     * Default constructor
52
     * 
53
     */
54
    public SubmitFeedRequest() {
55
        super();
56
 
57
        // By default, use a content type of octet-stream
58
        this.contentType = ContentType.OctetStream;
59
    }
60
 
61
    /**
62
     * Value constructor
63
     * 
64
     */
65
    public SubmitFeedRequest(final String marketplace, final IdList marketplaceIdList, final String merchant, final InputStream feedContent, final String contentMD5, final String feedType, final Boolean purgeAndReplace) {
66
    	this();
67
 
68
        this.marketplace = marketplace;
69
        this.marketplaceIdList = marketplaceIdList;
70
        this.merchant = merchant;
71
        this.feedContent = feedContent;
72
        this.contentMD5 = contentMD5;
73
        this.feedType = feedType;
74
        this.purgeAndReplace = purgeAndReplace;
75
    }
76
 
77
    public SubmitFeedRequest(final String marketplace, final String merchant, final InputStream feedContent, final String contentMD5, final String feedType, final Boolean purgeAndReplace) {
78
        this();
79
 
80
        this.marketplace = marketplace;
81
        this.merchant = merchant;
82
        this.feedContent = feedContent;
83
        this.contentMD5 = contentMD5;
84
        this.feedType = feedType;
85
        this.purgeAndReplace = purgeAndReplace;
86
    }
87
 
88
    public void setMarketplaceIdList(IdList marketplaceIdList) {
89
        this.marketplaceIdList = marketplaceIdList;
90
    }
91
 
92
    public IdList getMarketplaceIdList() {
93
        return marketplaceIdList;
94
    }
95
 
96
    public SubmitFeedRequest withMarketplaceIdList(IdList marketplaceIdList) {
97
        setMarketplaceIdList(marketplaceIdList);
98
        return this;
99
    }
100
 
101
    public boolean isSetMarketplaceIdList() {
102
        return marketplaceIdList != null;
103
    }
104
 
105
    /**
106
     * Value constructor
107
     * 
108
     */
109
    public SubmitFeedRequest(final String marketplace, final IdList marketplaceIdList, final String merchant, final InputStream feedContent, final String contentMD5, final String feedType, final Boolean purgeAndReplace, final ContentType contentType) {
110
    	this(marketplace, marketplaceIdList, merchant, feedContent, contentMD5, feedType, purgeAndReplace);
111
    	setContentType(contentType);
112
    }
113
 
114
    /**
115
     * Gets the value of the content type.
116
     * 
117
     * @return
118
     *     possible object is
119
     *     {@link ContentType }
120
     *     
121
     */
122
    public ContentType getContentType() {
123
    	return this.contentType;
124
    }
125
 
126
 
127
    /**
128
     * Sets the value of the ContentType property
129
     * 
130
     * @param value
131
     * @return
132
     *     this instance
133
     */
134
    public SubmitFeedRequest withContentType(ContentType value) {
135
        this.setContentType(value);
136
        return this;
137
    }
138
 
139
    /**
140
     * Sets the value of the ContentType property.
141
     * 
142
     * @param value
143
     *     allowed object is
144
     *     {@link ContentType }
145
     *     
146
     */
147
    public void setContentType(ContentType value) {
148
        this.contentType = value;
149
    }
150
 
151
    public boolean isSetContentType() {
152
        return (this.contentType!= null);
153
    }
154
 
155
 
156
    /**
157
     * Gets the value of the marketplace property.
158
     * @deprecated  See {@link #setMarketplace(String)}
159
     * 
160
     * @deprecated  See {@link #setMarketplace(String)}
161
     * @return
162
     *     possible object is
163
     *     {@link String }
164
     *     
165
     */
166
    public String getMarketplace() {
167
        return marketplace;
168
    }
169
 
170
    /**
171
     * Sets the value of the marketplace property.
172
     * @deprecated Not used anymore.  MWS ignores this parameter, but it is left
173
     * in here for backwards compatibility.
174
     * Use {@link #setMarketplaceIdList(IdList)} instead.
175
     * @param value
176
     *     allowed object is
177
     *     {@link String }
178
     *     
179
     */
180
    public void setMarketplace(String value) {
181
        this.marketplace = value;
182
    }
183
 
184
    /**
185
     * @deprecated  See {@link #setMarketplace(String)}
186
     */
187
    public boolean isSetMarketplace() {
188
        return (this.marketplace!= null);
189
    }
190
 
191
    /**
192
     * Gets the value of the merchant property.
193
     * 
194
     * @return
195
     *     possible object is
196
     *     {@link String }
197
     *     
198
     */
199
    public String getMerchant() {
200
        return merchant;
201
    }
202
 
203
    /**
204
     * Sets the value of the merchant property.
205
     * 
206
     * @param value
207
     *     allowed object is
208
     *     {@link String }
209
     *     
210
     */
211
    public void setMerchant(String value) {
212
        this.merchant = value;
213
    }
214
 
215
    public boolean isSetMerchant() {
216
        return (this.merchant!= null);
217
    }
218
 
219
    /**
220
     * Gets the value of the feedContent property.
221
     * 
222
     * @return
223
     *     possible object is
224
     *     {@link String }
225
     *     
226
     */
227
    public InputStream getFeedContent() {
228
        return feedContent;
229
    }
230
 
231
    /**
232
     * Sets the value of the feedContent property.
233
     * 
234
     * @param value
235
     *     allowed object is
236
     *     {@link String }
237
     *     
238
     */
239
    public void setFeedContent(InputStream value) {
240
        this.feedContent = value;
241
    }
242
 
243
    public boolean isSetFeedContent() {
244
        return (this.feedContent!= null);
245
    }
246
 
247
 
248
    public String getContentMD5() {
249
        return contentMD5;
250
    }
251
 
252
    public void setContentMD5(String value) {
253
        this.contentMD5 = value;
254
    }
255
 
256
    public boolean isSetContentMD5() {
257
        return (this.contentMD5!= null);
258
    }
259
 
260
 
261
    /**
262
     * Gets the value of the feedType property.
263
     * 
264
     * @return
265
     *     possible object is
266
     *     {@link String }
267
     *     
268
     */
269
    public String getFeedType() {
270
        return feedType;
271
    }
272
 
273
    /**
274
     * Sets the value of the feedType property.
275
     * 
276
     * @param value
277
     *     allowed object is
278
     *     {@link String }
279
     *     
280
     */
281
    public void setFeedType(String value) {
282
        this.feedType = value;
283
    }
284
 
285
    public boolean isSetFeedType() {
286
        return (this.feedType!= null);
287
    }
288
 
289
    /**
290
     * Gets the value of the purgeAndReplace property.
291
     * 
292
     * @return
293
     *     possible object is
294
     *     {@link Boolean }
295
     *     
296
     */
297
    public Boolean isPurgeAndReplace() {
298
        return purgeAndReplace;
299
    }
300
 
301
    /**
302
     * Sets the value of the purgeAndReplace property.
303
     * 
304
     * @param value
305
     *     allowed object is
306
     *     {@link Boolean }
307
     *     
308
     */
309
    public void setPurgeAndReplace(Boolean value) {
310
        this.purgeAndReplace = value;
311
    }
312
 
313
    public boolean isSetPurgeAndReplace() {
314
        return (this.purgeAndReplace!= null);
315
    }
316
 
317
    /**
318
     * Sets the value of the Marketplace property.
319
     * 
320
     * @deprecated  See {@link #setMarketplace(String)}
321
     * @param value
322
     * @return
323
     *     this instance
324
     */
325
    public SubmitFeedRequest withMarketplace(String value) {
326
        setMarketplace(value);
327
        return this;
328
    }
329
 
330
    /**
331
     * Sets the value of the Merchant property.
332
     * 
333
     * @param value
334
     * @return
335
     *     this instance
336
     */
337
    public SubmitFeedRequest withMerchant(String value) {
338
        setMerchant(value);
339
        return this;
340
    }
341
 
342
    /**
343
     * Sets the value of the FeedContent property.
344
     * 
345
     * @param value
346
     * @return
347
     *     this instance
348
     */
349
    public SubmitFeedRequest withFeedContent(InputStream value) {
350
        setFeedContent(value);
351
        return this;
352
    }
353
 
354
    public SubmitFeedRequest withContentMD5(String value) {
355
        setContentMD5(value);
356
        return this;
357
    }
358
 
359
    /**
360
     * Sets the value of the FeedType property.
361
     * 
362
     * @param value
363
     * @return
364
     *     this instance
365
     */
366
    public SubmitFeedRequest withFeedType(String value) {
367
        setFeedType(value);
368
        return this;
369
    }
370
 
371
    /**
372
     * Sets the value of the PurgeAndReplace property.
373
     * 
374
     * @param value
375
     * @return
376
     *     this instance
377
     */
378
    public SubmitFeedRequest withPurgeAndReplace(Boolean value) {
379
        setPurgeAndReplace(value);
380
        return this;
381
    }
382
 
383
 
384
 
385
    /**
386
     *
387
     * JSON fragment representation of this object
388
     *
389
     * @return JSON fragment for this object. Name for outer
390
     * object expected to be set by calling method. This fragment
391
     * returns inner properties representation only
392
     *
393
     */
394
    protected String toJSONFragment() {
395
        StringBuffer json = new StringBuffer();
396
        boolean first = true;
397
        if (isSetMarketplace()) {
398
            if (!first) json.append(", ");
399
            json.append(quoteJSON("Marketplace"));
400
            json.append(" : ");
401
            json.append(quoteJSON(getMarketplace()));
402
            first = false;
403
        }
404
        if (isSetMerchant()) {
405
            if (!first) json.append(", ");
406
            json.append(quoteJSON("Merchant"));
407
            json.append(" : ");
408
            json.append(quoteJSON(getMerchant()));
409
            first = false;
410
        }
411
        if (isSetFeedContent()) {
412
            if (!first) json.append(", ");
413
            json.append(quoteJSON("FeedContent"));
414
            json.append(" : ");
415
            json.append(quoteJSON(getFeedContent().toString()));
416
            first = false;
417
        }
418
        if (isSetFeedType()) {
419
            if (!first) json.append(", ");
420
            json.append(quoteJSON("FeedType"));
421
            json.append(" : ");
422
            json.append(quoteJSON(getFeedType()));
423
            first = false;
424
        }
425
        if (isSetPurgeAndReplace()) {
426
            if (!first) json.append(", ");
427
            json.append(quoteJSON("PurgeAndReplace"));
428
            json.append(" : ");
429
            json.append(quoteJSON(isPurgeAndReplace() + ""));
430
            first = false;
431
        }
432
        return json.toString();
433
    }
434
 
435
    /**
436
     *
437
     * Quote JSON string
438
     */
439
    private String quoteJSON(String string) {
440
        StringBuffer sb = new StringBuffer();
441
        sb.append("\"");
442
        int length = string.length();
443
        for (int i = 0; i < length; ++i) {
444
            char c = string.charAt(i);
445
            switch (c) {
446
            case '"':
447
                sb.append("\\\"");
448
                break;
449
            case '\\':
450
                sb.append("\\\\");
451
                break;
452
            case '/':
453
                sb.append("\\/");
454
                break;
455
            case '\b':
456
                sb.append("\\b");
457
                break;
458
            case '\f':
459
                sb.append("\\f");
460
                break;
461
            case '\n':
462
                sb.append("\\n");
463
                break;
464
            case '\r':
465
                sb.append("\\r");
466
                break;
467
            case '\t':
468
                sb.append("\\t");
469
                break;
470
            default:
471
                if (c <  ' ') {
472
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
473
                } else {
474
                sb.append(c);
475
            }
476
        }
477
        }
478
        sb.append("\"");
479
        return sb.toString();
480
    }
481
 
482
 
483
}