Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
100 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.catalog;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class Item implements TBase<Item._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("Item");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
103 ashish 30
  private static final TField CATEGORIES_FIELD_DESC = new TField("categories", TType.LIST, (short)2);
31
  private static final TField ITEM_INVENTORY_FIELD_DESC = new TField("itemInventory", TType.STRUCT, (short)3);
32
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)4);
33
  private static final TField START_DATE_FIELD_DESC = new TField("startDate", TType.I64, (short)5);
34
  private static final TField ITEM_STATUS_FIELD_DESC = new TField("itemStatus", TType.I32, (short)6);
35
  private static final TField OTHER_INFO_FIELD_DESC = new TField("otherInfo", TType.MAP, (short)7);
36
  private static final TField PRICE_FIELD_DESC = new TField("price", TType.DOUBLE, (short)8);
100 ashish 37
 
38
  private long id;
103 ashish 39
  private List<Long> categories;
100 ashish 40
  private ItemInventory itemInventory;
103 ashish 41
  private long addedOn;
42
  private long startDate;
43
  private status itemStatus;
44
  private Map<String,String> otherInfo;
45
  private double price;
100 ashish 46
 
47
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
48
  public enum _Fields implements TFieldIdEnum {
49
    ID((short)1, "id"),
103 ashish 50
    CATEGORIES((short)2, "categories"),
51
    ITEM_INVENTORY((short)3, "itemInventory"),
52
    ADDED_ON((short)4, "addedOn"),
53
    START_DATE((short)5, "startDate"),
54
    /**
55
     * 
56
     * @see status
57
     */
58
    ITEM_STATUS((short)6, "itemStatus"),
59
    OTHER_INFO((short)7, "otherInfo"),
60
    PRICE((short)8, "price");
100 ashish 61
 
62
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
63
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
64
 
65
    static {
66
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
67
        byId.put((int)field._thriftId, field);
68
        byName.put(field.getFieldName(), field);
69
      }
70
    }
71
 
72
    /**
73
     * Find the _Fields constant that matches fieldId, or null if its not found.
74
     */
75
    public static _Fields findByThriftId(int fieldId) {
76
      return byId.get(fieldId);
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches fieldId, throwing an exception
81
     * if it is not found.
82
     */
83
    public static _Fields findByThriftIdOrThrow(int fieldId) {
84
      _Fields fields = findByThriftId(fieldId);
85
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
86
      return fields;
87
    }
88
 
89
    /**
90
     * Find the _Fields constant that matches name, or null if its not found.
91
     */
92
    public static _Fields findByName(String name) {
93
      return byName.get(name);
94
    }
95
 
96
    private final short _thriftId;
97
    private final String _fieldName;
98
 
99
    _Fields(short thriftId, String fieldName) {
100
      _thriftId = thriftId;
101
      _fieldName = fieldName;
102
    }
103
 
104
    public short getThriftFieldId() {
105
      return _thriftId;
106
    }
107
 
108
    public String getFieldName() {
109
      return _fieldName;
110
    }
111
  }
112
 
113
  // isset id assignments
114
  private static final int __ID_ISSET_ID = 0;
103 ashish 115
  private static final int __ADDEDON_ISSET_ID = 1;
116
  private static final int __STARTDATE_ISSET_ID = 2;
117
  private static final int __PRICE_ISSET_ID = 3;
118
  private BitSet __isset_bit_vector = new BitSet(4);
100 ashish 119
 
120
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
121
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
122
        new FieldValueMetaData(TType.I64)));
103 ashish 123
    put(_Fields.CATEGORIES, new FieldMetaData("categories", TFieldRequirementType.DEFAULT, 
124
        new ListMetaData(TType.LIST, 
125
            new FieldValueMetaData(TType.I64))));
100 ashish 126
    put(_Fields.ITEM_INVENTORY, new FieldMetaData("itemInventory", TFieldRequirementType.DEFAULT, 
127
        new StructMetaData(TType.STRUCT, ItemInventory.class)));
103 ashish 128
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
129
        new FieldValueMetaData(TType.I64)));
130
    put(_Fields.START_DATE, new FieldMetaData("startDate", TFieldRequirementType.DEFAULT, 
131
        new FieldValueMetaData(TType.I64)));
132
    put(_Fields.ITEM_STATUS, new FieldMetaData("itemStatus", TFieldRequirementType.DEFAULT, 
133
        new EnumMetaData(TType.ENUM, status.class)));
134
    put(_Fields.OTHER_INFO, new FieldMetaData("otherInfo", TFieldRequirementType.DEFAULT, 
135
        new MapMetaData(TType.MAP, 
136
            new FieldValueMetaData(TType.STRING), 
137
            new FieldValueMetaData(TType.STRING))));
138
    put(_Fields.PRICE, new FieldMetaData("price", TFieldRequirementType.DEFAULT, 
139
        new FieldValueMetaData(TType.DOUBLE)));
100 ashish 140
  }});
141
 
142
  static {
143
    FieldMetaData.addStructMetaDataMap(Item.class, metaDataMap);
144
  }
145
 
146
  public Item() {
147
  }
148
 
149
  public Item(
150
    long id,
103 ashish 151
    List<Long> categories,
152
    ItemInventory itemInventory,
153
    long addedOn,
154
    long startDate,
155
    status itemStatus,
156
    Map<String,String> otherInfo,
157
    double price)
100 ashish 158
  {
159
    this();
160
    this.id = id;
161
    setIdIsSet(true);
103 ashish 162
    this.categories = categories;
100 ashish 163
    this.itemInventory = itemInventory;
103 ashish 164
    this.addedOn = addedOn;
165
    setAddedOnIsSet(true);
166
    this.startDate = startDate;
167
    setStartDateIsSet(true);
168
    this.itemStatus = itemStatus;
169
    this.otherInfo = otherInfo;
170
    this.price = price;
171
    setPriceIsSet(true);
100 ashish 172
  }
173
 
174
  /**
175
   * Performs a deep copy on <i>other</i>.
176
   */
177
  public Item(Item other) {
178
    __isset_bit_vector.clear();
179
    __isset_bit_vector.or(other.__isset_bit_vector);
180
    this.id = other.id;
103 ashish 181
    if (other.isSetCategories()) {
182
      List<Long> __this__categories = new ArrayList<Long>();
183
      for (Long other_element : other.categories) {
184
        __this__categories.add(other_element);
185
      }
186
      this.categories = __this__categories;
100 ashish 187
    }
188
    if (other.isSetItemInventory()) {
189
      this.itemInventory = new ItemInventory(other.itemInventory);
190
    }
103 ashish 191
    this.addedOn = other.addedOn;
192
    this.startDate = other.startDate;
193
    if (other.isSetItemStatus()) {
194
      this.itemStatus = other.itemStatus;
195
    }
196
    if (other.isSetOtherInfo()) {
197
      Map<String,String> __this__otherInfo = new HashMap<String,String>();
198
      for (Map.Entry<String, String> other_element : other.otherInfo.entrySet()) {
199
 
200
        String other_element_key = other_element.getKey();
201
        String other_element_value = other_element.getValue();
202
 
203
        String __this__otherInfo_copy_key = other_element_key;
204
 
205
        String __this__otherInfo_copy_value = other_element_value;
206
 
207
        __this__otherInfo.put(__this__otherInfo_copy_key, __this__otherInfo_copy_value);
208
      }
209
      this.otherInfo = __this__otherInfo;
210
    }
211
    this.price = other.price;
100 ashish 212
  }
213
 
214
  public Item deepCopy() {
215
    return new Item(this);
216
  }
217
 
218
  @Deprecated
219
  public Item clone() {
220
    return new Item(this);
221
  }
222
 
223
  public long getId() {
224
    return this.id;
225
  }
226
 
227
  public Item setId(long id) {
228
    this.id = id;
229
    setIdIsSet(true);
230
    return this;
231
  }
232
 
233
  public void unsetId() {
234
    __isset_bit_vector.clear(__ID_ISSET_ID);
235
  }
236
 
237
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
238
  public boolean isSetId() {
239
    return __isset_bit_vector.get(__ID_ISSET_ID);
240
  }
241
 
242
  public void setIdIsSet(boolean value) {
243
    __isset_bit_vector.set(__ID_ISSET_ID, value);
244
  }
245
 
103 ashish 246
  public int getCategoriesSize() {
247
    return (this.categories == null) ? 0 : this.categories.size();
100 ashish 248
  }
249
 
103 ashish 250
  public java.util.Iterator<Long> getCategoriesIterator() {
251
    return (this.categories == null) ? null : this.categories.iterator();
100 ashish 252
  }
253
 
103 ashish 254
  public void addToCategories(long elem) {
255
    if (this.categories == null) {
256
      this.categories = new ArrayList<Long>();
257
    }
258
    this.categories.add(elem);
100 ashish 259
  }
260
 
103 ashish 261
  public List<Long> getCategories() {
262
    return this.categories;
100 ashish 263
  }
264
 
103 ashish 265
  public Item setCategories(List<Long> categories) {
266
    this.categories = categories;
100 ashish 267
    return this;
268
  }
269
 
103 ashish 270
  public void unsetCategories() {
271
    this.categories = null;
100 ashish 272
  }
273
 
103 ashish 274
  /** Returns true if field categories is set (has been asigned a value) and false otherwise */
275
  public boolean isSetCategories() {
276
    return this.categories != null;
100 ashish 277
  }
278
 
103 ashish 279
  public void setCategoriesIsSet(boolean value) {
100 ashish 280
    if (!value) {
103 ashish 281
      this.categories = null;
100 ashish 282
    }
283
  }
284
 
285
  public ItemInventory getItemInventory() {
286
    return this.itemInventory;
287
  }
288
 
289
  public Item setItemInventory(ItemInventory itemInventory) {
290
    this.itemInventory = itemInventory;
291
    return this;
292
  }
293
 
294
  public void unsetItemInventory() {
295
    this.itemInventory = null;
296
  }
297
 
298
  /** Returns true if field itemInventory is set (has been asigned a value) and false otherwise */
299
  public boolean isSetItemInventory() {
300
    return this.itemInventory != null;
301
  }
302
 
303
  public void setItemInventoryIsSet(boolean value) {
304
    if (!value) {
305
      this.itemInventory = null;
306
    }
307
  }
308
 
103 ashish 309
  public long getAddedOn() {
310
    return this.addedOn;
311
  }
312
 
313
  public Item setAddedOn(long addedOn) {
314
    this.addedOn = addedOn;
315
    setAddedOnIsSet(true);
316
    return this;
317
  }
318
 
319
  public void unsetAddedOn() {
320
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
321
  }
322
 
323
  /** Returns true if field addedOn is set (has been asigned a value) and false otherwise */
324
  public boolean isSetAddedOn() {
325
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
326
  }
327
 
328
  public void setAddedOnIsSet(boolean value) {
329
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
330
  }
331
 
332
  public long getStartDate() {
333
    return this.startDate;
334
  }
335
 
336
  public Item setStartDate(long startDate) {
337
    this.startDate = startDate;
338
    setStartDateIsSet(true);
339
    return this;
340
  }
341
 
342
  public void unsetStartDate() {
343
    __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
344
  }
345
 
346
  /** Returns true if field startDate is set (has been asigned a value) and false otherwise */
347
  public boolean isSetStartDate() {
348
    return __isset_bit_vector.get(__STARTDATE_ISSET_ID);
349
  }
350
 
351
  public void setStartDateIsSet(boolean value) {
352
    __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
353
  }
354
 
355
  /**
356
   * 
357
   * @see status
358
   */
359
  public status getItemStatus() {
360
    return this.itemStatus;
361
  }
362
 
363
  /**
364
   * 
365
   * @see status
366
   */
367
  public Item setItemStatus(status itemStatus) {
368
    this.itemStatus = itemStatus;
369
    return this;
370
  }
371
 
372
  public void unsetItemStatus() {
373
    this.itemStatus = null;
374
  }
375
 
376
  /** Returns true if field itemStatus is set (has been asigned a value) and false otherwise */
377
  public boolean isSetItemStatus() {
378
    return this.itemStatus != null;
379
  }
380
 
381
  public void setItemStatusIsSet(boolean value) {
382
    if (!value) {
383
      this.itemStatus = null;
384
    }
385
  }
386
 
387
  public int getOtherInfoSize() {
388
    return (this.otherInfo == null) ? 0 : this.otherInfo.size();
389
  }
390
 
391
  public void putToOtherInfo(String key, String val) {
392
    if (this.otherInfo == null) {
393
      this.otherInfo = new HashMap<String,String>();
394
    }
395
    this.otherInfo.put(key, val);
396
  }
397
 
398
  public Map<String,String> getOtherInfo() {
399
    return this.otherInfo;
400
  }
401
 
402
  public Item setOtherInfo(Map<String,String> otherInfo) {
403
    this.otherInfo = otherInfo;
404
    return this;
405
  }
406
 
407
  public void unsetOtherInfo() {
408
    this.otherInfo = null;
409
  }
410
 
411
  /** Returns true if field otherInfo is set (has been asigned a value) and false otherwise */
412
  public boolean isSetOtherInfo() {
413
    return this.otherInfo != null;
414
  }
415
 
416
  public void setOtherInfoIsSet(boolean value) {
417
    if (!value) {
418
      this.otherInfo = null;
419
    }
420
  }
421
 
422
  public double getPrice() {
423
    return this.price;
424
  }
425
 
426
  public Item setPrice(double price) {
427
    this.price = price;
428
    setPriceIsSet(true);
429
    return this;
430
  }
431
 
432
  public void unsetPrice() {
433
    __isset_bit_vector.clear(__PRICE_ISSET_ID);
434
  }
435
 
436
  /** Returns true if field price is set (has been asigned a value) and false otherwise */
437
  public boolean isSetPrice() {
438
    return __isset_bit_vector.get(__PRICE_ISSET_ID);
439
  }
440
 
441
  public void setPriceIsSet(boolean value) {
442
    __isset_bit_vector.set(__PRICE_ISSET_ID, value);
443
  }
444
 
100 ashish 445
  public void setFieldValue(_Fields field, Object value) {
446
    switch (field) {
447
    case ID:
448
      if (value == null) {
449
        unsetId();
450
      } else {
451
        setId((Long)value);
452
      }
453
      break;
454
 
103 ashish 455
    case CATEGORIES:
100 ashish 456
      if (value == null) {
103 ashish 457
        unsetCategories();
100 ashish 458
      } else {
103 ashish 459
        setCategories((List<Long>)value);
100 ashish 460
      }
461
      break;
462
 
103 ashish 463
    case ITEM_INVENTORY:
100 ashish 464
      if (value == null) {
103 ashish 465
        unsetItemInventory();
100 ashish 466
      } else {
103 ashish 467
        setItemInventory((ItemInventory)value);
100 ashish 468
      }
469
      break;
470
 
103 ashish 471
    case ADDED_ON:
100 ashish 472
      if (value == null) {
103 ashish 473
        unsetAddedOn();
100 ashish 474
      } else {
103 ashish 475
        setAddedOn((Long)value);
100 ashish 476
      }
477
      break;
478
 
103 ashish 479
    case START_DATE:
480
      if (value == null) {
481
        unsetStartDate();
482
      } else {
483
        setStartDate((Long)value);
484
      }
485
      break;
486
 
487
    case ITEM_STATUS:
488
      if (value == null) {
489
        unsetItemStatus();
490
      } else {
491
        setItemStatus((status)value);
492
      }
493
      break;
494
 
495
    case OTHER_INFO:
496
      if (value == null) {
497
        unsetOtherInfo();
498
      } else {
499
        setOtherInfo((Map<String,String>)value);
500
      }
501
      break;
502
 
503
    case PRICE:
504
      if (value == null) {
505
        unsetPrice();
506
      } else {
507
        setPrice((Double)value);
508
      }
509
      break;
510
 
100 ashish 511
    }
512
  }
513
 
514
  public void setFieldValue(int fieldID, Object value) {
515
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
516
  }
517
 
518
  public Object getFieldValue(_Fields field) {
519
    switch (field) {
520
    case ID:
521
      return new Long(getId());
522
 
103 ashish 523
    case CATEGORIES:
524
      return getCategories();
100 ashish 525
 
526
    case ITEM_INVENTORY:
527
      return getItemInventory();
528
 
103 ashish 529
    case ADDED_ON:
530
      return new Long(getAddedOn());
531
 
532
    case START_DATE:
533
      return new Long(getStartDate());
534
 
535
    case ITEM_STATUS:
536
      return getItemStatus();
537
 
538
    case OTHER_INFO:
539
      return getOtherInfo();
540
 
541
    case PRICE:
542
      return new Double(getPrice());
543
 
100 ashish 544
    }
545
    throw new IllegalStateException();
546
  }
547
 
548
  public Object getFieldValue(int fieldId) {
549
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
550
  }
551
 
552
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
553
  public boolean isSet(_Fields field) {
554
    switch (field) {
555
    case ID:
556
      return isSetId();
103 ashish 557
    case CATEGORIES:
558
      return isSetCategories();
100 ashish 559
    case ITEM_INVENTORY:
560
      return isSetItemInventory();
103 ashish 561
    case ADDED_ON:
562
      return isSetAddedOn();
563
    case START_DATE:
564
      return isSetStartDate();
565
    case ITEM_STATUS:
566
      return isSetItemStatus();
567
    case OTHER_INFO:
568
      return isSetOtherInfo();
569
    case PRICE:
570
      return isSetPrice();
100 ashish 571
    }
572
    throw new IllegalStateException();
573
  }
574
 
575
  public boolean isSet(int fieldID) {
576
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
577
  }
578
 
579
  @Override
580
  public boolean equals(Object that) {
581
    if (that == null)
582
      return false;
583
    if (that instanceof Item)
584
      return this.equals((Item)that);
585
    return false;
586
  }
587
 
588
  public boolean equals(Item that) {
589
    if (that == null)
590
      return false;
591
 
592
    boolean this_present_id = true;
593
    boolean that_present_id = true;
594
    if (this_present_id || that_present_id) {
595
      if (!(this_present_id && that_present_id))
596
        return false;
597
      if (this.id != that.id)
598
        return false;
599
    }
600
 
103 ashish 601
    boolean this_present_categories = true && this.isSetCategories();
602
    boolean that_present_categories = true && that.isSetCategories();
603
    if (this_present_categories || that_present_categories) {
604
      if (!(this_present_categories && that_present_categories))
100 ashish 605
        return false;
103 ashish 606
      if (!this.categories.equals(that.categories))
100 ashish 607
        return false;
608
    }
609
 
610
    boolean this_present_itemInventory = true && this.isSetItemInventory();
611
    boolean that_present_itemInventory = true && that.isSetItemInventory();
612
    if (this_present_itemInventory || that_present_itemInventory) {
613
      if (!(this_present_itemInventory && that_present_itemInventory))
614
        return false;
615
      if (!this.itemInventory.equals(that.itemInventory))
616
        return false;
617
    }
618
 
103 ashish 619
    boolean this_present_addedOn = true;
620
    boolean that_present_addedOn = true;
621
    if (this_present_addedOn || that_present_addedOn) {
622
      if (!(this_present_addedOn && that_present_addedOn))
623
        return false;
624
      if (this.addedOn != that.addedOn)
625
        return false;
626
    }
627
 
628
    boolean this_present_startDate = true;
629
    boolean that_present_startDate = true;
630
    if (this_present_startDate || that_present_startDate) {
631
      if (!(this_present_startDate && that_present_startDate))
632
        return false;
633
      if (this.startDate != that.startDate)
634
        return false;
635
    }
636
 
637
    boolean this_present_itemStatus = true && this.isSetItemStatus();
638
    boolean that_present_itemStatus = true && that.isSetItemStatus();
639
    if (this_present_itemStatus || that_present_itemStatus) {
640
      if (!(this_present_itemStatus && that_present_itemStatus))
641
        return false;
642
      if (!this.itemStatus.equals(that.itemStatus))
643
        return false;
644
    }
645
 
646
    boolean this_present_otherInfo = true && this.isSetOtherInfo();
647
    boolean that_present_otherInfo = true && that.isSetOtherInfo();
648
    if (this_present_otherInfo || that_present_otherInfo) {
649
      if (!(this_present_otherInfo && that_present_otherInfo))
650
        return false;
651
      if (!this.otherInfo.equals(that.otherInfo))
652
        return false;
653
    }
654
 
655
    boolean this_present_price = true;
656
    boolean that_present_price = true;
657
    if (this_present_price || that_present_price) {
658
      if (!(this_present_price && that_present_price))
659
        return false;
660
      if (this.price != that.price)
661
        return false;
662
    }
663
 
100 ashish 664
    return true;
665
  }
666
 
667
  @Override
668
  public int hashCode() {
669
    return 0;
670
  }
671
 
672
  public void read(TProtocol iprot) throws TException {
673
    TField field;
674
    iprot.readStructBegin();
675
    while (true)
676
    {
677
      field = iprot.readFieldBegin();
678
      if (field.type == TType.STOP) { 
679
        break;
680
      }
681
      _Fields fieldId = _Fields.findByThriftId(field.id);
682
      if (fieldId == null) {
683
        TProtocolUtil.skip(iprot, field.type);
684
      } else {
685
        switch (fieldId) {
686
          case ID:
687
            if (field.type == TType.I64) {
688
              this.id = iprot.readI64();
689
              setIdIsSet(true);
690
            } else { 
691
              TProtocolUtil.skip(iprot, field.type);
692
            }
693
            break;
103 ashish 694
          case CATEGORIES:
695
            if (field.type == TType.LIST) {
696
              {
697
                TList _list9 = iprot.readListBegin();
698
                this.categories = new ArrayList<Long>(_list9.size);
699
                for (int _i10 = 0; _i10 < _list9.size; ++_i10)
700
                {
701
                  long _elem11;
702
                  _elem11 = iprot.readI64();
703
                  this.categories.add(_elem11);
704
                }
705
                iprot.readListEnd();
706
              }
100 ashish 707
            } else { 
708
              TProtocolUtil.skip(iprot, field.type);
709
            }
710
            break;
103 ashish 711
          case ITEM_INVENTORY:
100 ashish 712
            if (field.type == TType.STRUCT) {
103 ashish 713
              this.itemInventory = new ItemInventory();
714
              this.itemInventory.read(iprot);
100 ashish 715
            } else { 
716
              TProtocolUtil.skip(iprot, field.type);
717
            }
718
            break;
103 ashish 719
          case ADDED_ON:
720
            if (field.type == TType.I64) {
721
              this.addedOn = iprot.readI64();
722
              setAddedOnIsSet(true);
100 ashish 723
            } else { 
724
              TProtocolUtil.skip(iprot, field.type);
725
            }
726
            break;
103 ashish 727
          case START_DATE:
728
            if (field.type == TType.I64) {
729
              this.startDate = iprot.readI64();
730
              setStartDateIsSet(true);
731
            } else { 
732
              TProtocolUtil.skip(iprot, field.type);
733
            }
734
            break;
735
          case ITEM_STATUS:
736
            if (field.type == TType.I32) {
737
              this.itemStatus = status.findByValue(iprot.readI32());
738
            } else { 
739
              TProtocolUtil.skip(iprot, field.type);
740
            }
741
            break;
742
          case OTHER_INFO:
743
            if (field.type == TType.MAP) {
744
              {
745
                TMap _map12 = iprot.readMapBegin();
746
                this.otherInfo = new HashMap<String,String>(2*_map12.size);
747
                for (int _i13 = 0; _i13 < _map12.size; ++_i13)
748
                {
749
                  String _key14;
750
                  String _val15;
751
                  _key14 = iprot.readString();
752
                  _val15 = iprot.readString();
753
                  this.otherInfo.put(_key14, _val15);
754
                }
755
                iprot.readMapEnd();
756
              }
757
            } else { 
758
              TProtocolUtil.skip(iprot, field.type);
759
            }
760
            break;
761
          case PRICE:
762
            if (field.type == TType.DOUBLE) {
763
              this.price = iprot.readDouble();
764
              setPriceIsSet(true);
765
            } else { 
766
              TProtocolUtil.skip(iprot, field.type);
767
            }
768
            break;
100 ashish 769
        }
770
        iprot.readFieldEnd();
771
      }
772
    }
773
    iprot.readStructEnd();
774
    validate();
775
  }
776
 
777
  public void write(TProtocol oprot) throws TException {
778
    validate();
779
 
780
    oprot.writeStructBegin(STRUCT_DESC);
781
    oprot.writeFieldBegin(ID_FIELD_DESC);
782
    oprot.writeI64(this.id);
783
    oprot.writeFieldEnd();
103 ashish 784
    if (this.categories != null) {
785
      oprot.writeFieldBegin(CATEGORIES_FIELD_DESC);
786
      {
787
        oprot.writeListBegin(new TList(TType.I64, this.categories.size()));
788
        for (long _iter16 : this.categories)
789
        {
790
          oprot.writeI64(_iter16);
791
        }
792
        oprot.writeListEnd();
793
      }
100 ashish 794
      oprot.writeFieldEnd();
795
    }
796
    if (this.itemInventory != null) {
797
      oprot.writeFieldBegin(ITEM_INVENTORY_FIELD_DESC);
798
      this.itemInventory.write(oprot);
799
      oprot.writeFieldEnd();
800
    }
103 ashish 801
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
802
    oprot.writeI64(this.addedOn);
803
    oprot.writeFieldEnd();
804
    oprot.writeFieldBegin(START_DATE_FIELD_DESC);
805
    oprot.writeI64(this.startDate);
806
    oprot.writeFieldEnd();
807
    if (this.itemStatus != null) {
808
      oprot.writeFieldBegin(ITEM_STATUS_FIELD_DESC);
809
      oprot.writeI32(this.itemStatus.getValue());
810
      oprot.writeFieldEnd();
811
    }
812
    if (this.otherInfo != null) {
813
      oprot.writeFieldBegin(OTHER_INFO_FIELD_DESC);
814
      {
815
        oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.otherInfo.size()));
816
        for (Map.Entry<String, String> _iter17 : this.otherInfo.entrySet())
817
        {
818
          oprot.writeString(_iter17.getKey());
819
          oprot.writeString(_iter17.getValue());
820
        }
821
        oprot.writeMapEnd();
822
      }
823
      oprot.writeFieldEnd();
824
    }
825
    oprot.writeFieldBegin(PRICE_FIELD_DESC);
826
    oprot.writeDouble(this.price);
827
    oprot.writeFieldEnd();
100 ashish 828
    oprot.writeFieldStop();
829
    oprot.writeStructEnd();
830
  }
831
 
832
  @Override
833
  public String toString() {
834
    StringBuilder sb = new StringBuilder("Item(");
835
    boolean first = true;
836
 
837
    sb.append("id:");
838
    sb.append(this.id);
839
    first = false;
840
    if (!first) sb.append(", ");
103 ashish 841
    sb.append("categories:");
842
    if (this.categories == null) {
100 ashish 843
      sb.append("null");
844
    } else {
103 ashish 845
      sb.append(this.categories);
100 ashish 846
    }
847
    first = false;
848
    if (!first) sb.append(", ");
849
    sb.append("itemInventory:");
850
    if (this.itemInventory == null) {
851
      sb.append("null");
852
    } else {
853
      sb.append(this.itemInventory);
854
    }
855
    first = false;
103 ashish 856
    if (!first) sb.append(", ");
857
    sb.append("addedOn:");
858
    sb.append(this.addedOn);
859
    first = false;
860
    if (!first) sb.append(", ");
861
    sb.append("startDate:");
862
    sb.append(this.startDate);
863
    first = false;
864
    if (!first) sb.append(", ");
865
    sb.append("itemStatus:");
866
    if (this.itemStatus == null) {
867
      sb.append("null");
868
    } else {
869
      String itemStatus_name = itemStatus.name();
870
      if (itemStatus_name != null) {
871
        sb.append(itemStatus_name);
872
        sb.append(" (");
873
      }
874
      sb.append(this.itemStatus);
875
      if (itemStatus_name != null) {
876
        sb.append(")");
877
      }
878
    }
879
    first = false;
880
    if (!first) sb.append(", ");
881
    sb.append("otherInfo:");
882
    if (this.otherInfo == null) {
883
      sb.append("null");
884
    } else {
885
      sb.append(this.otherInfo);
886
    }
887
    first = false;
888
    if (!first) sb.append(", ");
889
    sb.append("price:");
890
    sb.append(this.price);
891
    first = false;
100 ashish 892
    sb.append(")");
893
    return sb.toString();
894
  }
895
 
896
  public void validate() throws TException {
897
    // check for required fields
898
  }
899
 
900
}
901