Subversion Repositories SmartDukaan

Rev

Rev 2820 | Rev 3430 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2820 chandransh 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.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.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 Scan implements TBase<Scan._Fields>, java.io.Serializable, Cloneable, Comparable<Scan> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Scan");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)2);
3383 chandransh 31
  private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)3);
32
  private static final TField PURCHASE_ID_FIELD_DESC = new TField("purchaseId", TType.I64, (short)4);
33
  private static final TField ITEM_NUMBER_FIELD_DESC = new TField("itemNumber", TType.STRING, (short)5);
34
  private static final TField IMEI_NUMBER_FIELD_DESC = new TField("imeiNumber", TType.STRING, (short)6);
35
  private static final TField TYPE_FIELD_DESC = new TField("type", TType.I32, (short)7);
36
  private static final TField SCANNED_AT_FIELD_DESC = new TField("scannedAt", TType.I64, (short)8);
2820 chandransh 37
 
38
  private long id;
39
  private long itemId;
3383 chandransh 40
  private long warehouseId;
41
  private long purchaseId;
42
  private String itemNumber;
43
  private String imeiNumber;
2820 chandransh 44
  private ScanType type;
45
  private long scannedAt;
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"),
50
    ITEM_ID((short)2, "itemId"),
3383 chandransh 51
    WAREHOUSE_ID((short)3, "warehouseId"),
52
    PURCHASE_ID((short)4, "purchaseId"),
53
    ITEM_NUMBER((short)5, "itemNumber"),
54
    IMEI_NUMBER((short)6, "imeiNumber"),
2820 chandransh 55
    /**
56
     * 
57
     * @see ScanType
58
     */
3383 chandransh 59
    TYPE((short)7, "type"),
60
    SCANNED_AT((short)8, "scannedAt");
2820 chandransh 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;
115
  private static final int __ITEMID_ISSET_ID = 1;
3383 chandransh 116
  private static final int __WAREHOUSEID_ISSET_ID = 2;
117
  private static final int __PURCHASEID_ISSET_ID = 3;
118
  private static final int __SCANNEDAT_ISSET_ID = 4;
119
  private BitSet __isset_bit_vector = new BitSet(5);
2820 chandransh 120
 
121
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
122
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
123
        new FieldValueMetaData(TType.I64)));
124
    put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
125
        new FieldValueMetaData(TType.I64)));
3383 chandransh 126
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
2820 chandransh 127
        new FieldValueMetaData(TType.I64)));
3383 chandransh 128
    put(_Fields.PURCHASE_ID, new FieldMetaData("purchaseId", TFieldRequirementType.DEFAULT, 
129
        new FieldValueMetaData(TType.I64)));
130
    put(_Fields.ITEM_NUMBER, new FieldMetaData("itemNumber", TFieldRequirementType.DEFAULT, 
131
        new FieldValueMetaData(TType.STRING)));
132
    put(_Fields.IMEI_NUMBER, new FieldMetaData("imeiNumber", TFieldRequirementType.DEFAULT, 
133
        new FieldValueMetaData(TType.STRING)));
2820 chandransh 134
    put(_Fields.TYPE, new FieldMetaData("type", TFieldRequirementType.DEFAULT, 
135
        new EnumMetaData(TType.ENUM, ScanType.class)));
136
    put(_Fields.SCANNED_AT, new FieldMetaData("scannedAt", TFieldRequirementType.DEFAULT, 
137
        new FieldValueMetaData(TType.I64)));
138
  }});
139
 
140
  static {
141
    FieldMetaData.addStructMetaDataMap(Scan.class, metaDataMap);
142
  }
143
 
144
  public Scan() {
145
  }
146
 
147
  public Scan(
148
    long id,
149
    long itemId,
3383 chandransh 150
    long warehouseId,
151
    long purchaseId,
152
    String itemNumber,
153
    String imeiNumber,
2820 chandransh 154
    ScanType type,
155
    long scannedAt)
156
  {
157
    this();
158
    this.id = id;
159
    setIdIsSet(true);
160
    this.itemId = itemId;
161
    setItemIdIsSet(true);
3383 chandransh 162
    this.warehouseId = warehouseId;
163
    setWarehouseIdIsSet(true);
164
    this.purchaseId = purchaseId;
165
    setPurchaseIdIsSet(true);
166
    this.itemNumber = itemNumber;
167
    this.imeiNumber = imeiNumber;
2820 chandransh 168
    this.type = type;
169
    this.scannedAt = scannedAt;
170
    setScannedAtIsSet(true);
171
  }
172
 
173
  /**
174
   * Performs a deep copy on <i>other</i>.
175
   */
176
  public Scan(Scan other) {
177
    __isset_bit_vector.clear();
178
    __isset_bit_vector.or(other.__isset_bit_vector);
179
    this.id = other.id;
180
    this.itemId = other.itemId;
3383 chandransh 181
    this.warehouseId = other.warehouseId;
182
    this.purchaseId = other.purchaseId;
183
    if (other.isSetItemNumber()) {
184
      this.itemNumber = other.itemNumber;
185
    }
186
    if (other.isSetImeiNumber()) {
187
      this.imeiNumber = other.imeiNumber;
188
    }
2820 chandransh 189
    if (other.isSetType()) {
190
      this.type = other.type;
191
    }
192
    this.scannedAt = other.scannedAt;
193
  }
194
 
195
  public Scan deepCopy() {
196
    return new Scan(this);
197
  }
198
 
199
  @Deprecated
200
  public Scan clone() {
201
    return new Scan(this);
202
  }
203
 
204
  public long getId() {
205
    return this.id;
206
  }
207
 
208
  public Scan setId(long id) {
209
    this.id = id;
210
    setIdIsSet(true);
211
    return this;
212
  }
213
 
214
  public void unsetId() {
215
    __isset_bit_vector.clear(__ID_ISSET_ID);
216
  }
217
 
218
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
219
  public boolean isSetId() {
220
    return __isset_bit_vector.get(__ID_ISSET_ID);
221
  }
222
 
223
  public void setIdIsSet(boolean value) {
224
    __isset_bit_vector.set(__ID_ISSET_ID, value);
225
  }
226
 
227
  public long getItemId() {
228
    return this.itemId;
229
  }
230
 
231
  public Scan setItemId(long itemId) {
232
    this.itemId = itemId;
233
    setItemIdIsSet(true);
234
    return this;
235
  }
236
 
237
  public void unsetItemId() {
238
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
239
  }
240
 
241
  /** Returns true if field itemId is set (has been asigned a value) and false otherwise */
242
  public boolean isSetItemId() {
243
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
244
  }
245
 
246
  public void setItemIdIsSet(boolean value) {
247
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
248
  }
249
 
3383 chandransh 250
  public long getWarehouseId() {
251
    return this.warehouseId;
2820 chandransh 252
  }
253
 
3383 chandransh 254
  public Scan setWarehouseId(long warehouseId) {
255
    this.warehouseId = warehouseId;
256
    setWarehouseIdIsSet(true);
2820 chandransh 257
    return this;
258
  }
259
 
3383 chandransh 260
  public void unsetWarehouseId() {
261
    __isset_bit_vector.clear(__WAREHOUSEID_ISSET_ID);
2820 chandransh 262
  }
263
 
3383 chandransh 264
  /** Returns true if field warehouseId is set (has been asigned a value) and false otherwise */
265
  public boolean isSetWarehouseId() {
266
    return __isset_bit_vector.get(__WAREHOUSEID_ISSET_ID);
2820 chandransh 267
  }
268
 
3383 chandransh 269
  public void setWarehouseIdIsSet(boolean value) {
270
    __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
2820 chandransh 271
  }
272
 
3383 chandransh 273
  public long getPurchaseId() {
274
    return this.purchaseId;
275
  }
276
 
277
  public Scan setPurchaseId(long purchaseId) {
278
    this.purchaseId = purchaseId;
279
    setPurchaseIdIsSet(true);
280
    return this;
281
  }
282
 
283
  public void unsetPurchaseId() {
284
    __isset_bit_vector.clear(__PURCHASEID_ISSET_ID);
285
  }
286
 
287
  /** Returns true if field purchaseId is set (has been asigned a value) and false otherwise */
288
  public boolean isSetPurchaseId() {
289
    return __isset_bit_vector.get(__PURCHASEID_ISSET_ID);
290
  }
291
 
292
  public void setPurchaseIdIsSet(boolean value) {
293
    __isset_bit_vector.set(__PURCHASEID_ISSET_ID, value);
294
  }
295
 
296
  public String getItemNumber() {
297
    return this.itemNumber;
298
  }
299
 
300
  public Scan setItemNumber(String itemNumber) {
301
    this.itemNumber = itemNumber;
302
    return this;
303
  }
304
 
305
  public void unsetItemNumber() {
306
    this.itemNumber = null;
307
  }
308
 
309
  /** Returns true if field itemNumber is set (has been asigned a value) and false otherwise */
310
  public boolean isSetItemNumber() {
311
    return this.itemNumber != null;
312
  }
313
 
314
  public void setItemNumberIsSet(boolean value) {
315
    if (!value) {
316
      this.itemNumber = null;
317
    }
318
  }
319
 
320
  public String getImeiNumber() {
321
    return this.imeiNumber;
322
  }
323
 
324
  public Scan setImeiNumber(String imeiNumber) {
325
    this.imeiNumber = imeiNumber;
326
    return this;
327
  }
328
 
329
  public void unsetImeiNumber() {
330
    this.imeiNumber = null;
331
  }
332
 
333
  /** Returns true if field imeiNumber is set (has been asigned a value) and false otherwise */
334
  public boolean isSetImeiNumber() {
335
    return this.imeiNumber != null;
336
  }
337
 
338
  public void setImeiNumberIsSet(boolean value) {
339
    if (!value) {
340
      this.imeiNumber = null;
341
    }
342
  }
343
 
2820 chandransh 344
  /**
345
   * 
346
   * @see ScanType
347
   */
348
  public ScanType getType() {
349
    return this.type;
350
  }
351
 
352
  /**
353
   * 
354
   * @see ScanType
355
   */
356
  public Scan setType(ScanType type) {
357
    this.type = type;
358
    return this;
359
  }
360
 
361
  public void unsetType() {
362
    this.type = null;
363
  }
364
 
365
  /** Returns true if field type is set (has been asigned a value) and false otherwise */
366
  public boolean isSetType() {
367
    return this.type != null;
368
  }
369
 
370
  public void setTypeIsSet(boolean value) {
371
    if (!value) {
372
      this.type = null;
373
    }
374
  }
375
 
376
  public long getScannedAt() {
377
    return this.scannedAt;
378
  }
379
 
380
  public Scan setScannedAt(long scannedAt) {
381
    this.scannedAt = scannedAt;
382
    setScannedAtIsSet(true);
383
    return this;
384
  }
385
 
386
  public void unsetScannedAt() {
387
    __isset_bit_vector.clear(__SCANNEDAT_ISSET_ID);
388
  }
389
 
390
  /** Returns true if field scannedAt is set (has been asigned a value) and false otherwise */
391
  public boolean isSetScannedAt() {
392
    return __isset_bit_vector.get(__SCANNEDAT_ISSET_ID);
393
  }
394
 
395
  public void setScannedAtIsSet(boolean value) {
396
    __isset_bit_vector.set(__SCANNEDAT_ISSET_ID, value);
397
  }
398
 
399
  public void setFieldValue(_Fields field, Object value) {
400
    switch (field) {
401
    case ID:
402
      if (value == null) {
403
        unsetId();
404
      } else {
405
        setId((Long)value);
406
      }
407
      break;
408
 
409
    case ITEM_ID:
410
      if (value == null) {
411
        unsetItemId();
412
      } else {
413
        setItemId((Long)value);
414
      }
415
      break;
416
 
3383 chandransh 417
    case WAREHOUSE_ID:
2820 chandransh 418
      if (value == null) {
3383 chandransh 419
        unsetWarehouseId();
2820 chandransh 420
      } else {
3383 chandransh 421
        setWarehouseId((Long)value);
2820 chandransh 422
      }
423
      break;
424
 
3383 chandransh 425
    case PURCHASE_ID:
426
      if (value == null) {
427
        unsetPurchaseId();
428
      } else {
429
        setPurchaseId((Long)value);
430
      }
431
      break;
432
 
433
    case ITEM_NUMBER:
434
      if (value == null) {
435
        unsetItemNumber();
436
      } else {
437
        setItemNumber((String)value);
438
      }
439
      break;
440
 
441
    case IMEI_NUMBER:
442
      if (value == null) {
443
        unsetImeiNumber();
444
      } else {
445
        setImeiNumber((String)value);
446
      }
447
      break;
448
 
2820 chandransh 449
    case TYPE:
450
      if (value == null) {
451
        unsetType();
452
      } else {
453
        setType((ScanType)value);
454
      }
455
      break;
456
 
457
    case SCANNED_AT:
458
      if (value == null) {
459
        unsetScannedAt();
460
      } else {
461
        setScannedAt((Long)value);
462
      }
463
      break;
464
 
465
    }
466
  }
467
 
468
  public void setFieldValue(int fieldID, Object value) {
469
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
470
  }
471
 
472
  public Object getFieldValue(_Fields field) {
473
    switch (field) {
474
    case ID:
475
      return new Long(getId());
476
 
477
    case ITEM_ID:
478
      return new Long(getItemId());
479
 
3383 chandransh 480
    case WAREHOUSE_ID:
481
      return new Long(getWarehouseId());
2820 chandransh 482
 
3383 chandransh 483
    case PURCHASE_ID:
484
      return new Long(getPurchaseId());
485
 
486
    case ITEM_NUMBER:
487
      return getItemNumber();
488
 
489
    case IMEI_NUMBER:
490
      return getImeiNumber();
491
 
2820 chandransh 492
    case TYPE:
493
      return getType();
494
 
495
    case SCANNED_AT:
496
      return new Long(getScannedAt());
497
 
498
    }
499
    throw new IllegalStateException();
500
  }
501
 
502
  public Object getFieldValue(int fieldId) {
503
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
504
  }
505
 
506
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
507
  public boolean isSet(_Fields field) {
508
    switch (field) {
509
    case ID:
510
      return isSetId();
511
    case ITEM_ID:
512
      return isSetItemId();
3383 chandransh 513
    case WAREHOUSE_ID:
514
      return isSetWarehouseId();
515
    case PURCHASE_ID:
516
      return isSetPurchaseId();
517
    case ITEM_NUMBER:
518
      return isSetItemNumber();
519
    case IMEI_NUMBER:
520
      return isSetImeiNumber();
2820 chandransh 521
    case TYPE:
522
      return isSetType();
523
    case SCANNED_AT:
524
      return isSetScannedAt();
525
    }
526
    throw new IllegalStateException();
527
  }
528
 
529
  public boolean isSet(int fieldID) {
530
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
531
  }
532
 
533
  @Override
534
  public boolean equals(Object that) {
535
    if (that == null)
536
      return false;
537
    if (that instanceof Scan)
538
      return this.equals((Scan)that);
539
    return false;
540
  }
541
 
542
  public boolean equals(Scan that) {
543
    if (that == null)
544
      return false;
545
 
546
    boolean this_present_id = true;
547
    boolean that_present_id = true;
548
    if (this_present_id || that_present_id) {
549
      if (!(this_present_id && that_present_id))
550
        return false;
551
      if (this.id != that.id)
552
        return false;
553
    }
554
 
555
    boolean this_present_itemId = true;
556
    boolean that_present_itemId = true;
557
    if (this_present_itemId || that_present_itemId) {
558
      if (!(this_present_itemId && that_present_itemId))
559
        return false;
560
      if (this.itemId != that.itemId)
561
        return false;
562
    }
563
 
3383 chandransh 564
    boolean this_present_warehouseId = true;
565
    boolean that_present_warehouseId = true;
566
    if (this_present_warehouseId || that_present_warehouseId) {
567
      if (!(this_present_warehouseId && that_present_warehouseId))
2820 chandransh 568
        return false;
3383 chandransh 569
      if (this.warehouseId != that.warehouseId)
2820 chandransh 570
        return false;
571
    }
572
 
3383 chandransh 573
    boolean this_present_purchaseId = true;
574
    boolean that_present_purchaseId = true;
575
    if (this_present_purchaseId || that_present_purchaseId) {
576
      if (!(this_present_purchaseId && that_present_purchaseId))
577
        return false;
578
      if (this.purchaseId != that.purchaseId)
579
        return false;
580
    }
581
 
582
    boolean this_present_itemNumber = true && this.isSetItemNumber();
583
    boolean that_present_itemNumber = true && that.isSetItemNumber();
584
    if (this_present_itemNumber || that_present_itemNumber) {
585
      if (!(this_present_itemNumber && that_present_itemNumber))
586
        return false;
587
      if (!this.itemNumber.equals(that.itemNumber))
588
        return false;
589
    }
590
 
591
    boolean this_present_imeiNumber = true && this.isSetImeiNumber();
592
    boolean that_present_imeiNumber = true && that.isSetImeiNumber();
593
    if (this_present_imeiNumber || that_present_imeiNumber) {
594
      if (!(this_present_imeiNumber && that_present_imeiNumber))
595
        return false;
596
      if (!this.imeiNumber.equals(that.imeiNumber))
597
        return false;
598
    }
599
 
2820 chandransh 600
    boolean this_present_type = true && this.isSetType();
601
    boolean that_present_type = true && that.isSetType();
602
    if (this_present_type || that_present_type) {
603
      if (!(this_present_type && that_present_type))
604
        return false;
605
      if (!this.type.equals(that.type))
606
        return false;
607
    }
608
 
609
    boolean this_present_scannedAt = true;
610
    boolean that_present_scannedAt = true;
611
    if (this_present_scannedAt || that_present_scannedAt) {
612
      if (!(this_present_scannedAt && that_present_scannedAt))
613
        return false;
614
      if (this.scannedAt != that.scannedAt)
615
        return false;
616
    }
617
 
618
    return true;
619
  }
620
 
621
  @Override
622
  public int hashCode() {
623
    return 0;
624
  }
625
 
626
  public int compareTo(Scan other) {
627
    if (!getClass().equals(other.getClass())) {
628
      return getClass().getName().compareTo(other.getClass().getName());
629
    }
630
 
631
    int lastComparison = 0;
632
    Scan typedOther = (Scan)other;
633
 
634
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
635
    if (lastComparison != 0) {
636
      return lastComparison;
637
    }
638
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
639
    if (lastComparison != 0) {
640
      return lastComparison;
641
    }
642
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
643
    if (lastComparison != 0) {
644
      return lastComparison;
645
    }
646
    lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
647
    if (lastComparison != 0) {
648
      return lastComparison;
649
    }
3383 chandransh 650
    lastComparison = Boolean.valueOf(isSetWarehouseId()).compareTo(isSetWarehouseId());
2820 chandransh 651
    if (lastComparison != 0) {
652
      return lastComparison;
653
    }
3383 chandransh 654
    lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
2820 chandransh 655
    if (lastComparison != 0) {
656
      return lastComparison;
657
    }
3383 chandransh 658
    lastComparison = Boolean.valueOf(isSetPurchaseId()).compareTo(isSetPurchaseId());
659
    if (lastComparison != 0) {
660
      return lastComparison;
661
    }
662
    lastComparison = TBaseHelper.compareTo(purchaseId, typedOther.purchaseId);
663
    if (lastComparison != 0) {
664
      return lastComparison;
665
    }
666
    lastComparison = Boolean.valueOf(isSetItemNumber()).compareTo(isSetItemNumber());
667
    if (lastComparison != 0) {
668
      return lastComparison;
669
    }
670
    lastComparison = TBaseHelper.compareTo(itemNumber, typedOther.itemNumber);
671
    if (lastComparison != 0) {
672
      return lastComparison;
673
    }
674
    lastComparison = Boolean.valueOf(isSetImeiNumber()).compareTo(isSetImeiNumber());
675
    if (lastComparison != 0) {
676
      return lastComparison;
677
    }
678
    lastComparison = TBaseHelper.compareTo(imeiNumber, typedOther.imeiNumber);
679
    if (lastComparison != 0) {
680
      return lastComparison;
681
    }
2820 chandransh 682
    lastComparison = Boolean.valueOf(isSetType()).compareTo(isSetType());
683
    if (lastComparison != 0) {
684
      return lastComparison;
685
    }
686
    lastComparison = TBaseHelper.compareTo(type, typedOther.type);
687
    if (lastComparison != 0) {
688
      return lastComparison;
689
    }
690
    lastComparison = Boolean.valueOf(isSetScannedAt()).compareTo(isSetScannedAt());
691
    if (lastComparison != 0) {
692
      return lastComparison;
693
    }
694
    lastComparison = TBaseHelper.compareTo(scannedAt, typedOther.scannedAt);
695
    if (lastComparison != 0) {
696
      return lastComparison;
697
    }
698
    return 0;
699
  }
700
 
701
  public void read(TProtocol iprot) throws TException {
702
    TField field;
703
    iprot.readStructBegin();
704
    while (true)
705
    {
706
      field = iprot.readFieldBegin();
707
      if (field.type == TType.STOP) { 
708
        break;
709
      }
710
      _Fields fieldId = _Fields.findByThriftId(field.id);
711
      if (fieldId == null) {
712
        TProtocolUtil.skip(iprot, field.type);
713
      } else {
714
        switch (fieldId) {
715
          case ID:
716
            if (field.type == TType.I64) {
717
              this.id = iprot.readI64();
718
              setIdIsSet(true);
719
            } else { 
720
              TProtocolUtil.skip(iprot, field.type);
721
            }
722
            break;
723
          case ITEM_ID:
724
            if (field.type == TType.I64) {
725
              this.itemId = iprot.readI64();
726
              setItemIdIsSet(true);
727
            } else { 
728
              TProtocolUtil.skip(iprot, field.type);
729
            }
730
            break;
3383 chandransh 731
          case WAREHOUSE_ID:
2820 chandransh 732
            if (field.type == TType.I64) {
3383 chandransh 733
              this.warehouseId = iprot.readI64();
734
              setWarehouseIdIsSet(true);
2820 chandransh 735
            } else { 
736
              TProtocolUtil.skip(iprot, field.type);
737
            }
738
            break;
3383 chandransh 739
          case PURCHASE_ID:
740
            if (field.type == TType.I64) {
741
              this.purchaseId = iprot.readI64();
742
              setPurchaseIdIsSet(true);
743
            } else { 
744
              TProtocolUtil.skip(iprot, field.type);
745
            }
746
            break;
747
          case ITEM_NUMBER:
748
            if (field.type == TType.STRING) {
749
              this.itemNumber = iprot.readString();
750
            } else { 
751
              TProtocolUtil.skip(iprot, field.type);
752
            }
753
            break;
754
          case IMEI_NUMBER:
755
            if (field.type == TType.STRING) {
756
              this.imeiNumber = iprot.readString();
757
            } else { 
758
              TProtocolUtil.skip(iprot, field.type);
759
            }
760
            break;
2820 chandransh 761
          case TYPE:
762
            if (field.type == TType.I32) {
763
              this.type = ScanType.findByValue(iprot.readI32());
764
            } else { 
765
              TProtocolUtil.skip(iprot, field.type);
766
            }
767
            break;
768
          case SCANNED_AT:
769
            if (field.type == TType.I64) {
770
              this.scannedAt = iprot.readI64();
771
              setScannedAtIsSet(true);
772
            } else { 
773
              TProtocolUtil.skip(iprot, field.type);
774
            }
775
            break;
776
        }
777
        iprot.readFieldEnd();
778
      }
779
    }
780
    iprot.readStructEnd();
781
    validate();
782
  }
783
 
784
  public void write(TProtocol oprot) throws TException {
785
    validate();
786
 
787
    oprot.writeStructBegin(STRUCT_DESC);
788
    oprot.writeFieldBegin(ID_FIELD_DESC);
789
    oprot.writeI64(this.id);
790
    oprot.writeFieldEnd();
791
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
792
    oprot.writeI64(this.itemId);
793
    oprot.writeFieldEnd();
3383 chandransh 794
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
795
    oprot.writeI64(this.warehouseId);
2820 chandransh 796
    oprot.writeFieldEnd();
3383 chandransh 797
    oprot.writeFieldBegin(PURCHASE_ID_FIELD_DESC);
798
    oprot.writeI64(this.purchaseId);
799
    oprot.writeFieldEnd();
800
    if (this.itemNumber != null) {
801
      oprot.writeFieldBegin(ITEM_NUMBER_FIELD_DESC);
802
      oprot.writeString(this.itemNumber);
803
      oprot.writeFieldEnd();
804
    }
805
    if (this.imeiNumber != null) {
806
      oprot.writeFieldBegin(IMEI_NUMBER_FIELD_DESC);
807
      oprot.writeString(this.imeiNumber);
808
      oprot.writeFieldEnd();
809
    }
2820 chandransh 810
    if (this.type != null) {
811
      oprot.writeFieldBegin(TYPE_FIELD_DESC);
812
      oprot.writeI32(this.type.getValue());
813
      oprot.writeFieldEnd();
814
    }
815
    oprot.writeFieldBegin(SCANNED_AT_FIELD_DESC);
816
    oprot.writeI64(this.scannedAt);
817
    oprot.writeFieldEnd();
818
    oprot.writeFieldStop();
819
    oprot.writeStructEnd();
820
  }
821
 
822
  @Override
823
  public String toString() {
824
    StringBuilder sb = new StringBuilder("Scan(");
825
    boolean first = true;
826
 
827
    sb.append("id:");
828
    sb.append(this.id);
829
    first = false;
830
    if (!first) sb.append(", ");
831
    sb.append("itemId:");
832
    sb.append(this.itemId);
833
    first = false;
834
    if (!first) sb.append(", ");
3383 chandransh 835
    sb.append("warehouseId:");
836
    sb.append(this.warehouseId);
2820 chandransh 837
    first = false;
838
    if (!first) sb.append(", ");
3383 chandransh 839
    sb.append("purchaseId:");
840
    sb.append(this.purchaseId);
841
    first = false;
842
    if (!first) sb.append(", ");
843
    sb.append("itemNumber:");
844
    if (this.itemNumber == null) {
845
      sb.append("null");
846
    } else {
847
      sb.append(this.itemNumber);
848
    }
849
    first = false;
850
    if (!first) sb.append(", ");
851
    sb.append("imeiNumber:");
852
    if (this.imeiNumber == null) {
853
      sb.append("null");
854
    } else {
855
      sb.append(this.imeiNumber);
856
    }
857
    first = false;
858
    if (!first) sb.append(", ");
2820 chandransh 859
    sb.append("type:");
860
    if (this.type == null) {
861
      sb.append("null");
862
    } else {
863
      String type_name = type.name();
864
      if (type_name != null) {
865
        sb.append(type_name);
866
        sb.append(" (");
867
      }
868
      sb.append(this.type);
869
      if (type_name != null) {
870
        sb.append(")");
871
      }
872
    }
873
    first = false;
874
    if (!first) sb.append(", ");
875
    sb.append("scannedAt:");
876
    sb.append(this.scannedAt);
877
    first = false;
878
    sb.append(")");
879
    return sb.toString();
880
  }
881
 
882
  public void validate() throws TException {
883
    // check for required fields
884
  }
885
 
886
}
887