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);
123 ashish 30
  private static final TField CATALOG_ITEM_ID_FIELD_DESC = new TField("catalogItemId", TType.I64, (short)2);
103 ashish 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);
123 ashish 36
  private static final TField PRICE_FIELD_DESC = new TField("price", TType.MAP, (short)8);
37
  private static final TField WEIGHT_FIELD_DESC = new TField("weight", TType.DOUBLE, (short)9);
38
  private static final TField FEATURE_ID_FIELD_DESC = new TField("featureId", TType.I64, (short)10);
39
  private static final TField FEATURE_DESCRIPTION_FIELD_DESC = new TField("featureDescription", TType.STRING, (short)11);
40
  private static final TField VENDOR_ITEM_ID_FIELD_DESC = new TField("vendorItemId", TType.I64, (short)12);
100 ashish 41
 
42
  private long id;
123 ashish 43
  private long catalogItemId;
100 ashish 44
  private ItemInventory itemInventory;
103 ashish 45
  private long addedOn;
46
  private long startDate;
47
  private status itemStatus;
48
  private Map<String,String> otherInfo;
123 ashish 49
  private Map<Long,Double> price;
50
  private double weight;
51
  private long featureId;
52
  private String featureDescription;
53
  private long vendorItemId;
100 ashish 54
 
55
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
56
  public enum _Fields implements TFieldIdEnum {
57
    ID((short)1, "id"),
123 ashish 58
    CATALOG_ITEM_ID((short)2, "catalogItemId"),
103 ashish 59
    ITEM_INVENTORY((short)3, "itemInventory"),
60
    ADDED_ON((short)4, "addedOn"),
61
    START_DATE((short)5, "startDate"),
62
    /**
63
     * 
64
     * @see status
65
     */
66
    ITEM_STATUS((short)6, "itemStatus"),
67
    OTHER_INFO((short)7, "otherInfo"),
123 ashish 68
    PRICE((short)8, "price"),
69
    WEIGHT((short)9, "weight"),
70
    FEATURE_ID((short)10, "featureId"),
71
    FEATURE_DESCRIPTION((short)11, "featureDescription"),
72
    VENDOR_ITEM_ID((short)12, "vendorItemId");
100 ashish 73
 
74
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
75
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
76
 
77
    static {
78
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
79
        byId.put((int)field._thriftId, field);
80
        byName.put(field.getFieldName(), field);
81
      }
82
    }
83
 
84
    /**
85
     * Find the _Fields constant that matches fieldId, or null if its not found.
86
     */
87
    public static _Fields findByThriftId(int fieldId) {
88
      return byId.get(fieldId);
89
    }
90
 
91
    /**
92
     * Find the _Fields constant that matches fieldId, throwing an exception
93
     * if it is not found.
94
     */
95
    public static _Fields findByThriftIdOrThrow(int fieldId) {
96
      _Fields fields = findByThriftId(fieldId);
97
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
98
      return fields;
99
    }
100
 
101
    /**
102
     * Find the _Fields constant that matches name, or null if its not found.
103
     */
104
    public static _Fields findByName(String name) {
105
      return byName.get(name);
106
    }
107
 
108
    private final short _thriftId;
109
    private final String _fieldName;
110
 
111
    _Fields(short thriftId, String fieldName) {
112
      _thriftId = thriftId;
113
      _fieldName = fieldName;
114
    }
115
 
116
    public short getThriftFieldId() {
117
      return _thriftId;
118
    }
119
 
120
    public String getFieldName() {
121
      return _fieldName;
122
    }
123
  }
124
 
125
  // isset id assignments
126
  private static final int __ID_ISSET_ID = 0;
123 ashish 127
  private static final int __CATALOGITEMID_ISSET_ID = 1;
128
  private static final int __ADDEDON_ISSET_ID = 2;
129
  private static final int __STARTDATE_ISSET_ID = 3;
130
  private static final int __WEIGHT_ISSET_ID = 4;
131
  private static final int __FEATUREID_ISSET_ID = 5;
132
  private static final int __VENDORITEMID_ISSET_ID = 6;
133
  private BitSet __isset_bit_vector = new BitSet(7);
100 ashish 134
 
135
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
136
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
137
        new FieldValueMetaData(TType.I64)));
123 ashish 138
    put(_Fields.CATALOG_ITEM_ID, new FieldMetaData("catalogItemId", TFieldRequirementType.DEFAULT, 
139
        new FieldValueMetaData(TType.I64)));
100 ashish 140
    put(_Fields.ITEM_INVENTORY, new FieldMetaData("itemInventory", TFieldRequirementType.DEFAULT, 
141
        new StructMetaData(TType.STRUCT, ItemInventory.class)));
103 ashish 142
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
143
        new FieldValueMetaData(TType.I64)));
144
    put(_Fields.START_DATE, new FieldMetaData("startDate", TFieldRequirementType.DEFAULT, 
145
        new FieldValueMetaData(TType.I64)));
146
    put(_Fields.ITEM_STATUS, new FieldMetaData("itemStatus", TFieldRequirementType.DEFAULT, 
147
        new EnumMetaData(TType.ENUM, status.class)));
148
    put(_Fields.OTHER_INFO, new FieldMetaData("otherInfo", TFieldRequirementType.DEFAULT, 
149
        new MapMetaData(TType.MAP, 
150
            new FieldValueMetaData(TType.STRING), 
151
            new FieldValueMetaData(TType.STRING))));
152
    put(_Fields.PRICE, new FieldMetaData("price", TFieldRequirementType.DEFAULT, 
123 ashish 153
        new MapMetaData(TType.MAP, 
154
            new FieldValueMetaData(TType.I64), 
155
            new FieldValueMetaData(TType.DOUBLE))));
156
    put(_Fields.WEIGHT, new FieldMetaData("weight", TFieldRequirementType.DEFAULT, 
103 ashish 157
        new FieldValueMetaData(TType.DOUBLE)));
123 ashish 158
    put(_Fields.FEATURE_ID, new FieldMetaData("featureId", TFieldRequirementType.DEFAULT, 
159
        new FieldValueMetaData(TType.I64)));
160
    put(_Fields.FEATURE_DESCRIPTION, new FieldMetaData("featureDescription", TFieldRequirementType.DEFAULT, 
161
        new FieldValueMetaData(TType.STRING)));
162
    put(_Fields.VENDOR_ITEM_ID, new FieldMetaData("vendorItemId", TFieldRequirementType.DEFAULT, 
163
        new FieldValueMetaData(TType.I64)));
100 ashish 164
  }});
165
 
166
  static {
167
    FieldMetaData.addStructMetaDataMap(Item.class, metaDataMap);
168
  }
169
 
170
  public Item() {
171
  }
172
 
173
  public Item(
174
    long id,
123 ashish 175
    long catalogItemId,
103 ashish 176
    ItemInventory itemInventory,
177
    long addedOn,
178
    long startDate,
179
    status itemStatus,
180
    Map<String,String> otherInfo,
123 ashish 181
    Map<Long,Double> price,
182
    double weight,
183
    long featureId,
184
    String featureDescription,
185
    long vendorItemId)
100 ashish 186
  {
187
    this();
188
    this.id = id;
189
    setIdIsSet(true);
123 ashish 190
    this.catalogItemId = catalogItemId;
191
    setCatalogItemIdIsSet(true);
100 ashish 192
    this.itemInventory = itemInventory;
103 ashish 193
    this.addedOn = addedOn;
194
    setAddedOnIsSet(true);
195
    this.startDate = startDate;
196
    setStartDateIsSet(true);
197
    this.itemStatus = itemStatus;
198
    this.otherInfo = otherInfo;
199
    this.price = price;
123 ashish 200
    this.weight = weight;
201
    setWeightIsSet(true);
202
    this.featureId = featureId;
203
    setFeatureIdIsSet(true);
204
    this.featureDescription = featureDescription;
205
    this.vendorItemId = vendorItemId;
206
    setVendorItemIdIsSet(true);
100 ashish 207
  }
208
 
209
  /**
210
   * Performs a deep copy on <i>other</i>.
211
   */
212
  public Item(Item other) {
213
    __isset_bit_vector.clear();
214
    __isset_bit_vector.or(other.__isset_bit_vector);
215
    this.id = other.id;
123 ashish 216
    this.catalogItemId = other.catalogItemId;
100 ashish 217
    if (other.isSetItemInventory()) {
218
      this.itemInventory = new ItemInventory(other.itemInventory);
219
    }
103 ashish 220
    this.addedOn = other.addedOn;
221
    this.startDate = other.startDate;
222
    if (other.isSetItemStatus()) {
223
      this.itemStatus = other.itemStatus;
224
    }
225
    if (other.isSetOtherInfo()) {
226
      Map<String,String> __this__otherInfo = new HashMap<String,String>();
227
      for (Map.Entry<String, String> other_element : other.otherInfo.entrySet()) {
228
 
229
        String other_element_key = other_element.getKey();
230
        String other_element_value = other_element.getValue();
231
 
232
        String __this__otherInfo_copy_key = other_element_key;
233
 
234
        String __this__otherInfo_copy_value = other_element_value;
235
 
236
        __this__otherInfo.put(__this__otherInfo_copy_key, __this__otherInfo_copy_value);
237
      }
238
      this.otherInfo = __this__otherInfo;
239
    }
123 ashish 240
    if (other.isSetPrice()) {
241
      Map<Long,Double> __this__price = new HashMap<Long,Double>();
242
      for (Map.Entry<Long, Double> other_element : other.price.entrySet()) {
243
 
244
        Long other_element_key = other_element.getKey();
245
        Double other_element_value = other_element.getValue();
246
 
247
        Long __this__price_copy_key = other_element_key;
248
 
249
        Double __this__price_copy_value = other_element_value;
250
 
251
        __this__price.put(__this__price_copy_key, __this__price_copy_value);
252
      }
253
      this.price = __this__price;
254
    }
255
    this.weight = other.weight;
256
    this.featureId = other.featureId;
257
    if (other.isSetFeatureDescription()) {
258
      this.featureDescription = other.featureDescription;
259
    }
260
    this.vendorItemId = other.vendorItemId;
100 ashish 261
  }
262
 
263
  public Item deepCopy() {
264
    return new Item(this);
265
  }
266
 
267
  @Deprecated
268
  public Item clone() {
269
    return new Item(this);
270
  }
271
 
272
  public long getId() {
273
    return this.id;
274
  }
275
 
276
  public Item setId(long id) {
277
    this.id = id;
278
    setIdIsSet(true);
279
    return this;
280
  }
281
 
282
  public void unsetId() {
283
    __isset_bit_vector.clear(__ID_ISSET_ID);
284
  }
285
 
286
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
287
  public boolean isSetId() {
288
    return __isset_bit_vector.get(__ID_ISSET_ID);
289
  }
290
 
291
  public void setIdIsSet(boolean value) {
292
    __isset_bit_vector.set(__ID_ISSET_ID, value);
293
  }
294
 
123 ashish 295
  public long getCatalogItemId() {
296
    return this.catalogItemId;
100 ashish 297
  }
298
 
123 ashish 299
  public Item setCatalogItemId(long catalogItemId) {
300
    this.catalogItemId = catalogItemId;
301
    setCatalogItemIdIsSet(true);
100 ashish 302
    return this;
303
  }
304
 
123 ashish 305
  public void unsetCatalogItemId() {
306
    __isset_bit_vector.clear(__CATALOGITEMID_ISSET_ID);
100 ashish 307
  }
308
 
123 ashish 309
  /** Returns true if field catalogItemId is set (has been asigned a value) and false otherwise */
310
  public boolean isSetCatalogItemId() {
311
    return __isset_bit_vector.get(__CATALOGITEMID_ISSET_ID);
100 ashish 312
  }
313
 
123 ashish 314
  public void setCatalogItemIdIsSet(boolean value) {
315
    __isset_bit_vector.set(__CATALOGITEMID_ISSET_ID, value);
100 ashish 316
  }
317
 
318
  public ItemInventory getItemInventory() {
319
    return this.itemInventory;
320
  }
321
 
322
  public Item setItemInventory(ItemInventory itemInventory) {
323
    this.itemInventory = itemInventory;
324
    return this;
325
  }
326
 
327
  public void unsetItemInventory() {
328
    this.itemInventory = null;
329
  }
330
 
331
  /** Returns true if field itemInventory is set (has been asigned a value) and false otherwise */
332
  public boolean isSetItemInventory() {
333
    return this.itemInventory != null;
334
  }
335
 
336
  public void setItemInventoryIsSet(boolean value) {
337
    if (!value) {
338
      this.itemInventory = null;
339
    }
340
  }
341
 
103 ashish 342
  public long getAddedOn() {
343
    return this.addedOn;
344
  }
345
 
346
  public Item setAddedOn(long addedOn) {
347
    this.addedOn = addedOn;
348
    setAddedOnIsSet(true);
349
    return this;
350
  }
351
 
352
  public void unsetAddedOn() {
353
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
354
  }
355
 
356
  /** Returns true if field addedOn is set (has been asigned a value) and false otherwise */
357
  public boolean isSetAddedOn() {
358
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
359
  }
360
 
361
  public void setAddedOnIsSet(boolean value) {
362
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
363
  }
364
 
365
  public long getStartDate() {
366
    return this.startDate;
367
  }
368
 
369
  public Item setStartDate(long startDate) {
370
    this.startDate = startDate;
371
    setStartDateIsSet(true);
372
    return this;
373
  }
374
 
375
  public void unsetStartDate() {
376
    __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
377
  }
378
 
379
  /** Returns true if field startDate is set (has been asigned a value) and false otherwise */
380
  public boolean isSetStartDate() {
381
    return __isset_bit_vector.get(__STARTDATE_ISSET_ID);
382
  }
383
 
384
  public void setStartDateIsSet(boolean value) {
385
    __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
386
  }
387
 
388
  /**
389
   * 
390
   * @see status
391
   */
392
  public status getItemStatus() {
393
    return this.itemStatus;
394
  }
395
 
396
  /**
397
   * 
398
   * @see status
399
   */
400
  public Item setItemStatus(status itemStatus) {
401
    this.itemStatus = itemStatus;
402
    return this;
403
  }
404
 
405
  public void unsetItemStatus() {
406
    this.itemStatus = null;
407
  }
408
 
409
  /** Returns true if field itemStatus is set (has been asigned a value) and false otherwise */
410
  public boolean isSetItemStatus() {
411
    return this.itemStatus != null;
412
  }
413
 
414
  public void setItemStatusIsSet(boolean value) {
415
    if (!value) {
416
      this.itemStatus = null;
417
    }
418
  }
419
 
420
  public int getOtherInfoSize() {
421
    return (this.otherInfo == null) ? 0 : this.otherInfo.size();
422
  }
423
 
424
  public void putToOtherInfo(String key, String val) {
425
    if (this.otherInfo == null) {
426
      this.otherInfo = new HashMap<String,String>();
427
    }
428
    this.otherInfo.put(key, val);
429
  }
430
 
431
  public Map<String,String> getOtherInfo() {
432
    return this.otherInfo;
433
  }
434
 
435
  public Item setOtherInfo(Map<String,String> otherInfo) {
436
    this.otherInfo = otherInfo;
437
    return this;
438
  }
439
 
440
  public void unsetOtherInfo() {
441
    this.otherInfo = null;
442
  }
443
 
444
  /** Returns true if field otherInfo is set (has been asigned a value) and false otherwise */
445
  public boolean isSetOtherInfo() {
446
    return this.otherInfo != null;
447
  }
448
 
449
  public void setOtherInfoIsSet(boolean value) {
450
    if (!value) {
451
      this.otherInfo = null;
452
    }
453
  }
454
 
123 ashish 455
  public int getPriceSize() {
456
    return (this.price == null) ? 0 : this.price.size();
457
  }
458
 
459
  public void putToPrice(long key, double val) {
460
    if (this.price == null) {
461
      this.price = new HashMap<Long,Double>();
462
    }
463
    this.price.put(key, val);
464
  }
465
 
466
  public Map<Long,Double> getPrice() {
103 ashish 467
    return this.price;
468
  }
469
 
123 ashish 470
  public Item setPrice(Map<Long,Double> price) {
103 ashish 471
    this.price = price;
472
    return this;
473
  }
474
 
475
  public void unsetPrice() {
123 ashish 476
    this.price = null;
103 ashish 477
  }
478
 
479
  /** Returns true if field price is set (has been asigned a value) and false otherwise */
480
  public boolean isSetPrice() {
123 ashish 481
    return this.price != null;
103 ashish 482
  }
483
 
484
  public void setPriceIsSet(boolean value) {
123 ashish 485
    if (!value) {
486
      this.price = null;
487
    }
103 ashish 488
  }
489
 
123 ashish 490
  public double getWeight() {
491
    return this.weight;
492
  }
493
 
494
  public Item setWeight(double weight) {
495
    this.weight = weight;
496
    setWeightIsSet(true);
497
    return this;
498
  }
499
 
500
  public void unsetWeight() {
501
    __isset_bit_vector.clear(__WEIGHT_ISSET_ID);
502
  }
503
 
504
  /** Returns true if field weight is set (has been asigned a value) and false otherwise */
505
  public boolean isSetWeight() {
506
    return __isset_bit_vector.get(__WEIGHT_ISSET_ID);
507
  }
508
 
509
  public void setWeightIsSet(boolean value) {
510
    __isset_bit_vector.set(__WEIGHT_ISSET_ID, value);
511
  }
512
 
513
  public long getFeatureId() {
514
    return this.featureId;
515
  }
516
 
517
  public Item setFeatureId(long featureId) {
518
    this.featureId = featureId;
519
    setFeatureIdIsSet(true);
520
    return this;
521
  }
522
 
523
  public void unsetFeatureId() {
524
    __isset_bit_vector.clear(__FEATUREID_ISSET_ID);
525
  }
526
 
527
  /** Returns true if field featureId is set (has been asigned a value) and false otherwise */
528
  public boolean isSetFeatureId() {
529
    return __isset_bit_vector.get(__FEATUREID_ISSET_ID);
530
  }
531
 
532
  public void setFeatureIdIsSet(boolean value) {
533
    __isset_bit_vector.set(__FEATUREID_ISSET_ID, value);
534
  }
535
 
536
  public String getFeatureDescription() {
537
    return this.featureDescription;
538
  }
539
 
540
  public Item setFeatureDescription(String featureDescription) {
541
    this.featureDescription = featureDescription;
542
    return this;
543
  }
544
 
545
  public void unsetFeatureDescription() {
546
    this.featureDescription = null;
547
  }
548
 
549
  /** Returns true if field featureDescription is set (has been asigned a value) and false otherwise */
550
  public boolean isSetFeatureDescription() {
551
    return this.featureDescription != null;
552
  }
553
 
554
  public void setFeatureDescriptionIsSet(boolean value) {
555
    if (!value) {
556
      this.featureDescription = null;
557
    }
558
  }
559
 
560
  public long getVendorItemId() {
561
    return this.vendorItemId;
562
  }
563
 
564
  public Item setVendorItemId(long vendorItemId) {
565
    this.vendorItemId = vendorItemId;
566
    setVendorItemIdIsSet(true);
567
    return this;
568
  }
569
 
570
  public void unsetVendorItemId() {
571
    __isset_bit_vector.clear(__VENDORITEMID_ISSET_ID);
572
  }
573
 
574
  /** Returns true if field vendorItemId is set (has been asigned a value) and false otherwise */
575
  public boolean isSetVendorItemId() {
576
    return __isset_bit_vector.get(__VENDORITEMID_ISSET_ID);
577
  }
578
 
579
  public void setVendorItemIdIsSet(boolean value) {
580
    __isset_bit_vector.set(__VENDORITEMID_ISSET_ID, value);
581
  }
582
 
100 ashish 583
  public void setFieldValue(_Fields field, Object value) {
584
    switch (field) {
585
    case ID:
586
      if (value == null) {
587
        unsetId();
588
      } else {
589
        setId((Long)value);
590
      }
591
      break;
592
 
123 ashish 593
    case CATALOG_ITEM_ID:
100 ashish 594
      if (value == null) {
123 ashish 595
        unsetCatalogItemId();
100 ashish 596
      } else {
123 ashish 597
        setCatalogItemId((Long)value);
100 ashish 598
      }
599
      break;
600
 
103 ashish 601
    case ITEM_INVENTORY:
100 ashish 602
      if (value == null) {
103 ashish 603
        unsetItemInventory();
100 ashish 604
      } else {
103 ashish 605
        setItemInventory((ItemInventory)value);
100 ashish 606
      }
607
      break;
608
 
103 ashish 609
    case ADDED_ON:
100 ashish 610
      if (value == null) {
103 ashish 611
        unsetAddedOn();
100 ashish 612
      } else {
103 ashish 613
        setAddedOn((Long)value);
100 ashish 614
      }
615
      break;
616
 
103 ashish 617
    case START_DATE:
618
      if (value == null) {
619
        unsetStartDate();
620
      } else {
621
        setStartDate((Long)value);
622
      }
623
      break;
624
 
625
    case ITEM_STATUS:
626
      if (value == null) {
627
        unsetItemStatus();
628
      } else {
629
        setItemStatus((status)value);
630
      }
631
      break;
632
 
633
    case OTHER_INFO:
634
      if (value == null) {
635
        unsetOtherInfo();
636
      } else {
637
        setOtherInfo((Map<String,String>)value);
638
      }
639
      break;
640
 
641
    case PRICE:
642
      if (value == null) {
643
        unsetPrice();
644
      } else {
123 ashish 645
        setPrice((Map<Long,Double>)value);
103 ashish 646
      }
647
      break;
648
 
123 ashish 649
    case WEIGHT:
650
      if (value == null) {
651
        unsetWeight();
652
      } else {
653
        setWeight((Double)value);
654
      }
655
      break;
656
 
657
    case FEATURE_ID:
658
      if (value == null) {
659
        unsetFeatureId();
660
      } else {
661
        setFeatureId((Long)value);
662
      }
663
      break;
664
 
665
    case FEATURE_DESCRIPTION:
666
      if (value == null) {
667
        unsetFeatureDescription();
668
      } else {
669
        setFeatureDescription((String)value);
670
      }
671
      break;
672
 
673
    case VENDOR_ITEM_ID:
674
      if (value == null) {
675
        unsetVendorItemId();
676
      } else {
677
        setVendorItemId((Long)value);
678
      }
679
      break;
680
 
100 ashish 681
    }
682
  }
683
 
684
  public void setFieldValue(int fieldID, Object value) {
685
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
686
  }
687
 
688
  public Object getFieldValue(_Fields field) {
689
    switch (field) {
690
    case ID:
691
      return new Long(getId());
692
 
123 ashish 693
    case CATALOG_ITEM_ID:
694
      return new Long(getCatalogItemId());
100 ashish 695
 
696
    case ITEM_INVENTORY:
697
      return getItemInventory();
698
 
103 ashish 699
    case ADDED_ON:
700
      return new Long(getAddedOn());
701
 
702
    case START_DATE:
703
      return new Long(getStartDate());
704
 
705
    case ITEM_STATUS:
706
      return getItemStatus();
707
 
708
    case OTHER_INFO:
709
      return getOtherInfo();
710
 
711
    case PRICE:
123 ashish 712
      return getPrice();
103 ashish 713
 
123 ashish 714
    case WEIGHT:
715
      return new Double(getWeight());
716
 
717
    case FEATURE_ID:
718
      return new Long(getFeatureId());
719
 
720
    case FEATURE_DESCRIPTION:
721
      return getFeatureDescription();
722
 
723
    case VENDOR_ITEM_ID:
724
      return new Long(getVendorItemId());
725
 
100 ashish 726
    }
727
    throw new IllegalStateException();
728
  }
729
 
730
  public Object getFieldValue(int fieldId) {
731
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
732
  }
733
 
734
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
735
  public boolean isSet(_Fields field) {
736
    switch (field) {
737
    case ID:
738
      return isSetId();
123 ashish 739
    case CATALOG_ITEM_ID:
740
      return isSetCatalogItemId();
100 ashish 741
    case ITEM_INVENTORY:
742
      return isSetItemInventory();
103 ashish 743
    case ADDED_ON:
744
      return isSetAddedOn();
745
    case START_DATE:
746
      return isSetStartDate();
747
    case ITEM_STATUS:
748
      return isSetItemStatus();
749
    case OTHER_INFO:
750
      return isSetOtherInfo();
751
    case PRICE:
752
      return isSetPrice();
123 ashish 753
    case WEIGHT:
754
      return isSetWeight();
755
    case FEATURE_ID:
756
      return isSetFeatureId();
757
    case FEATURE_DESCRIPTION:
758
      return isSetFeatureDescription();
759
    case VENDOR_ITEM_ID:
760
      return isSetVendorItemId();
100 ashish 761
    }
762
    throw new IllegalStateException();
763
  }
764
 
765
  public boolean isSet(int fieldID) {
766
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
767
  }
768
 
769
  @Override
770
  public boolean equals(Object that) {
771
    if (that == null)
772
      return false;
773
    if (that instanceof Item)
774
      return this.equals((Item)that);
775
    return false;
776
  }
777
 
778
  public boolean equals(Item that) {
779
    if (that == null)
780
      return false;
781
 
782
    boolean this_present_id = true;
783
    boolean that_present_id = true;
784
    if (this_present_id || that_present_id) {
785
      if (!(this_present_id && that_present_id))
786
        return false;
787
      if (this.id != that.id)
788
        return false;
789
    }
790
 
123 ashish 791
    boolean this_present_catalogItemId = true;
792
    boolean that_present_catalogItemId = true;
793
    if (this_present_catalogItemId || that_present_catalogItemId) {
794
      if (!(this_present_catalogItemId && that_present_catalogItemId))
100 ashish 795
        return false;
123 ashish 796
      if (this.catalogItemId != that.catalogItemId)
100 ashish 797
        return false;
798
    }
799
 
800
    boolean this_present_itemInventory = true && this.isSetItemInventory();
801
    boolean that_present_itemInventory = true && that.isSetItemInventory();
802
    if (this_present_itemInventory || that_present_itemInventory) {
803
      if (!(this_present_itemInventory && that_present_itemInventory))
804
        return false;
805
      if (!this.itemInventory.equals(that.itemInventory))
806
        return false;
807
    }
808
 
103 ashish 809
    boolean this_present_addedOn = true;
810
    boolean that_present_addedOn = true;
811
    if (this_present_addedOn || that_present_addedOn) {
812
      if (!(this_present_addedOn && that_present_addedOn))
813
        return false;
814
      if (this.addedOn != that.addedOn)
815
        return false;
816
    }
817
 
818
    boolean this_present_startDate = true;
819
    boolean that_present_startDate = true;
820
    if (this_present_startDate || that_present_startDate) {
821
      if (!(this_present_startDate && that_present_startDate))
822
        return false;
823
      if (this.startDate != that.startDate)
824
        return false;
825
    }
826
 
827
    boolean this_present_itemStatus = true && this.isSetItemStatus();
828
    boolean that_present_itemStatus = true && that.isSetItemStatus();
829
    if (this_present_itemStatus || that_present_itemStatus) {
830
      if (!(this_present_itemStatus && that_present_itemStatus))
831
        return false;
832
      if (!this.itemStatus.equals(that.itemStatus))
833
        return false;
834
    }
835
 
836
    boolean this_present_otherInfo = true && this.isSetOtherInfo();
837
    boolean that_present_otherInfo = true && that.isSetOtherInfo();
838
    if (this_present_otherInfo || that_present_otherInfo) {
839
      if (!(this_present_otherInfo && that_present_otherInfo))
840
        return false;
841
      if (!this.otherInfo.equals(that.otherInfo))
842
        return false;
843
    }
844
 
123 ashish 845
    boolean this_present_price = true && this.isSetPrice();
846
    boolean that_present_price = true && that.isSetPrice();
103 ashish 847
    if (this_present_price || that_present_price) {
848
      if (!(this_present_price && that_present_price))
849
        return false;
123 ashish 850
      if (!this.price.equals(that.price))
103 ashish 851
        return false;
852
    }
853
 
123 ashish 854
    boolean this_present_weight = true;
855
    boolean that_present_weight = true;
856
    if (this_present_weight || that_present_weight) {
857
      if (!(this_present_weight && that_present_weight))
858
        return false;
859
      if (this.weight != that.weight)
860
        return false;
861
    }
862
 
863
    boolean this_present_featureId = true;
864
    boolean that_present_featureId = true;
865
    if (this_present_featureId || that_present_featureId) {
866
      if (!(this_present_featureId && that_present_featureId))
867
        return false;
868
      if (this.featureId != that.featureId)
869
        return false;
870
    }
871
 
872
    boolean this_present_featureDescription = true && this.isSetFeatureDescription();
873
    boolean that_present_featureDescription = true && that.isSetFeatureDescription();
874
    if (this_present_featureDescription || that_present_featureDescription) {
875
      if (!(this_present_featureDescription && that_present_featureDescription))
876
        return false;
877
      if (!this.featureDescription.equals(that.featureDescription))
878
        return false;
879
    }
880
 
881
    boolean this_present_vendorItemId = true;
882
    boolean that_present_vendorItemId = true;
883
    if (this_present_vendorItemId || that_present_vendorItemId) {
884
      if (!(this_present_vendorItemId && that_present_vendorItemId))
885
        return false;
886
      if (this.vendorItemId != that.vendorItemId)
887
        return false;
888
    }
889
 
100 ashish 890
    return true;
891
  }
892
 
893
  @Override
894
  public int hashCode() {
895
    return 0;
896
  }
897
 
898
  public void read(TProtocol iprot) throws TException {
899
    TField field;
900
    iprot.readStructBegin();
901
    while (true)
902
    {
903
      field = iprot.readFieldBegin();
904
      if (field.type == TType.STOP) { 
905
        break;
906
      }
907
      _Fields fieldId = _Fields.findByThriftId(field.id);
908
      if (fieldId == null) {
909
        TProtocolUtil.skip(iprot, field.type);
910
      } else {
911
        switch (fieldId) {
912
          case ID:
913
            if (field.type == TType.I64) {
914
              this.id = iprot.readI64();
915
              setIdIsSet(true);
916
            } else { 
917
              TProtocolUtil.skip(iprot, field.type);
918
            }
919
            break;
123 ashish 920
          case CATALOG_ITEM_ID:
921
            if (field.type == TType.I64) {
922
              this.catalogItemId = iprot.readI64();
923
              setCatalogItemIdIsSet(true);
100 ashish 924
            } else { 
925
              TProtocolUtil.skip(iprot, field.type);
926
            }
927
            break;
103 ashish 928
          case ITEM_INVENTORY:
100 ashish 929
            if (field.type == TType.STRUCT) {
103 ashish 930
              this.itemInventory = new ItemInventory();
931
              this.itemInventory.read(iprot);
100 ashish 932
            } else { 
933
              TProtocolUtil.skip(iprot, field.type);
934
            }
935
            break;
103 ashish 936
          case ADDED_ON:
937
            if (field.type == TType.I64) {
938
              this.addedOn = iprot.readI64();
939
              setAddedOnIsSet(true);
100 ashish 940
            } else { 
941
              TProtocolUtil.skip(iprot, field.type);
942
            }
943
            break;
103 ashish 944
          case START_DATE:
945
            if (field.type == TType.I64) {
946
              this.startDate = iprot.readI64();
947
              setStartDateIsSet(true);
948
            } else { 
949
              TProtocolUtil.skip(iprot, field.type);
950
            }
951
            break;
952
          case ITEM_STATUS:
953
            if (field.type == TType.I32) {
954
              this.itemStatus = status.findByValue(iprot.readI32());
955
            } else { 
956
              TProtocolUtil.skip(iprot, field.type);
957
            }
958
            break;
959
          case OTHER_INFO:
960
            if (field.type == TType.MAP) {
961
              {
123 ashish 962
                TMap _map5 = iprot.readMapBegin();
963
                this.otherInfo = new HashMap<String,String>(2*_map5.size);
964
                for (int _i6 = 0; _i6 < _map5.size; ++_i6)
103 ashish 965
                {
123 ashish 966
                  String _key7;
967
                  String _val8;
968
                  _key7 = iprot.readString();
969
                  _val8 = iprot.readString();
970
                  this.otherInfo.put(_key7, _val8);
103 ashish 971
                }
972
                iprot.readMapEnd();
973
              }
974
            } else { 
975
              TProtocolUtil.skip(iprot, field.type);
976
            }
977
            break;
978
          case PRICE:
123 ashish 979
            if (field.type == TType.MAP) {
980
              {
981
                TMap _map9 = iprot.readMapBegin();
982
                this.price = new HashMap<Long,Double>(2*_map9.size);
983
                for (int _i10 = 0; _i10 < _map9.size; ++_i10)
984
                {
985
                  long _key11;
986
                  double _val12;
987
                  _key11 = iprot.readI64();
988
                  _val12 = iprot.readDouble();
989
                  this.price.put(_key11, _val12);
990
                }
991
                iprot.readMapEnd();
992
              }
993
            } else { 
994
              TProtocolUtil.skip(iprot, field.type);
995
            }
996
            break;
997
          case WEIGHT:
103 ashish 998
            if (field.type == TType.DOUBLE) {
123 ashish 999
              this.weight = iprot.readDouble();
1000
              setWeightIsSet(true);
103 ashish 1001
            } else { 
1002
              TProtocolUtil.skip(iprot, field.type);
1003
            }
1004
            break;
123 ashish 1005
          case FEATURE_ID:
1006
            if (field.type == TType.I64) {
1007
              this.featureId = iprot.readI64();
1008
              setFeatureIdIsSet(true);
1009
            } else { 
1010
              TProtocolUtil.skip(iprot, field.type);
1011
            }
1012
            break;
1013
          case FEATURE_DESCRIPTION:
1014
            if (field.type == TType.STRING) {
1015
              this.featureDescription = iprot.readString();
1016
            } else { 
1017
              TProtocolUtil.skip(iprot, field.type);
1018
            }
1019
            break;
1020
          case VENDOR_ITEM_ID:
1021
            if (field.type == TType.I64) {
1022
              this.vendorItemId = iprot.readI64();
1023
              setVendorItemIdIsSet(true);
1024
            } else { 
1025
              TProtocolUtil.skip(iprot, field.type);
1026
            }
1027
            break;
100 ashish 1028
        }
1029
        iprot.readFieldEnd();
1030
      }
1031
    }
1032
    iprot.readStructEnd();
1033
    validate();
1034
  }
1035
 
1036
  public void write(TProtocol oprot) throws TException {
1037
    validate();
1038
 
1039
    oprot.writeStructBegin(STRUCT_DESC);
1040
    oprot.writeFieldBegin(ID_FIELD_DESC);
1041
    oprot.writeI64(this.id);
1042
    oprot.writeFieldEnd();
123 ashish 1043
    oprot.writeFieldBegin(CATALOG_ITEM_ID_FIELD_DESC);
1044
    oprot.writeI64(this.catalogItemId);
1045
    oprot.writeFieldEnd();
100 ashish 1046
    if (this.itemInventory != null) {
1047
      oprot.writeFieldBegin(ITEM_INVENTORY_FIELD_DESC);
1048
      this.itemInventory.write(oprot);
1049
      oprot.writeFieldEnd();
1050
    }
103 ashish 1051
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
1052
    oprot.writeI64(this.addedOn);
1053
    oprot.writeFieldEnd();
1054
    oprot.writeFieldBegin(START_DATE_FIELD_DESC);
1055
    oprot.writeI64(this.startDate);
1056
    oprot.writeFieldEnd();
1057
    if (this.itemStatus != null) {
1058
      oprot.writeFieldBegin(ITEM_STATUS_FIELD_DESC);
1059
      oprot.writeI32(this.itemStatus.getValue());
1060
      oprot.writeFieldEnd();
1061
    }
1062
    if (this.otherInfo != null) {
1063
      oprot.writeFieldBegin(OTHER_INFO_FIELD_DESC);
1064
      {
1065
        oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.otherInfo.size()));
123 ashish 1066
        for (Map.Entry<String, String> _iter13 : this.otherInfo.entrySet())
103 ashish 1067
        {
123 ashish 1068
          oprot.writeString(_iter13.getKey());
1069
          oprot.writeString(_iter13.getValue());
103 ashish 1070
        }
1071
        oprot.writeMapEnd();
1072
      }
1073
      oprot.writeFieldEnd();
1074
    }
123 ashish 1075
    if (this.price != null) {
1076
      oprot.writeFieldBegin(PRICE_FIELD_DESC);
1077
      {
1078
        oprot.writeMapBegin(new TMap(TType.I64, TType.DOUBLE, this.price.size()));
1079
        for (Map.Entry<Long, Double> _iter14 : this.price.entrySet())
1080
        {
1081
          oprot.writeI64(_iter14.getKey());
1082
          oprot.writeDouble(_iter14.getValue());
1083
        }
1084
        oprot.writeMapEnd();
1085
      }
1086
      oprot.writeFieldEnd();
1087
    }
1088
    oprot.writeFieldBegin(WEIGHT_FIELD_DESC);
1089
    oprot.writeDouble(this.weight);
103 ashish 1090
    oprot.writeFieldEnd();
123 ashish 1091
    oprot.writeFieldBegin(FEATURE_ID_FIELD_DESC);
1092
    oprot.writeI64(this.featureId);
1093
    oprot.writeFieldEnd();
1094
    if (this.featureDescription != null) {
1095
      oprot.writeFieldBegin(FEATURE_DESCRIPTION_FIELD_DESC);
1096
      oprot.writeString(this.featureDescription);
1097
      oprot.writeFieldEnd();
1098
    }
1099
    oprot.writeFieldBegin(VENDOR_ITEM_ID_FIELD_DESC);
1100
    oprot.writeI64(this.vendorItemId);
1101
    oprot.writeFieldEnd();
100 ashish 1102
    oprot.writeFieldStop();
1103
    oprot.writeStructEnd();
1104
  }
1105
 
1106
  @Override
1107
  public String toString() {
1108
    StringBuilder sb = new StringBuilder("Item(");
1109
    boolean first = true;
1110
 
1111
    sb.append("id:");
1112
    sb.append(this.id);
1113
    first = false;
1114
    if (!first) sb.append(", ");
123 ashish 1115
    sb.append("catalogItemId:");
1116
    sb.append(this.catalogItemId);
100 ashish 1117
    first = false;
1118
    if (!first) sb.append(", ");
1119
    sb.append("itemInventory:");
1120
    if (this.itemInventory == null) {
1121
      sb.append("null");
1122
    } else {
1123
      sb.append(this.itemInventory);
1124
    }
1125
    first = false;
103 ashish 1126
    if (!first) sb.append(", ");
1127
    sb.append("addedOn:");
1128
    sb.append(this.addedOn);
1129
    first = false;
1130
    if (!first) sb.append(", ");
1131
    sb.append("startDate:");
1132
    sb.append(this.startDate);
1133
    first = false;
1134
    if (!first) sb.append(", ");
1135
    sb.append("itemStatus:");
1136
    if (this.itemStatus == null) {
1137
      sb.append("null");
1138
    } else {
1139
      String itemStatus_name = itemStatus.name();
1140
      if (itemStatus_name != null) {
1141
        sb.append(itemStatus_name);
1142
        sb.append(" (");
1143
      }
1144
      sb.append(this.itemStatus);
1145
      if (itemStatus_name != null) {
1146
        sb.append(")");
1147
      }
1148
    }
1149
    first = false;
1150
    if (!first) sb.append(", ");
1151
    sb.append("otherInfo:");
1152
    if (this.otherInfo == null) {
1153
      sb.append("null");
1154
    } else {
1155
      sb.append(this.otherInfo);
1156
    }
1157
    first = false;
1158
    if (!first) sb.append(", ");
1159
    sb.append("price:");
123 ashish 1160
    if (this.price == null) {
1161
      sb.append("null");
1162
    } else {
1163
      sb.append(this.price);
1164
    }
103 ashish 1165
    first = false;
123 ashish 1166
    if (!first) sb.append(", ");
1167
    sb.append("weight:");
1168
    sb.append(this.weight);
1169
    first = false;
1170
    if (!first) sb.append(", ");
1171
    sb.append("featureId:");
1172
    sb.append(this.featureId);
1173
    first = false;
1174
    if (!first) sb.append(", ");
1175
    sb.append("featureDescription:");
1176
    if (this.featureDescription == null) {
1177
      sb.append("null");
1178
    } else {
1179
      sb.append(this.featureDescription);
1180
    }
1181
    first = false;
1182
    if (!first) sb.append(", ");
1183
    sb.append("vendorItemId:");
1184
    sb.append(this.vendorItemId);
1185
    first = false;
100 ashish 1186
    sb.append(")");
1187
    return sb.toString();
1188
  }
1189
 
1190
  public void validate() throws TException {
1191
    // check for required fields
1192
  }
1193
 
1194
}
1195