Subversion Repositories SmartDukaan

Rev

Details | 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 PurchaseOrder implements TBase<PurchaseOrder._Fields>, java.io.Serializable, Cloneable, Comparable<PurchaseOrder> {
27
  private static final TStruct STRUCT_DESC = new TStruct("PurchaseOrder");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField PO_NUMBER_FIELD_DESC = new TField("poNumber", TType.STRING, (short)2);
31
  private static final TField LINEITEMS_FIELD_DESC = new TField("lineitems", TType.LIST, (short)3);
32
  private static final TField SUPPLIER_ID_FIELD_DESC = new TField("supplierId", TType.I64, (short)4);
33
  private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)5);
34
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)6);
35
  private static final TField CREATED_AT_FIELD_DESC = new TField("createdAt", TType.I64, (short)7);
36
  private static final TField UPDATED_AT_FIELD_DESC = new TField("updatedAt", TType.I64, (short)8);
37
  private static final TField TOTAL_COST_FIELD_DESC = new TField("totalCost", TType.DOUBLE, (short)9);
38
  private static final TField FREIGHT_CHARGES_FIELD_DESC = new TField("freightCharges", TType.DOUBLE, (short)10);
39
  private static final TField REALIZED_COST_FIELD_DESC = new TField("realizedCost", TType.DOUBLE, (short)11);
40
  private static final TField REALIZED_FREIGHT_CHARGES_FIELD_DESC = new TField("realizedFreightCharges", TType.DOUBLE, (short)12);
41
 
42
  private long id;
43
  private String poNumber;
44
  private List<LineItem> lineitems;
45
  private long supplierId;
46
  private long warehouseId;
47
  private POStatus status;
48
  private long createdAt;
49
  private long updatedAt;
50
  private double totalCost;
51
  private double freightCharges;
52
  private double realizedCost;
53
  private double realizedFreightCharges;
54
 
55
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
56
  public enum _Fields implements TFieldIdEnum {
57
    ID((short)1, "id"),
58
    PO_NUMBER((short)2, "poNumber"),
59
    LINEITEMS((short)3, "lineitems"),
60
    SUPPLIER_ID((short)4, "supplierId"),
61
    WAREHOUSE_ID((short)5, "warehouseId"),
62
    /**
63
     * 
64
     * @see POStatus
65
     */
66
    STATUS((short)6, "status"),
67
    CREATED_AT((short)7, "createdAt"),
68
    UPDATED_AT((short)8, "updatedAt"),
69
    TOTAL_COST((short)9, "totalCost"),
70
    FREIGHT_CHARGES((short)10, "freightCharges"),
71
    REALIZED_COST((short)11, "realizedCost"),
72
    REALIZED_FREIGHT_CHARGES((short)12, "realizedFreightCharges");
73
 
74
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
75
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
76
 
77
    static {
78
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
79
        byId.put((int)field._thriftId, field);
80
        byName.put(field.getFieldName(), field);
81
      }
82
    }
83
 
84
    /**
85
     * Find the _Fields constant that matches fieldId, or null if its not found.
86
     */
87
    public static _Fields findByThriftId(int fieldId) {
88
      return byId.get(fieldId);
89
    }
90
 
91
    /**
92
     * Find the _Fields constant that matches fieldId, throwing an exception
93
     * if it is not found.
94
     */
95
    public static _Fields findByThriftIdOrThrow(int fieldId) {
96
      _Fields fields = findByThriftId(fieldId);
97
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
98
      return fields;
99
    }
100
 
101
    /**
102
     * Find the _Fields constant that matches name, or null if its not found.
103
     */
104
    public static _Fields findByName(String name) {
105
      return byName.get(name);
106
    }
107
 
108
    private final short _thriftId;
109
    private final String _fieldName;
110
 
111
    _Fields(short thriftId, String fieldName) {
112
      _thriftId = thriftId;
113
      _fieldName = fieldName;
114
    }
115
 
116
    public short getThriftFieldId() {
117
      return _thriftId;
118
    }
119
 
120
    public String getFieldName() {
121
      return _fieldName;
122
    }
123
  }
124
 
125
  // isset id assignments
126
  private static final int __ID_ISSET_ID = 0;
127
  private static final int __SUPPLIERID_ISSET_ID = 1;
128
  private static final int __WAREHOUSEID_ISSET_ID = 2;
129
  private static final int __CREATEDAT_ISSET_ID = 3;
130
  private static final int __UPDATEDAT_ISSET_ID = 4;
131
  private static final int __TOTALCOST_ISSET_ID = 5;
132
  private static final int __FREIGHTCHARGES_ISSET_ID = 6;
133
  private static final int __REALIZEDCOST_ISSET_ID = 7;
134
  private static final int __REALIZEDFREIGHTCHARGES_ISSET_ID = 8;
135
  private BitSet __isset_bit_vector = new BitSet(9);
136
 
137
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
138
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
139
        new FieldValueMetaData(TType.I64)));
140
    put(_Fields.PO_NUMBER, new FieldMetaData("poNumber", TFieldRequirementType.DEFAULT, 
141
        new FieldValueMetaData(TType.STRING)));
142
    put(_Fields.LINEITEMS, new FieldMetaData("lineitems", TFieldRequirementType.DEFAULT, 
143
        new ListMetaData(TType.LIST, 
144
            new StructMetaData(TType.STRUCT, LineItem.class))));
145
    put(_Fields.SUPPLIER_ID, new FieldMetaData("supplierId", TFieldRequirementType.DEFAULT, 
146
        new FieldValueMetaData(TType.I64)));
147
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
148
        new FieldValueMetaData(TType.I64)));
149
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
150
        new EnumMetaData(TType.ENUM, POStatus.class)));
151
    put(_Fields.CREATED_AT, new FieldMetaData("createdAt", TFieldRequirementType.DEFAULT, 
152
        new FieldValueMetaData(TType.I64)));
153
    put(_Fields.UPDATED_AT, new FieldMetaData("updatedAt", TFieldRequirementType.DEFAULT, 
154
        new FieldValueMetaData(TType.I64)));
155
    put(_Fields.TOTAL_COST, new FieldMetaData("totalCost", TFieldRequirementType.DEFAULT, 
156
        new FieldValueMetaData(TType.DOUBLE)));
157
    put(_Fields.FREIGHT_CHARGES, new FieldMetaData("freightCharges", TFieldRequirementType.DEFAULT, 
158
        new FieldValueMetaData(TType.DOUBLE)));
159
    put(_Fields.REALIZED_COST, new FieldMetaData("realizedCost", TFieldRequirementType.DEFAULT, 
160
        new FieldValueMetaData(TType.DOUBLE)));
161
    put(_Fields.REALIZED_FREIGHT_CHARGES, new FieldMetaData("realizedFreightCharges", TFieldRequirementType.DEFAULT, 
162
        new FieldValueMetaData(TType.DOUBLE)));
163
  }});
164
 
165
  static {
166
    FieldMetaData.addStructMetaDataMap(PurchaseOrder.class, metaDataMap);
167
  }
168
 
169
  public PurchaseOrder() {
170
  }
171
 
172
  public PurchaseOrder(
173
    long id,
174
    String poNumber,
175
    List<LineItem> lineitems,
176
    long supplierId,
177
    long warehouseId,
178
    POStatus status,
179
    long createdAt,
180
    long updatedAt,
181
    double totalCost,
182
    double freightCharges,
183
    double realizedCost,
184
    double realizedFreightCharges)
185
  {
186
    this();
187
    this.id = id;
188
    setIdIsSet(true);
189
    this.poNumber = poNumber;
190
    this.lineitems = lineitems;
191
    this.supplierId = supplierId;
192
    setSupplierIdIsSet(true);
193
    this.warehouseId = warehouseId;
194
    setWarehouseIdIsSet(true);
195
    this.status = status;
196
    this.createdAt = createdAt;
197
    setCreatedAtIsSet(true);
198
    this.updatedAt = updatedAt;
199
    setUpdatedAtIsSet(true);
200
    this.totalCost = totalCost;
201
    setTotalCostIsSet(true);
202
    this.freightCharges = freightCharges;
203
    setFreightChargesIsSet(true);
204
    this.realizedCost = realizedCost;
205
    setRealizedCostIsSet(true);
206
    this.realizedFreightCharges = realizedFreightCharges;
207
    setRealizedFreightChargesIsSet(true);
208
  }
209
 
210
  /**
211
   * Performs a deep copy on <i>other</i>.
212
   */
213
  public PurchaseOrder(PurchaseOrder other) {
214
    __isset_bit_vector.clear();
215
    __isset_bit_vector.or(other.__isset_bit_vector);
216
    this.id = other.id;
217
    if (other.isSetPoNumber()) {
218
      this.poNumber = other.poNumber;
219
    }
220
    if (other.isSetLineitems()) {
221
      List<LineItem> __this__lineitems = new ArrayList<LineItem>();
222
      for (LineItem other_element : other.lineitems) {
223
        __this__lineitems.add(new LineItem(other_element));
224
      }
225
      this.lineitems = __this__lineitems;
226
    }
227
    this.supplierId = other.supplierId;
228
    this.warehouseId = other.warehouseId;
229
    if (other.isSetStatus()) {
230
      this.status = other.status;
231
    }
232
    this.createdAt = other.createdAt;
233
    this.updatedAt = other.updatedAt;
234
    this.totalCost = other.totalCost;
235
    this.freightCharges = other.freightCharges;
236
    this.realizedCost = other.realizedCost;
237
    this.realizedFreightCharges = other.realizedFreightCharges;
238
  }
239
 
240
  public PurchaseOrder deepCopy() {
241
    return new PurchaseOrder(this);
242
  }
243
 
244
  @Deprecated
245
  public PurchaseOrder clone() {
246
    return new PurchaseOrder(this);
247
  }
248
 
249
  public long getId() {
250
    return this.id;
251
  }
252
 
253
  public PurchaseOrder setId(long id) {
254
    this.id = id;
255
    setIdIsSet(true);
256
    return this;
257
  }
258
 
259
  public void unsetId() {
260
    __isset_bit_vector.clear(__ID_ISSET_ID);
261
  }
262
 
263
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
264
  public boolean isSetId() {
265
    return __isset_bit_vector.get(__ID_ISSET_ID);
266
  }
267
 
268
  public void setIdIsSet(boolean value) {
269
    __isset_bit_vector.set(__ID_ISSET_ID, value);
270
  }
271
 
272
  public String getPoNumber() {
273
    return this.poNumber;
274
  }
275
 
276
  public PurchaseOrder setPoNumber(String poNumber) {
277
    this.poNumber = poNumber;
278
    return this;
279
  }
280
 
281
  public void unsetPoNumber() {
282
    this.poNumber = null;
283
  }
284
 
285
  /** Returns true if field poNumber is set (has been asigned a value) and false otherwise */
286
  public boolean isSetPoNumber() {
287
    return this.poNumber != null;
288
  }
289
 
290
  public void setPoNumberIsSet(boolean value) {
291
    if (!value) {
292
      this.poNumber = null;
293
    }
294
  }
295
 
296
  public int getLineitemsSize() {
297
    return (this.lineitems == null) ? 0 : this.lineitems.size();
298
  }
299
 
300
  public java.util.Iterator<LineItem> getLineitemsIterator() {
301
    return (this.lineitems == null) ? null : this.lineitems.iterator();
302
  }
303
 
304
  public void addToLineitems(LineItem elem) {
305
    if (this.lineitems == null) {
306
      this.lineitems = new ArrayList<LineItem>();
307
    }
308
    this.lineitems.add(elem);
309
  }
310
 
311
  public List<LineItem> getLineitems() {
312
    return this.lineitems;
313
  }
314
 
315
  public PurchaseOrder setLineitems(List<LineItem> lineitems) {
316
    this.lineitems = lineitems;
317
    return this;
318
  }
319
 
320
  public void unsetLineitems() {
321
    this.lineitems = null;
322
  }
323
 
324
  /** Returns true if field lineitems is set (has been asigned a value) and false otherwise */
325
  public boolean isSetLineitems() {
326
    return this.lineitems != null;
327
  }
328
 
329
  public void setLineitemsIsSet(boolean value) {
330
    if (!value) {
331
      this.lineitems = null;
332
    }
333
  }
334
 
335
  public long getSupplierId() {
336
    return this.supplierId;
337
  }
338
 
339
  public PurchaseOrder setSupplierId(long supplierId) {
340
    this.supplierId = supplierId;
341
    setSupplierIdIsSet(true);
342
    return this;
343
  }
344
 
345
  public void unsetSupplierId() {
346
    __isset_bit_vector.clear(__SUPPLIERID_ISSET_ID);
347
  }
348
 
349
  /** Returns true if field supplierId is set (has been asigned a value) and false otherwise */
350
  public boolean isSetSupplierId() {
351
    return __isset_bit_vector.get(__SUPPLIERID_ISSET_ID);
352
  }
353
 
354
  public void setSupplierIdIsSet(boolean value) {
355
    __isset_bit_vector.set(__SUPPLIERID_ISSET_ID, value);
356
  }
357
 
358
  public long getWarehouseId() {
359
    return this.warehouseId;
360
  }
361
 
362
  public PurchaseOrder setWarehouseId(long warehouseId) {
363
    this.warehouseId = warehouseId;
364
    setWarehouseIdIsSet(true);
365
    return this;
366
  }
367
 
368
  public void unsetWarehouseId() {
369
    __isset_bit_vector.clear(__WAREHOUSEID_ISSET_ID);
370
  }
371
 
372
  /** Returns true if field warehouseId is set (has been asigned a value) and false otherwise */
373
  public boolean isSetWarehouseId() {
374
    return __isset_bit_vector.get(__WAREHOUSEID_ISSET_ID);
375
  }
376
 
377
  public void setWarehouseIdIsSet(boolean value) {
378
    __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
379
  }
380
 
381
  /**
382
   * 
383
   * @see POStatus
384
   */
385
  public POStatus getStatus() {
386
    return this.status;
387
  }
388
 
389
  /**
390
   * 
391
   * @see POStatus
392
   */
393
  public PurchaseOrder setStatus(POStatus status) {
394
    this.status = status;
395
    return this;
396
  }
397
 
398
  public void unsetStatus() {
399
    this.status = null;
400
  }
401
 
402
  /** Returns true if field status is set (has been asigned a value) and false otherwise */
403
  public boolean isSetStatus() {
404
    return this.status != null;
405
  }
406
 
407
  public void setStatusIsSet(boolean value) {
408
    if (!value) {
409
      this.status = null;
410
    }
411
  }
412
 
413
  public long getCreatedAt() {
414
    return this.createdAt;
415
  }
416
 
417
  public PurchaseOrder setCreatedAt(long createdAt) {
418
    this.createdAt = createdAt;
419
    setCreatedAtIsSet(true);
420
    return this;
421
  }
422
 
423
  public void unsetCreatedAt() {
424
    __isset_bit_vector.clear(__CREATEDAT_ISSET_ID);
425
  }
426
 
427
  /** Returns true if field createdAt is set (has been asigned a value) and false otherwise */
428
  public boolean isSetCreatedAt() {
429
    return __isset_bit_vector.get(__CREATEDAT_ISSET_ID);
430
  }
431
 
432
  public void setCreatedAtIsSet(boolean value) {
433
    __isset_bit_vector.set(__CREATEDAT_ISSET_ID, value);
434
  }
435
 
436
  public long getUpdatedAt() {
437
    return this.updatedAt;
438
  }
439
 
440
  public PurchaseOrder setUpdatedAt(long updatedAt) {
441
    this.updatedAt = updatedAt;
442
    setUpdatedAtIsSet(true);
443
    return this;
444
  }
445
 
446
  public void unsetUpdatedAt() {
447
    __isset_bit_vector.clear(__UPDATEDAT_ISSET_ID);
448
  }
449
 
450
  /** Returns true if field updatedAt is set (has been asigned a value) and false otherwise */
451
  public boolean isSetUpdatedAt() {
452
    return __isset_bit_vector.get(__UPDATEDAT_ISSET_ID);
453
  }
454
 
455
  public void setUpdatedAtIsSet(boolean value) {
456
    __isset_bit_vector.set(__UPDATEDAT_ISSET_ID, value);
457
  }
458
 
459
  public double getTotalCost() {
460
    return this.totalCost;
461
  }
462
 
463
  public PurchaseOrder setTotalCost(double totalCost) {
464
    this.totalCost = totalCost;
465
    setTotalCostIsSet(true);
466
    return this;
467
  }
468
 
469
  public void unsetTotalCost() {
470
    __isset_bit_vector.clear(__TOTALCOST_ISSET_ID);
471
  }
472
 
473
  /** Returns true if field totalCost is set (has been asigned a value) and false otherwise */
474
  public boolean isSetTotalCost() {
475
    return __isset_bit_vector.get(__TOTALCOST_ISSET_ID);
476
  }
477
 
478
  public void setTotalCostIsSet(boolean value) {
479
    __isset_bit_vector.set(__TOTALCOST_ISSET_ID, value);
480
  }
481
 
482
  public double getFreightCharges() {
483
    return this.freightCharges;
484
  }
485
 
486
  public PurchaseOrder setFreightCharges(double freightCharges) {
487
    this.freightCharges = freightCharges;
488
    setFreightChargesIsSet(true);
489
    return this;
490
  }
491
 
492
  public void unsetFreightCharges() {
493
    __isset_bit_vector.clear(__FREIGHTCHARGES_ISSET_ID);
494
  }
495
 
496
  /** Returns true if field freightCharges is set (has been asigned a value) and false otherwise */
497
  public boolean isSetFreightCharges() {
498
    return __isset_bit_vector.get(__FREIGHTCHARGES_ISSET_ID);
499
  }
500
 
501
  public void setFreightChargesIsSet(boolean value) {
502
    __isset_bit_vector.set(__FREIGHTCHARGES_ISSET_ID, value);
503
  }
504
 
505
  public double getRealizedCost() {
506
    return this.realizedCost;
507
  }
508
 
509
  public PurchaseOrder setRealizedCost(double realizedCost) {
510
    this.realizedCost = realizedCost;
511
    setRealizedCostIsSet(true);
512
    return this;
513
  }
514
 
515
  public void unsetRealizedCost() {
516
    __isset_bit_vector.clear(__REALIZEDCOST_ISSET_ID);
517
  }
518
 
519
  /** Returns true if field realizedCost is set (has been asigned a value) and false otherwise */
520
  public boolean isSetRealizedCost() {
521
    return __isset_bit_vector.get(__REALIZEDCOST_ISSET_ID);
522
  }
523
 
524
  public void setRealizedCostIsSet(boolean value) {
525
    __isset_bit_vector.set(__REALIZEDCOST_ISSET_ID, value);
526
  }
527
 
528
  public double getRealizedFreightCharges() {
529
    return this.realizedFreightCharges;
530
  }
531
 
532
  public PurchaseOrder setRealizedFreightCharges(double realizedFreightCharges) {
533
    this.realizedFreightCharges = realizedFreightCharges;
534
    setRealizedFreightChargesIsSet(true);
535
    return this;
536
  }
537
 
538
  public void unsetRealizedFreightCharges() {
539
    __isset_bit_vector.clear(__REALIZEDFREIGHTCHARGES_ISSET_ID);
540
  }
541
 
542
  /** Returns true if field realizedFreightCharges is set (has been asigned a value) and false otherwise */
543
  public boolean isSetRealizedFreightCharges() {
544
    return __isset_bit_vector.get(__REALIZEDFREIGHTCHARGES_ISSET_ID);
545
  }
546
 
547
  public void setRealizedFreightChargesIsSet(boolean value) {
548
    __isset_bit_vector.set(__REALIZEDFREIGHTCHARGES_ISSET_ID, value);
549
  }
550
 
551
  public void setFieldValue(_Fields field, Object value) {
552
    switch (field) {
553
    case ID:
554
      if (value == null) {
555
        unsetId();
556
      } else {
557
        setId((Long)value);
558
      }
559
      break;
560
 
561
    case PO_NUMBER:
562
      if (value == null) {
563
        unsetPoNumber();
564
      } else {
565
        setPoNumber((String)value);
566
      }
567
      break;
568
 
569
    case LINEITEMS:
570
      if (value == null) {
571
        unsetLineitems();
572
      } else {
573
        setLineitems((List<LineItem>)value);
574
      }
575
      break;
576
 
577
    case SUPPLIER_ID:
578
      if (value == null) {
579
        unsetSupplierId();
580
      } else {
581
        setSupplierId((Long)value);
582
      }
583
      break;
584
 
585
    case WAREHOUSE_ID:
586
      if (value == null) {
587
        unsetWarehouseId();
588
      } else {
589
        setWarehouseId((Long)value);
590
      }
591
      break;
592
 
593
    case STATUS:
594
      if (value == null) {
595
        unsetStatus();
596
      } else {
597
        setStatus((POStatus)value);
598
      }
599
      break;
600
 
601
    case CREATED_AT:
602
      if (value == null) {
603
        unsetCreatedAt();
604
      } else {
605
        setCreatedAt((Long)value);
606
      }
607
      break;
608
 
609
    case UPDATED_AT:
610
      if (value == null) {
611
        unsetUpdatedAt();
612
      } else {
613
        setUpdatedAt((Long)value);
614
      }
615
      break;
616
 
617
    case TOTAL_COST:
618
      if (value == null) {
619
        unsetTotalCost();
620
      } else {
621
        setTotalCost((Double)value);
622
      }
623
      break;
624
 
625
    case FREIGHT_CHARGES:
626
      if (value == null) {
627
        unsetFreightCharges();
628
      } else {
629
        setFreightCharges((Double)value);
630
      }
631
      break;
632
 
633
    case REALIZED_COST:
634
      if (value == null) {
635
        unsetRealizedCost();
636
      } else {
637
        setRealizedCost((Double)value);
638
      }
639
      break;
640
 
641
    case REALIZED_FREIGHT_CHARGES:
642
      if (value == null) {
643
        unsetRealizedFreightCharges();
644
      } else {
645
        setRealizedFreightCharges((Double)value);
646
      }
647
      break;
648
 
649
    }
650
  }
651
 
652
  public void setFieldValue(int fieldID, Object value) {
653
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
654
  }
655
 
656
  public Object getFieldValue(_Fields field) {
657
    switch (field) {
658
    case ID:
659
      return new Long(getId());
660
 
661
    case PO_NUMBER:
662
      return getPoNumber();
663
 
664
    case LINEITEMS:
665
      return getLineitems();
666
 
667
    case SUPPLIER_ID:
668
      return new Long(getSupplierId());
669
 
670
    case WAREHOUSE_ID:
671
      return new Long(getWarehouseId());
672
 
673
    case STATUS:
674
      return getStatus();
675
 
676
    case CREATED_AT:
677
      return new Long(getCreatedAt());
678
 
679
    case UPDATED_AT:
680
      return new Long(getUpdatedAt());
681
 
682
    case TOTAL_COST:
683
      return new Double(getTotalCost());
684
 
685
    case FREIGHT_CHARGES:
686
      return new Double(getFreightCharges());
687
 
688
    case REALIZED_COST:
689
      return new Double(getRealizedCost());
690
 
691
    case REALIZED_FREIGHT_CHARGES:
692
      return new Double(getRealizedFreightCharges());
693
 
694
    }
695
    throw new IllegalStateException();
696
  }
697
 
698
  public Object getFieldValue(int fieldId) {
699
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
700
  }
701
 
702
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
703
  public boolean isSet(_Fields field) {
704
    switch (field) {
705
    case ID:
706
      return isSetId();
707
    case PO_NUMBER:
708
      return isSetPoNumber();
709
    case LINEITEMS:
710
      return isSetLineitems();
711
    case SUPPLIER_ID:
712
      return isSetSupplierId();
713
    case WAREHOUSE_ID:
714
      return isSetWarehouseId();
715
    case STATUS:
716
      return isSetStatus();
717
    case CREATED_AT:
718
      return isSetCreatedAt();
719
    case UPDATED_AT:
720
      return isSetUpdatedAt();
721
    case TOTAL_COST:
722
      return isSetTotalCost();
723
    case FREIGHT_CHARGES:
724
      return isSetFreightCharges();
725
    case REALIZED_COST:
726
      return isSetRealizedCost();
727
    case REALIZED_FREIGHT_CHARGES:
728
      return isSetRealizedFreightCharges();
729
    }
730
    throw new IllegalStateException();
731
  }
732
 
733
  public boolean isSet(int fieldID) {
734
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
735
  }
736
 
737
  @Override
738
  public boolean equals(Object that) {
739
    if (that == null)
740
      return false;
741
    if (that instanceof PurchaseOrder)
742
      return this.equals((PurchaseOrder)that);
743
    return false;
744
  }
745
 
746
  public boolean equals(PurchaseOrder that) {
747
    if (that == null)
748
      return false;
749
 
750
    boolean this_present_id = true;
751
    boolean that_present_id = true;
752
    if (this_present_id || that_present_id) {
753
      if (!(this_present_id && that_present_id))
754
        return false;
755
      if (this.id != that.id)
756
        return false;
757
    }
758
 
759
    boolean this_present_poNumber = true && this.isSetPoNumber();
760
    boolean that_present_poNumber = true && that.isSetPoNumber();
761
    if (this_present_poNumber || that_present_poNumber) {
762
      if (!(this_present_poNumber && that_present_poNumber))
763
        return false;
764
      if (!this.poNumber.equals(that.poNumber))
765
        return false;
766
    }
767
 
768
    boolean this_present_lineitems = true && this.isSetLineitems();
769
    boolean that_present_lineitems = true && that.isSetLineitems();
770
    if (this_present_lineitems || that_present_lineitems) {
771
      if (!(this_present_lineitems && that_present_lineitems))
772
        return false;
773
      if (!this.lineitems.equals(that.lineitems))
774
        return false;
775
    }
776
 
777
    boolean this_present_supplierId = true;
778
    boolean that_present_supplierId = true;
779
    if (this_present_supplierId || that_present_supplierId) {
780
      if (!(this_present_supplierId && that_present_supplierId))
781
        return false;
782
      if (this.supplierId != that.supplierId)
783
        return false;
784
    }
785
 
786
    boolean this_present_warehouseId = true;
787
    boolean that_present_warehouseId = true;
788
    if (this_present_warehouseId || that_present_warehouseId) {
789
      if (!(this_present_warehouseId && that_present_warehouseId))
790
        return false;
791
      if (this.warehouseId != that.warehouseId)
792
        return false;
793
    }
794
 
795
    boolean this_present_status = true && this.isSetStatus();
796
    boolean that_present_status = true && that.isSetStatus();
797
    if (this_present_status || that_present_status) {
798
      if (!(this_present_status && that_present_status))
799
        return false;
800
      if (!this.status.equals(that.status))
801
        return false;
802
    }
803
 
804
    boolean this_present_createdAt = true;
805
    boolean that_present_createdAt = true;
806
    if (this_present_createdAt || that_present_createdAt) {
807
      if (!(this_present_createdAt && that_present_createdAt))
808
        return false;
809
      if (this.createdAt != that.createdAt)
810
        return false;
811
    }
812
 
813
    boolean this_present_updatedAt = true;
814
    boolean that_present_updatedAt = true;
815
    if (this_present_updatedAt || that_present_updatedAt) {
816
      if (!(this_present_updatedAt && that_present_updatedAt))
817
        return false;
818
      if (this.updatedAt != that.updatedAt)
819
        return false;
820
    }
821
 
822
    boolean this_present_totalCost = true;
823
    boolean that_present_totalCost = true;
824
    if (this_present_totalCost || that_present_totalCost) {
825
      if (!(this_present_totalCost && that_present_totalCost))
826
        return false;
827
      if (this.totalCost != that.totalCost)
828
        return false;
829
    }
830
 
831
    boolean this_present_freightCharges = true;
832
    boolean that_present_freightCharges = true;
833
    if (this_present_freightCharges || that_present_freightCharges) {
834
      if (!(this_present_freightCharges && that_present_freightCharges))
835
        return false;
836
      if (this.freightCharges != that.freightCharges)
837
        return false;
838
    }
839
 
840
    boolean this_present_realizedCost = true;
841
    boolean that_present_realizedCost = true;
842
    if (this_present_realizedCost || that_present_realizedCost) {
843
      if (!(this_present_realizedCost && that_present_realizedCost))
844
        return false;
845
      if (this.realizedCost != that.realizedCost)
846
        return false;
847
    }
848
 
849
    boolean this_present_realizedFreightCharges = true;
850
    boolean that_present_realizedFreightCharges = true;
851
    if (this_present_realizedFreightCharges || that_present_realizedFreightCharges) {
852
      if (!(this_present_realizedFreightCharges && that_present_realizedFreightCharges))
853
        return false;
854
      if (this.realizedFreightCharges != that.realizedFreightCharges)
855
        return false;
856
    }
857
 
858
    return true;
859
  }
860
 
861
  @Override
862
  public int hashCode() {
863
    return 0;
864
  }
865
 
866
  public int compareTo(PurchaseOrder other) {
867
    if (!getClass().equals(other.getClass())) {
868
      return getClass().getName().compareTo(other.getClass().getName());
869
    }
870
 
871
    int lastComparison = 0;
872
    PurchaseOrder typedOther = (PurchaseOrder)other;
873
 
874
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
875
    if (lastComparison != 0) {
876
      return lastComparison;
877
    }
878
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
879
    if (lastComparison != 0) {
880
      return lastComparison;
881
    }
882
    lastComparison = Boolean.valueOf(isSetPoNumber()).compareTo(isSetPoNumber());
883
    if (lastComparison != 0) {
884
      return lastComparison;
885
    }
886
    lastComparison = TBaseHelper.compareTo(poNumber, typedOther.poNumber);
887
    if (lastComparison != 0) {
888
      return lastComparison;
889
    }
890
    lastComparison = Boolean.valueOf(isSetLineitems()).compareTo(isSetLineitems());
891
    if (lastComparison != 0) {
892
      return lastComparison;
893
    }
894
    lastComparison = TBaseHelper.compareTo(lineitems, typedOther.lineitems);
895
    if (lastComparison != 0) {
896
      return lastComparison;
897
    }
898
    lastComparison = Boolean.valueOf(isSetSupplierId()).compareTo(isSetSupplierId());
899
    if (lastComparison != 0) {
900
      return lastComparison;
901
    }
902
    lastComparison = TBaseHelper.compareTo(supplierId, typedOther.supplierId);
903
    if (lastComparison != 0) {
904
      return lastComparison;
905
    }
906
    lastComparison = Boolean.valueOf(isSetWarehouseId()).compareTo(isSetWarehouseId());
907
    if (lastComparison != 0) {
908
      return lastComparison;
909
    }
910
    lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
911
    if (lastComparison != 0) {
912
      return lastComparison;
913
    }
914
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
915
    if (lastComparison != 0) {
916
      return lastComparison;
917
    }
918
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
919
    if (lastComparison != 0) {
920
      return lastComparison;
921
    }
922
    lastComparison = Boolean.valueOf(isSetCreatedAt()).compareTo(isSetCreatedAt());
923
    if (lastComparison != 0) {
924
      return lastComparison;
925
    }
926
    lastComparison = TBaseHelper.compareTo(createdAt, typedOther.createdAt);
927
    if (lastComparison != 0) {
928
      return lastComparison;
929
    }
930
    lastComparison = Boolean.valueOf(isSetUpdatedAt()).compareTo(isSetUpdatedAt());
931
    if (lastComparison != 0) {
932
      return lastComparison;
933
    }
934
    lastComparison = TBaseHelper.compareTo(updatedAt, typedOther.updatedAt);
935
    if (lastComparison != 0) {
936
      return lastComparison;
937
    }
938
    lastComparison = Boolean.valueOf(isSetTotalCost()).compareTo(isSetTotalCost());
939
    if (lastComparison != 0) {
940
      return lastComparison;
941
    }
942
    lastComparison = TBaseHelper.compareTo(totalCost, typedOther.totalCost);
943
    if (lastComparison != 0) {
944
      return lastComparison;
945
    }
946
    lastComparison = Boolean.valueOf(isSetFreightCharges()).compareTo(isSetFreightCharges());
947
    if (lastComparison != 0) {
948
      return lastComparison;
949
    }
950
    lastComparison = TBaseHelper.compareTo(freightCharges, typedOther.freightCharges);
951
    if (lastComparison != 0) {
952
      return lastComparison;
953
    }
954
    lastComparison = Boolean.valueOf(isSetRealizedCost()).compareTo(isSetRealizedCost());
955
    if (lastComparison != 0) {
956
      return lastComparison;
957
    }
958
    lastComparison = TBaseHelper.compareTo(realizedCost, typedOther.realizedCost);
959
    if (lastComparison != 0) {
960
      return lastComparison;
961
    }
962
    lastComparison = Boolean.valueOf(isSetRealizedFreightCharges()).compareTo(isSetRealizedFreightCharges());
963
    if (lastComparison != 0) {
964
      return lastComparison;
965
    }
966
    lastComparison = TBaseHelper.compareTo(realizedFreightCharges, typedOther.realizedFreightCharges);
967
    if (lastComparison != 0) {
968
      return lastComparison;
969
    }
970
    return 0;
971
  }
972
 
973
  public void read(TProtocol iprot) throws TException {
974
    TField field;
975
    iprot.readStructBegin();
976
    while (true)
977
    {
978
      field = iprot.readFieldBegin();
979
      if (field.type == TType.STOP) { 
980
        break;
981
      }
982
      _Fields fieldId = _Fields.findByThriftId(field.id);
983
      if (fieldId == null) {
984
        TProtocolUtil.skip(iprot, field.type);
985
      } else {
986
        switch (fieldId) {
987
          case ID:
988
            if (field.type == TType.I64) {
989
              this.id = iprot.readI64();
990
              setIdIsSet(true);
991
            } else { 
992
              TProtocolUtil.skip(iprot, field.type);
993
            }
994
            break;
995
          case PO_NUMBER:
996
            if (field.type == TType.STRING) {
997
              this.poNumber = iprot.readString();
998
            } else { 
999
              TProtocolUtil.skip(iprot, field.type);
1000
            }
1001
            break;
1002
          case LINEITEMS:
1003
            if (field.type == TType.LIST) {
1004
              {
1005
                TList _list0 = iprot.readListBegin();
1006
                this.lineitems = new ArrayList<LineItem>(_list0.size);
1007
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
1008
                {
1009
                  LineItem _elem2;
1010
                  _elem2 = new LineItem();
1011
                  _elem2.read(iprot);
1012
                  this.lineitems.add(_elem2);
1013
                }
1014
                iprot.readListEnd();
1015
              }
1016
            } else { 
1017
              TProtocolUtil.skip(iprot, field.type);
1018
            }
1019
            break;
1020
          case SUPPLIER_ID:
1021
            if (field.type == TType.I64) {
1022
              this.supplierId = iprot.readI64();
1023
              setSupplierIdIsSet(true);
1024
            } else { 
1025
              TProtocolUtil.skip(iprot, field.type);
1026
            }
1027
            break;
1028
          case WAREHOUSE_ID:
1029
            if (field.type == TType.I64) {
1030
              this.warehouseId = iprot.readI64();
1031
              setWarehouseIdIsSet(true);
1032
            } else { 
1033
              TProtocolUtil.skip(iprot, field.type);
1034
            }
1035
            break;
1036
          case STATUS:
1037
            if (field.type == TType.I32) {
1038
              this.status = POStatus.findByValue(iprot.readI32());
1039
            } else { 
1040
              TProtocolUtil.skip(iprot, field.type);
1041
            }
1042
            break;
1043
          case CREATED_AT:
1044
            if (field.type == TType.I64) {
1045
              this.createdAt = iprot.readI64();
1046
              setCreatedAtIsSet(true);
1047
            } else { 
1048
              TProtocolUtil.skip(iprot, field.type);
1049
            }
1050
            break;
1051
          case UPDATED_AT:
1052
            if (field.type == TType.I64) {
1053
              this.updatedAt = iprot.readI64();
1054
              setUpdatedAtIsSet(true);
1055
            } else { 
1056
              TProtocolUtil.skip(iprot, field.type);
1057
            }
1058
            break;
1059
          case TOTAL_COST:
1060
            if (field.type == TType.DOUBLE) {
1061
              this.totalCost = iprot.readDouble();
1062
              setTotalCostIsSet(true);
1063
            } else { 
1064
              TProtocolUtil.skip(iprot, field.type);
1065
            }
1066
            break;
1067
          case FREIGHT_CHARGES:
1068
            if (field.type == TType.DOUBLE) {
1069
              this.freightCharges = iprot.readDouble();
1070
              setFreightChargesIsSet(true);
1071
            } else { 
1072
              TProtocolUtil.skip(iprot, field.type);
1073
            }
1074
            break;
1075
          case REALIZED_COST:
1076
            if (field.type == TType.DOUBLE) {
1077
              this.realizedCost = iprot.readDouble();
1078
              setRealizedCostIsSet(true);
1079
            } else { 
1080
              TProtocolUtil.skip(iprot, field.type);
1081
            }
1082
            break;
1083
          case REALIZED_FREIGHT_CHARGES:
1084
            if (field.type == TType.DOUBLE) {
1085
              this.realizedFreightCharges = iprot.readDouble();
1086
              setRealizedFreightChargesIsSet(true);
1087
            } else { 
1088
              TProtocolUtil.skip(iprot, field.type);
1089
            }
1090
            break;
1091
        }
1092
        iprot.readFieldEnd();
1093
      }
1094
    }
1095
    iprot.readStructEnd();
1096
    validate();
1097
  }
1098
 
1099
  public void write(TProtocol oprot) throws TException {
1100
    validate();
1101
 
1102
    oprot.writeStructBegin(STRUCT_DESC);
1103
    oprot.writeFieldBegin(ID_FIELD_DESC);
1104
    oprot.writeI64(this.id);
1105
    oprot.writeFieldEnd();
1106
    if (this.poNumber != null) {
1107
      oprot.writeFieldBegin(PO_NUMBER_FIELD_DESC);
1108
      oprot.writeString(this.poNumber);
1109
      oprot.writeFieldEnd();
1110
    }
1111
    if (this.lineitems != null) {
1112
      oprot.writeFieldBegin(LINEITEMS_FIELD_DESC);
1113
      {
1114
        oprot.writeListBegin(new TList(TType.STRUCT, this.lineitems.size()));
1115
        for (LineItem _iter3 : this.lineitems)
1116
        {
1117
          _iter3.write(oprot);
1118
        }
1119
        oprot.writeListEnd();
1120
      }
1121
      oprot.writeFieldEnd();
1122
    }
1123
    oprot.writeFieldBegin(SUPPLIER_ID_FIELD_DESC);
1124
    oprot.writeI64(this.supplierId);
1125
    oprot.writeFieldEnd();
1126
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
1127
    oprot.writeI64(this.warehouseId);
1128
    oprot.writeFieldEnd();
1129
    if (this.status != null) {
1130
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
1131
      oprot.writeI32(this.status.getValue());
1132
      oprot.writeFieldEnd();
1133
    }
1134
    oprot.writeFieldBegin(CREATED_AT_FIELD_DESC);
1135
    oprot.writeI64(this.createdAt);
1136
    oprot.writeFieldEnd();
1137
    oprot.writeFieldBegin(UPDATED_AT_FIELD_DESC);
1138
    oprot.writeI64(this.updatedAt);
1139
    oprot.writeFieldEnd();
1140
    oprot.writeFieldBegin(TOTAL_COST_FIELD_DESC);
1141
    oprot.writeDouble(this.totalCost);
1142
    oprot.writeFieldEnd();
1143
    oprot.writeFieldBegin(FREIGHT_CHARGES_FIELD_DESC);
1144
    oprot.writeDouble(this.freightCharges);
1145
    oprot.writeFieldEnd();
1146
    oprot.writeFieldBegin(REALIZED_COST_FIELD_DESC);
1147
    oprot.writeDouble(this.realizedCost);
1148
    oprot.writeFieldEnd();
1149
    oprot.writeFieldBegin(REALIZED_FREIGHT_CHARGES_FIELD_DESC);
1150
    oprot.writeDouble(this.realizedFreightCharges);
1151
    oprot.writeFieldEnd();
1152
    oprot.writeFieldStop();
1153
    oprot.writeStructEnd();
1154
  }
1155
 
1156
  @Override
1157
  public String toString() {
1158
    StringBuilder sb = new StringBuilder("PurchaseOrder(");
1159
    boolean first = true;
1160
 
1161
    sb.append("id:");
1162
    sb.append(this.id);
1163
    first = false;
1164
    if (!first) sb.append(", ");
1165
    sb.append("poNumber:");
1166
    if (this.poNumber == null) {
1167
      sb.append("null");
1168
    } else {
1169
      sb.append(this.poNumber);
1170
    }
1171
    first = false;
1172
    if (!first) sb.append(", ");
1173
    sb.append("lineitems:");
1174
    if (this.lineitems == null) {
1175
      sb.append("null");
1176
    } else {
1177
      sb.append(this.lineitems);
1178
    }
1179
    first = false;
1180
    if (!first) sb.append(", ");
1181
    sb.append("supplierId:");
1182
    sb.append(this.supplierId);
1183
    first = false;
1184
    if (!first) sb.append(", ");
1185
    sb.append("warehouseId:");
1186
    sb.append(this.warehouseId);
1187
    first = false;
1188
    if (!first) sb.append(", ");
1189
    sb.append("status:");
1190
    if (this.status == null) {
1191
      sb.append("null");
1192
    } else {
1193
      String status_name = status.name();
1194
      if (status_name != null) {
1195
        sb.append(status_name);
1196
        sb.append(" (");
1197
      }
1198
      sb.append(this.status);
1199
      if (status_name != null) {
1200
        sb.append(")");
1201
      }
1202
    }
1203
    first = false;
1204
    if (!first) sb.append(", ");
1205
    sb.append("createdAt:");
1206
    sb.append(this.createdAt);
1207
    first = false;
1208
    if (!first) sb.append(", ");
1209
    sb.append("updatedAt:");
1210
    sb.append(this.updatedAt);
1211
    first = false;
1212
    if (!first) sb.append(", ");
1213
    sb.append("totalCost:");
1214
    sb.append(this.totalCost);
1215
    first = false;
1216
    if (!first) sb.append(", ");
1217
    sb.append("freightCharges:");
1218
    sb.append(this.freightCharges);
1219
    first = false;
1220
    if (!first) sb.append(", ");
1221
    sb.append("realizedCost:");
1222
    sb.append(this.realizedCost);
1223
    first = false;
1224
    if (!first) sb.append(", ");
1225
    sb.append("realizedFreightCharges:");
1226
    sb.append(this.realizedFreightCharges);
1227
    first = false;
1228
    sb.append(")");
1229
    return sb.toString();
1230
  }
1231
 
1232
  public void validate() throws TException {
1233
    // check for required fields
1234
  }
1235
 
1236
}
1237