Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
4496 mandeep.dh 1
/**
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.warehouse;
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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class InventoryItem implements org.apache.thrift.TBase<InventoryItem, InventoryItem._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InventoryItem");
25
 
26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField ITEM_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("itemNumber", org.apache.thrift.protocol.TType.STRING, (short)3);
29
  private static final org.apache.thrift.protocol.TField SERIAL_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("serialNumber", org.apache.thrift.protocol.TType.STRING, (short)4);
30
  private static final org.apache.thrift.protocol.TField INITIAL_QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("initialQuantity", org.apache.thrift.protocol.TType.I64, (short)5);
31
  private static final org.apache.thrift.protocol.TField CURRENT_QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("currentQuantity", org.apache.thrift.protocol.TType.I64, (short)6);
32
  private static final org.apache.thrift.protocol.TField PURCHASE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("purchaseId", org.apache.thrift.protocol.TType.I64, (short)7);
33
 
34
  private long id; // required
35
  private long itemId; // required
36
  private String itemNumber; // required
37
  private String serialNumber; // required
38
  private long initialQuantity; // required
39
  private long currentQuantity; // required
40
  private long purchaseId; // required
41
 
42
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
43
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
44
    ID((short)1, "id"),
45
    ITEM_ID((short)2, "itemId"),
46
    ITEM_NUMBER((short)3, "itemNumber"),
47
    SERIAL_NUMBER((short)4, "serialNumber"),
48
    INITIAL_QUANTITY((short)5, "initialQuantity"),
49
    CURRENT_QUANTITY((short)6, "currentQuantity"),
50
    PURCHASE_ID((short)7, "purchaseId");
51
 
52
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
53
 
54
    static {
55
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
56
        byName.put(field.getFieldName(), field);
57
      }
58
    }
59
 
60
    /**
61
     * Find the _Fields constant that matches fieldId, or null if its not found.
62
     */
63
    public static _Fields findByThriftId(int fieldId) {
64
      switch(fieldId) {
65
        case 1: // ID
66
          return ID;
67
        case 2: // ITEM_ID
68
          return ITEM_ID;
69
        case 3: // ITEM_NUMBER
70
          return ITEM_NUMBER;
71
        case 4: // SERIAL_NUMBER
72
          return SERIAL_NUMBER;
73
        case 5: // INITIAL_QUANTITY
74
          return INITIAL_QUANTITY;
75
        case 6: // CURRENT_QUANTITY
76
          return CURRENT_QUANTITY;
77
        case 7: // PURCHASE_ID
78
          return PURCHASE_ID;
79
        default:
80
          return null;
81
      }
82
    }
83
 
84
    /**
85
     * Find the _Fields constant that matches fieldId, throwing an exception
86
     * if it is not found.
87
     */
88
    public static _Fields findByThriftIdOrThrow(int fieldId) {
89
      _Fields fields = findByThriftId(fieldId);
90
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
91
      return fields;
92
    }
93
 
94
    /**
95
     * Find the _Fields constant that matches name, or null if its not found.
96
     */
97
    public static _Fields findByName(String name) {
98
      return byName.get(name);
99
    }
100
 
101
    private final short _thriftId;
102
    private final String _fieldName;
103
 
104
    _Fields(short thriftId, String fieldName) {
105
      _thriftId = thriftId;
106
      _fieldName = fieldName;
107
    }
108
 
109
    public short getThriftFieldId() {
110
      return _thriftId;
111
    }
112
 
113
    public String getFieldName() {
114
      return _fieldName;
115
    }
116
  }
117
 
118
  // isset id assignments
119
  private static final int __ID_ISSET_ID = 0;
120
  private static final int __ITEMID_ISSET_ID = 1;
121
  private static final int __INITIALQUANTITY_ISSET_ID = 2;
122
  private static final int __CURRENTQUANTITY_ISSET_ID = 3;
123
  private static final int __PURCHASEID_ISSET_ID = 4;
124
  private BitSet __isset_bit_vector = new BitSet(5);
125
 
126
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
127
  static {
128
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
129
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
130
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
131
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
132
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
133
    tmpMap.put(_Fields.ITEM_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("itemNumber", org.apache.thrift.TFieldRequirementType.DEFAULT, 
134
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
135
    tmpMap.put(_Fields.SERIAL_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("serialNumber", org.apache.thrift.TFieldRequirementType.DEFAULT, 
136
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
137
    tmpMap.put(_Fields.INITIAL_QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("initialQuantity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
138
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
139
    tmpMap.put(_Fields.CURRENT_QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("currentQuantity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
140
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
141
    tmpMap.put(_Fields.PURCHASE_ID, new org.apache.thrift.meta_data.FieldMetaData("purchaseId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
142
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
143
    metaDataMap = Collections.unmodifiableMap(tmpMap);
144
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InventoryItem.class, metaDataMap);
145
  }
146
 
147
  public InventoryItem() {
148
  }
149
 
150
  public InventoryItem(
151
    long id,
152
    long itemId,
153
    String itemNumber,
154
    String serialNumber,
155
    long initialQuantity,
156
    long currentQuantity,
157
    long purchaseId)
158
  {
159
    this();
160
    this.id = id;
161
    setIdIsSet(true);
162
    this.itemId = itemId;
163
    setItemIdIsSet(true);
164
    this.itemNumber = itemNumber;
165
    this.serialNumber = serialNumber;
166
    this.initialQuantity = initialQuantity;
167
    setInitialQuantityIsSet(true);
168
    this.currentQuantity = currentQuantity;
169
    setCurrentQuantityIsSet(true);
170
    this.purchaseId = purchaseId;
171
    setPurchaseIdIsSet(true);
172
  }
173
 
174
  /**
175
   * Performs a deep copy on <i>other</i>.
176
   */
177
  public InventoryItem(InventoryItem other) {
178
    __isset_bit_vector.clear();
179
    __isset_bit_vector.or(other.__isset_bit_vector);
180
    this.id = other.id;
181
    this.itemId = other.itemId;
182
    if (other.isSetItemNumber()) {
183
      this.itemNumber = other.itemNumber;
184
    }
185
    if (other.isSetSerialNumber()) {
186
      this.serialNumber = other.serialNumber;
187
    }
188
    this.initialQuantity = other.initialQuantity;
189
    this.currentQuantity = other.currentQuantity;
190
    this.purchaseId = other.purchaseId;
191
  }
192
 
193
  public InventoryItem deepCopy() {
194
    return new InventoryItem(this);
195
  }
196
 
197
  @Override
198
  public void clear() {
199
    setIdIsSet(false);
200
    this.id = 0;
201
    setItemIdIsSet(false);
202
    this.itemId = 0;
203
    this.itemNumber = null;
204
    this.serialNumber = null;
205
    setInitialQuantityIsSet(false);
206
    this.initialQuantity = 0;
207
    setCurrentQuantityIsSet(false);
208
    this.currentQuantity = 0;
209
    setPurchaseIdIsSet(false);
210
    this.purchaseId = 0;
211
  }
212
 
213
  public long getId() {
214
    return this.id;
215
  }
216
 
217
  public void setId(long id) {
218
    this.id = id;
219
    setIdIsSet(true);
220
  }
221
 
222
  public void unsetId() {
223
    __isset_bit_vector.clear(__ID_ISSET_ID);
224
  }
225
 
226
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
227
  public boolean isSetId() {
228
    return __isset_bit_vector.get(__ID_ISSET_ID);
229
  }
230
 
231
  public void setIdIsSet(boolean value) {
232
    __isset_bit_vector.set(__ID_ISSET_ID, value);
233
  }
234
 
235
  public long getItemId() {
236
    return this.itemId;
237
  }
238
 
239
  public void setItemId(long itemId) {
240
    this.itemId = itemId;
241
    setItemIdIsSet(true);
242
  }
243
 
244
  public void unsetItemId() {
245
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
246
  }
247
 
248
  /** Returns true if field itemId is set (has been assigned a value) and false otherwise */
249
  public boolean isSetItemId() {
250
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
251
  }
252
 
253
  public void setItemIdIsSet(boolean value) {
254
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
255
  }
256
 
257
  public String getItemNumber() {
258
    return this.itemNumber;
259
  }
260
 
261
  public void setItemNumber(String itemNumber) {
262
    this.itemNumber = itemNumber;
263
  }
264
 
265
  public void unsetItemNumber() {
266
    this.itemNumber = null;
267
  }
268
 
269
  /** Returns true if field itemNumber is set (has been assigned a value) and false otherwise */
270
  public boolean isSetItemNumber() {
271
    return this.itemNumber != null;
272
  }
273
 
274
  public void setItemNumberIsSet(boolean value) {
275
    if (!value) {
276
      this.itemNumber = null;
277
    }
278
  }
279
 
280
  public String getSerialNumber() {
281
    return this.serialNumber;
282
  }
283
 
284
  public void setSerialNumber(String serialNumber) {
285
    this.serialNumber = serialNumber;
286
  }
287
 
288
  public void unsetSerialNumber() {
289
    this.serialNumber = null;
290
  }
291
 
292
  /** Returns true if field serialNumber is set (has been assigned a value) and false otherwise */
293
  public boolean isSetSerialNumber() {
294
    return this.serialNumber != null;
295
  }
296
 
297
  public void setSerialNumberIsSet(boolean value) {
298
    if (!value) {
299
      this.serialNumber = null;
300
    }
301
  }
302
 
303
  public long getInitialQuantity() {
304
    return this.initialQuantity;
305
  }
306
 
307
  public void setInitialQuantity(long initialQuantity) {
308
    this.initialQuantity = initialQuantity;
309
    setInitialQuantityIsSet(true);
310
  }
311
 
312
  public void unsetInitialQuantity() {
313
    __isset_bit_vector.clear(__INITIALQUANTITY_ISSET_ID);
314
  }
315
 
316
  /** Returns true if field initialQuantity is set (has been assigned a value) and false otherwise */
317
  public boolean isSetInitialQuantity() {
318
    return __isset_bit_vector.get(__INITIALQUANTITY_ISSET_ID);
319
  }
320
 
321
  public void setInitialQuantityIsSet(boolean value) {
322
    __isset_bit_vector.set(__INITIALQUANTITY_ISSET_ID, value);
323
  }
324
 
325
  public long getCurrentQuantity() {
326
    return this.currentQuantity;
327
  }
328
 
329
  public void setCurrentQuantity(long currentQuantity) {
330
    this.currentQuantity = currentQuantity;
331
    setCurrentQuantityIsSet(true);
332
  }
333
 
334
  public void unsetCurrentQuantity() {
335
    __isset_bit_vector.clear(__CURRENTQUANTITY_ISSET_ID);
336
  }
337
 
338
  /** Returns true if field currentQuantity is set (has been assigned a value) and false otherwise */
339
  public boolean isSetCurrentQuantity() {
340
    return __isset_bit_vector.get(__CURRENTQUANTITY_ISSET_ID);
341
  }
342
 
343
  public void setCurrentQuantityIsSet(boolean value) {
344
    __isset_bit_vector.set(__CURRENTQUANTITY_ISSET_ID, value);
345
  }
346
 
347
  public long getPurchaseId() {
348
    return this.purchaseId;
349
  }
350
 
351
  public void setPurchaseId(long purchaseId) {
352
    this.purchaseId = purchaseId;
353
    setPurchaseIdIsSet(true);
354
  }
355
 
356
  public void unsetPurchaseId() {
357
    __isset_bit_vector.clear(__PURCHASEID_ISSET_ID);
358
  }
359
 
360
  /** Returns true if field purchaseId is set (has been assigned a value) and false otherwise */
361
  public boolean isSetPurchaseId() {
362
    return __isset_bit_vector.get(__PURCHASEID_ISSET_ID);
363
  }
364
 
365
  public void setPurchaseIdIsSet(boolean value) {
366
    __isset_bit_vector.set(__PURCHASEID_ISSET_ID, value);
367
  }
368
 
369
  public void setFieldValue(_Fields field, Object value) {
370
    switch (field) {
371
    case ID:
372
      if (value == null) {
373
        unsetId();
374
      } else {
375
        setId((Long)value);
376
      }
377
      break;
378
 
379
    case ITEM_ID:
380
      if (value == null) {
381
        unsetItemId();
382
      } else {
383
        setItemId((Long)value);
384
      }
385
      break;
386
 
387
    case ITEM_NUMBER:
388
      if (value == null) {
389
        unsetItemNumber();
390
      } else {
391
        setItemNumber((String)value);
392
      }
393
      break;
394
 
395
    case SERIAL_NUMBER:
396
      if (value == null) {
397
        unsetSerialNumber();
398
      } else {
399
        setSerialNumber((String)value);
400
      }
401
      break;
402
 
403
    case INITIAL_QUANTITY:
404
      if (value == null) {
405
        unsetInitialQuantity();
406
      } else {
407
        setInitialQuantity((Long)value);
408
      }
409
      break;
410
 
411
    case CURRENT_QUANTITY:
412
      if (value == null) {
413
        unsetCurrentQuantity();
414
      } else {
415
        setCurrentQuantity((Long)value);
416
      }
417
      break;
418
 
419
    case PURCHASE_ID:
420
      if (value == null) {
421
        unsetPurchaseId();
422
      } else {
423
        setPurchaseId((Long)value);
424
      }
425
      break;
426
 
427
    }
428
  }
429
 
430
  public Object getFieldValue(_Fields field) {
431
    switch (field) {
432
    case ID:
433
      return Long.valueOf(getId());
434
 
435
    case ITEM_ID:
436
      return Long.valueOf(getItemId());
437
 
438
    case ITEM_NUMBER:
439
      return getItemNumber();
440
 
441
    case SERIAL_NUMBER:
442
      return getSerialNumber();
443
 
444
    case INITIAL_QUANTITY:
445
      return Long.valueOf(getInitialQuantity());
446
 
447
    case CURRENT_QUANTITY:
448
      return Long.valueOf(getCurrentQuantity());
449
 
450
    case PURCHASE_ID:
451
      return Long.valueOf(getPurchaseId());
452
 
453
    }
454
    throw new IllegalStateException();
455
  }
456
 
457
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
458
  public boolean isSet(_Fields field) {
459
    if (field == null) {
460
      throw new IllegalArgumentException();
461
    }
462
 
463
    switch (field) {
464
    case ID:
465
      return isSetId();
466
    case ITEM_ID:
467
      return isSetItemId();
468
    case ITEM_NUMBER:
469
      return isSetItemNumber();
470
    case SERIAL_NUMBER:
471
      return isSetSerialNumber();
472
    case INITIAL_QUANTITY:
473
      return isSetInitialQuantity();
474
    case CURRENT_QUANTITY:
475
      return isSetCurrentQuantity();
476
    case PURCHASE_ID:
477
      return isSetPurchaseId();
478
    }
479
    throw new IllegalStateException();
480
  }
481
 
482
  @Override
483
  public boolean equals(Object that) {
484
    if (that == null)
485
      return false;
486
    if (that instanceof InventoryItem)
487
      return this.equals((InventoryItem)that);
488
    return false;
489
  }
490
 
491
  public boolean equals(InventoryItem that) {
492
    if (that == null)
493
      return false;
494
 
495
    boolean this_present_id = true;
496
    boolean that_present_id = true;
497
    if (this_present_id || that_present_id) {
498
      if (!(this_present_id && that_present_id))
499
        return false;
500
      if (this.id != that.id)
501
        return false;
502
    }
503
 
504
    boolean this_present_itemId = true;
505
    boolean that_present_itemId = true;
506
    if (this_present_itemId || that_present_itemId) {
507
      if (!(this_present_itemId && that_present_itemId))
508
        return false;
509
      if (this.itemId != that.itemId)
510
        return false;
511
    }
512
 
513
    boolean this_present_itemNumber = true && this.isSetItemNumber();
514
    boolean that_present_itemNumber = true && that.isSetItemNumber();
515
    if (this_present_itemNumber || that_present_itemNumber) {
516
      if (!(this_present_itemNumber && that_present_itemNumber))
517
        return false;
518
      if (!this.itemNumber.equals(that.itemNumber))
519
        return false;
520
    }
521
 
522
    boolean this_present_serialNumber = true && this.isSetSerialNumber();
523
    boolean that_present_serialNumber = true && that.isSetSerialNumber();
524
    if (this_present_serialNumber || that_present_serialNumber) {
525
      if (!(this_present_serialNumber && that_present_serialNumber))
526
        return false;
527
      if (!this.serialNumber.equals(that.serialNumber))
528
        return false;
529
    }
530
 
531
    boolean this_present_initialQuantity = true;
532
    boolean that_present_initialQuantity = true;
533
    if (this_present_initialQuantity || that_present_initialQuantity) {
534
      if (!(this_present_initialQuantity && that_present_initialQuantity))
535
        return false;
536
      if (this.initialQuantity != that.initialQuantity)
537
        return false;
538
    }
539
 
540
    boolean this_present_currentQuantity = true;
541
    boolean that_present_currentQuantity = true;
542
    if (this_present_currentQuantity || that_present_currentQuantity) {
543
      if (!(this_present_currentQuantity && that_present_currentQuantity))
544
        return false;
545
      if (this.currentQuantity != that.currentQuantity)
546
        return false;
547
    }
548
 
549
    boolean this_present_purchaseId = true;
550
    boolean that_present_purchaseId = true;
551
    if (this_present_purchaseId || that_present_purchaseId) {
552
      if (!(this_present_purchaseId && that_present_purchaseId))
553
        return false;
554
      if (this.purchaseId != that.purchaseId)
555
        return false;
556
    }
557
 
558
    return true;
559
  }
560
 
561
  @Override
562
  public int hashCode() {
563
    return 0;
564
  }
565
 
566
  public int compareTo(InventoryItem other) {
567
    if (!getClass().equals(other.getClass())) {
568
      return getClass().getName().compareTo(other.getClass().getName());
569
    }
570
 
571
    int lastComparison = 0;
572
    InventoryItem typedOther = (InventoryItem)other;
573
 
574
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
575
    if (lastComparison != 0) {
576
      return lastComparison;
577
    }
578
    if (isSetId()) {
579
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
580
      if (lastComparison != 0) {
581
        return lastComparison;
582
      }
583
    }
584
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
585
    if (lastComparison != 0) {
586
      return lastComparison;
587
    }
588
    if (isSetItemId()) {
589
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
590
      if (lastComparison != 0) {
591
        return lastComparison;
592
      }
593
    }
594
    lastComparison = Boolean.valueOf(isSetItemNumber()).compareTo(typedOther.isSetItemNumber());
595
    if (lastComparison != 0) {
596
      return lastComparison;
597
    }
598
    if (isSetItemNumber()) {
599
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemNumber, typedOther.itemNumber);
600
      if (lastComparison != 0) {
601
        return lastComparison;
602
      }
603
    }
604
    lastComparison = Boolean.valueOf(isSetSerialNumber()).compareTo(typedOther.isSetSerialNumber());
605
    if (lastComparison != 0) {
606
      return lastComparison;
607
    }
608
    if (isSetSerialNumber()) {
609
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serialNumber, typedOther.serialNumber);
610
      if (lastComparison != 0) {
611
        return lastComparison;
612
      }
613
    }
614
    lastComparison = Boolean.valueOf(isSetInitialQuantity()).compareTo(typedOther.isSetInitialQuantity());
615
    if (lastComparison != 0) {
616
      return lastComparison;
617
    }
618
    if (isSetInitialQuantity()) {
619
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.initialQuantity, typedOther.initialQuantity);
620
      if (lastComparison != 0) {
621
        return lastComparison;
622
      }
623
    }
624
    lastComparison = Boolean.valueOf(isSetCurrentQuantity()).compareTo(typedOther.isSetCurrentQuantity());
625
    if (lastComparison != 0) {
626
      return lastComparison;
627
    }
628
    if (isSetCurrentQuantity()) {
629
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.currentQuantity, typedOther.currentQuantity);
630
      if (lastComparison != 0) {
631
        return lastComparison;
632
      }
633
    }
634
    lastComparison = Boolean.valueOf(isSetPurchaseId()).compareTo(typedOther.isSetPurchaseId());
635
    if (lastComparison != 0) {
636
      return lastComparison;
637
    }
638
    if (isSetPurchaseId()) {
639
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.purchaseId, typedOther.purchaseId);
640
      if (lastComparison != 0) {
641
        return lastComparison;
642
      }
643
    }
644
    return 0;
645
  }
646
 
647
  public _Fields fieldForId(int fieldId) {
648
    return _Fields.findByThriftId(fieldId);
649
  }
650
 
651
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
652
    org.apache.thrift.protocol.TField field;
653
    iprot.readStructBegin();
654
    while (true)
655
    {
656
      field = iprot.readFieldBegin();
657
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
658
        break;
659
      }
660
      switch (field.id) {
661
        case 1: // ID
662
          if (field.type == org.apache.thrift.protocol.TType.I64) {
663
            this.id = iprot.readI64();
664
            setIdIsSet(true);
665
          } else { 
666
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
667
          }
668
          break;
669
        case 2: // ITEM_ID
670
          if (field.type == org.apache.thrift.protocol.TType.I64) {
671
            this.itemId = iprot.readI64();
672
            setItemIdIsSet(true);
673
          } else { 
674
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
675
          }
676
          break;
677
        case 3: // ITEM_NUMBER
678
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
679
            this.itemNumber = iprot.readString();
680
          } else { 
681
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
682
          }
683
          break;
684
        case 4: // SERIAL_NUMBER
685
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
686
            this.serialNumber = iprot.readString();
687
          } else { 
688
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
689
          }
690
          break;
691
        case 5: // INITIAL_QUANTITY
692
          if (field.type == org.apache.thrift.protocol.TType.I64) {
693
            this.initialQuantity = iprot.readI64();
694
            setInitialQuantityIsSet(true);
695
          } else { 
696
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
697
          }
698
          break;
699
        case 6: // CURRENT_QUANTITY
700
          if (field.type == org.apache.thrift.protocol.TType.I64) {
701
            this.currentQuantity = iprot.readI64();
702
            setCurrentQuantityIsSet(true);
703
          } else { 
704
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
705
          }
706
          break;
707
        case 7: // PURCHASE_ID
708
          if (field.type == org.apache.thrift.protocol.TType.I64) {
709
            this.purchaseId = iprot.readI64();
710
            setPurchaseIdIsSet(true);
711
          } else { 
712
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
713
          }
714
          break;
715
        default:
716
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
717
      }
718
      iprot.readFieldEnd();
719
    }
720
    iprot.readStructEnd();
721
    validate();
722
  }
723
 
724
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
725
    validate();
726
 
727
    oprot.writeStructBegin(STRUCT_DESC);
728
    oprot.writeFieldBegin(ID_FIELD_DESC);
729
    oprot.writeI64(this.id);
730
    oprot.writeFieldEnd();
731
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
732
    oprot.writeI64(this.itemId);
733
    oprot.writeFieldEnd();
734
    if (this.itemNumber != null) {
735
      oprot.writeFieldBegin(ITEM_NUMBER_FIELD_DESC);
736
      oprot.writeString(this.itemNumber);
737
      oprot.writeFieldEnd();
738
    }
739
    if (this.serialNumber != null) {
740
      oprot.writeFieldBegin(SERIAL_NUMBER_FIELD_DESC);
741
      oprot.writeString(this.serialNumber);
742
      oprot.writeFieldEnd();
743
    }
744
    oprot.writeFieldBegin(INITIAL_QUANTITY_FIELD_DESC);
745
    oprot.writeI64(this.initialQuantity);
746
    oprot.writeFieldEnd();
747
    oprot.writeFieldBegin(CURRENT_QUANTITY_FIELD_DESC);
748
    oprot.writeI64(this.currentQuantity);
749
    oprot.writeFieldEnd();
750
    oprot.writeFieldBegin(PURCHASE_ID_FIELD_DESC);
751
    oprot.writeI64(this.purchaseId);
752
    oprot.writeFieldEnd();
753
    oprot.writeFieldStop();
754
    oprot.writeStructEnd();
755
  }
756
 
757
  @Override
758
  public String toString() {
759
    StringBuilder sb = new StringBuilder("InventoryItem(");
760
    boolean first = true;
761
 
762
    sb.append("id:");
763
    sb.append(this.id);
764
    first = false;
765
    if (!first) sb.append(", ");
766
    sb.append("itemId:");
767
    sb.append(this.itemId);
768
    first = false;
769
    if (!first) sb.append(", ");
770
    sb.append("itemNumber:");
771
    if (this.itemNumber == null) {
772
      sb.append("null");
773
    } else {
774
      sb.append(this.itemNumber);
775
    }
776
    first = false;
777
    if (!first) sb.append(", ");
778
    sb.append("serialNumber:");
779
    if (this.serialNumber == null) {
780
      sb.append("null");
781
    } else {
782
      sb.append(this.serialNumber);
783
    }
784
    first = false;
785
    if (!first) sb.append(", ");
786
    sb.append("initialQuantity:");
787
    sb.append(this.initialQuantity);
788
    first = false;
789
    if (!first) sb.append(", ");
790
    sb.append("currentQuantity:");
791
    sb.append(this.currentQuantity);
792
    first = false;
793
    if (!first) sb.append(", ");
794
    sb.append("purchaseId:");
795
    sb.append(this.purchaseId);
796
    first = false;
797
    sb.append(")");
798
    return sb.toString();
799
  }
800
 
801
  public void validate() throws org.apache.thrift.TException {
802
    // check for required fields
803
  }
804
 
805
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
806
    try {
807
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
808
    } catch (org.apache.thrift.TException te) {
809
      throw new java.io.IOException(te);
810
    }
811
  }
812
 
813
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
814
    try {
815
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
816
      __isset_bit_vector = new BitSet(1);
817
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
818
    } catch (org.apache.thrift.TException te) {
819
      throw new java.io.IOException(te);
820
    }
821
  }
822
 
823
}
824