Subversion Repositories SmartDukaan

Rev

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