Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.order;
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 Shipment implements TBase<Shipment._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("Shipment");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField ADDRESS_FIELD_DESC = new TField("address", TType.STRING, (short)2);
31
  private static final TField TRACKING_ID_FIELD_DESC = new TField("trackingId", TType.STRING, (short)3);
32
  private static final TField LINE_ITEMS_FIELD_DESC = new TField("lineItems", TType.LIST, (short)4);
33
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)5);
34
  private static final TField SHIPMENT_TIMESTAMP_FIELD_DESC = new TField("shipmentTimestamp", TType.I64, (short)6);
35
  private static final TField DELIVERY_TIMESTAMP_FIELD_DESC = new TField("deliveryTimestamp", TType.I64, (short)7);
36
  private static final TField VALUE_FIELD_DESC = new TField("value", TType.DOUBLE, (short)8);
37
  private static final TField INSURANCE_FIELD_DESC = new TField("insurance", TType.DOUBLE, (short)9);
38
  private static final TField WEIGHT_FIELD_DESC = new TField("weight", TType.DOUBLE, (short)10);
39
  private static final TField AIRWAY_BILL_NO_FIELD_DESC = new TField("airwayBillNo", TType.STRING, (short)11);
40
  private static final TField PROVIDER_FIELD_DESC = new TField("provider", TType.STRING, (short)12);
41
 
42
  private long id;
43
  private String address;
44
  private String trackingId;
45
  private List<LineItem> lineItems;
46
  private ShipmentStatus status;
47
  private long shipmentTimestamp;
48
  private long deliveryTimestamp;
49
  private double value;
50
  private double insurance;
51
  private double weight;
52
  private String airwayBillNo;
53
  private String provider;
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
    ADDRESS((short)2, "address"),
59
    TRACKING_ID((short)3, "trackingId"),
60
    LINE_ITEMS((short)4, "lineItems"),
61
    /**
62
     * 
63
     * @see ShipmentStatus
64
     */
65
    STATUS((short)5, "status"),
66
    SHIPMENT_TIMESTAMP((short)6, "shipmentTimestamp"),
67
    DELIVERY_TIMESTAMP((short)7, "deliveryTimestamp"),
68
    VALUE((short)8, "value"),
69
    INSURANCE((short)9, "insurance"),
70
    WEIGHT((short)10, "weight"),
71
    AIRWAY_BILL_NO((short)11, "airwayBillNo"),
72
    PROVIDER((short)12, "provider");
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 __SHIPMENTTIMESTAMP_ISSET_ID = 1;
128
  private static final int __DELIVERYTIMESTAMP_ISSET_ID = 2;
129
  private static final int __VALUE_ISSET_ID = 3;
130
  private static final int __INSURANCE_ISSET_ID = 4;
131
  private static final int __WEIGHT_ISSET_ID = 5;
132
  private BitSet __isset_bit_vector = new BitSet(6);
133
 
134
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
135
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
136
        new FieldValueMetaData(TType.I64)));
137
    put(_Fields.ADDRESS, new FieldMetaData("address", TFieldRequirementType.DEFAULT, 
138
        new FieldValueMetaData(TType.STRING)));
139
    put(_Fields.TRACKING_ID, new FieldMetaData("trackingId", TFieldRequirementType.DEFAULT, 
140
        new FieldValueMetaData(TType.STRING)));
141
    put(_Fields.LINE_ITEMS, new FieldMetaData("lineItems", TFieldRequirementType.DEFAULT, 
142
        new ListMetaData(TType.LIST, 
143
            new StructMetaData(TType.STRUCT, LineItem.class))));
144
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
145
        new EnumMetaData(TType.ENUM, ShipmentStatus.class)));
146
    put(_Fields.SHIPMENT_TIMESTAMP, new FieldMetaData("shipmentTimestamp", TFieldRequirementType.DEFAULT, 
147
        new FieldValueMetaData(TType.I64)));
148
    put(_Fields.DELIVERY_TIMESTAMP, new FieldMetaData("deliveryTimestamp", TFieldRequirementType.DEFAULT, 
149
        new FieldValueMetaData(TType.I64)));
150
    put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT, 
151
        new FieldValueMetaData(TType.DOUBLE)));
152
    put(_Fields.INSURANCE, new FieldMetaData("insurance", TFieldRequirementType.DEFAULT, 
153
        new FieldValueMetaData(TType.DOUBLE)));
154
    put(_Fields.WEIGHT, new FieldMetaData("weight", TFieldRequirementType.DEFAULT, 
155
        new FieldValueMetaData(TType.DOUBLE)));
156
    put(_Fields.AIRWAY_BILL_NO, new FieldMetaData("airwayBillNo", TFieldRequirementType.DEFAULT, 
157
        new FieldValueMetaData(TType.STRING)));
158
    put(_Fields.PROVIDER, new FieldMetaData("provider", TFieldRequirementType.DEFAULT, 
159
        new FieldValueMetaData(TType.STRING)));
160
  }});
161
 
162
  static {
163
    FieldMetaData.addStructMetaDataMap(Shipment.class, metaDataMap);
164
  }
165
 
166
  public Shipment() {
167
  }
168
 
169
  public Shipment(
170
    long id,
171
    String address,
172
    String trackingId,
173
    List<LineItem> lineItems,
174
    ShipmentStatus status,
175
    long shipmentTimestamp,
176
    long deliveryTimestamp,
177
    double value,
178
    double insurance,
179
    double weight,
180
    String airwayBillNo,
181
    String provider)
182
  {
183
    this();
184
    this.id = id;
185
    setIdIsSet(true);
186
    this.address = address;
187
    this.trackingId = trackingId;
188
    this.lineItems = lineItems;
189
    this.status = status;
190
    this.shipmentTimestamp = shipmentTimestamp;
191
    setShipmentTimestampIsSet(true);
192
    this.deliveryTimestamp = deliveryTimestamp;
193
    setDeliveryTimestampIsSet(true);
194
    this.value = value;
195
    setValueIsSet(true);
196
    this.insurance = insurance;
197
    setInsuranceIsSet(true);
198
    this.weight = weight;
199
    setWeightIsSet(true);
200
    this.airwayBillNo = airwayBillNo;
201
    this.provider = provider;
202
  }
203
 
204
  /**
205
   * Performs a deep copy on <i>other</i>.
206
   */
207
  public Shipment(Shipment other) {
208
    __isset_bit_vector.clear();
209
    __isset_bit_vector.or(other.__isset_bit_vector);
210
    this.id = other.id;
211
    if (other.isSetAddress()) {
212
      this.address = other.address;
213
    }
214
    if (other.isSetTrackingId()) {
215
      this.trackingId = other.trackingId;
216
    }
217
    if (other.isSetLineItems()) {
218
      List<LineItem> __this__lineItems = new ArrayList<LineItem>();
219
      for (LineItem other_element : other.lineItems) {
220
        __this__lineItems.add(new LineItem(other_element));
221
      }
222
      this.lineItems = __this__lineItems;
223
    }
224
    if (other.isSetStatus()) {
225
      this.status = other.status;
226
    }
227
    this.shipmentTimestamp = other.shipmentTimestamp;
228
    this.deliveryTimestamp = other.deliveryTimestamp;
229
    this.value = other.value;
230
    this.insurance = other.insurance;
231
    this.weight = other.weight;
232
    if (other.isSetAirwayBillNo()) {
233
      this.airwayBillNo = other.airwayBillNo;
234
    }
235
    if (other.isSetProvider()) {
236
      this.provider = other.provider;
237
    }
238
  }
239
 
240
  public Shipment deepCopy() {
241
    return new Shipment(this);
242
  }
243
 
244
  @Deprecated
245
  public Shipment clone() {
246
    return new Shipment(this);
247
  }
248
 
249
  public long getId() {
250
    return this.id;
251
  }
252
 
253
  public Shipment 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 getAddress() {
273
    return this.address;
274
  }
275
 
276
  public Shipment setAddress(String address) {
277
    this.address = address;
278
    return this;
279
  }
280
 
281
  public void unsetAddress() {
282
    this.address = null;
283
  }
284
 
285
  /** Returns true if field address is set (has been asigned a value) and false otherwise */
286
  public boolean isSetAddress() {
287
    return this.address != null;
288
  }
289
 
290
  public void setAddressIsSet(boolean value) {
291
    if (!value) {
292
      this.address = null;
293
    }
294
  }
295
 
296
  public String getTrackingId() {
297
    return this.trackingId;
298
  }
299
 
300
  public Shipment setTrackingId(String trackingId) {
301
    this.trackingId = trackingId;
302
    return this;
303
  }
304
 
305
  public void unsetTrackingId() {
306
    this.trackingId = null;
307
  }
308
 
309
  /** Returns true if field trackingId is set (has been asigned a value) and false otherwise */
310
  public boolean isSetTrackingId() {
311
    return this.trackingId != null;
312
  }
313
 
314
  public void setTrackingIdIsSet(boolean value) {
315
    if (!value) {
316
      this.trackingId = null;
317
    }
318
  }
319
 
320
  public int getLineItemsSize() {
321
    return (this.lineItems == null) ? 0 : this.lineItems.size();
322
  }
323
 
324
  public java.util.Iterator<LineItem> getLineItemsIterator() {
325
    return (this.lineItems == null) ? null : this.lineItems.iterator();
326
  }
327
 
328
  public void addToLineItems(LineItem elem) {
329
    if (this.lineItems == null) {
330
      this.lineItems = new ArrayList<LineItem>();
331
    }
332
    this.lineItems.add(elem);
333
  }
334
 
335
  public List<LineItem> getLineItems() {
336
    return this.lineItems;
337
  }
338
 
339
  public Shipment setLineItems(List<LineItem> lineItems) {
340
    this.lineItems = lineItems;
341
    return this;
342
  }
343
 
344
  public void unsetLineItems() {
345
    this.lineItems = null;
346
  }
347
 
348
  /** Returns true if field lineItems is set (has been asigned a value) and false otherwise */
349
  public boolean isSetLineItems() {
350
    return this.lineItems != null;
351
  }
352
 
353
  public void setLineItemsIsSet(boolean value) {
354
    if (!value) {
355
      this.lineItems = null;
356
    }
357
  }
358
 
359
  /**
360
   * 
361
   * @see ShipmentStatus
362
   */
363
  public ShipmentStatus getStatus() {
364
    return this.status;
365
  }
366
 
367
  /**
368
   * 
369
   * @see ShipmentStatus
370
   */
371
  public Shipment setStatus(ShipmentStatus status) {
372
    this.status = status;
373
    return this;
374
  }
375
 
376
  public void unsetStatus() {
377
    this.status = null;
378
  }
379
 
380
  /** Returns true if field status is set (has been asigned a value) and false otherwise */
381
  public boolean isSetStatus() {
382
    return this.status != null;
383
  }
384
 
385
  public void setStatusIsSet(boolean value) {
386
    if (!value) {
387
      this.status = null;
388
    }
389
  }
390
 
391
  public long getShipmentTimestamp() {
392
    return this.shipmentTimestamp;
393
  }
394
 
395
  public Shipment setShipmentTimestamp(long shipmentTimestamp) {
396
    this.shipmentTimestamp = shipmentTimestamp;
397
    setShipmentTimestampIsSet(true);
398
    return this;
399
  }
400
 
401
  public void unsetShipmentTimestamp() {
402
    __isset_bit_vector.clear(__SHIPMENTTIMESTAMP_ISSET_ID);
403
  }
404
 
405
  /** Returns true if field shipmentTimestamp is set (has been asigned a value) and false otherwise */
406
  public boolean isSetShipmentTimestamp() {
407
    return __isset_bit_vector.get(__SHIPMENTTIMESTAMP_ISSET_ID);
408
  }
409
 
410
  public void setShipmentTimestampIsSet(boolean value) {
411
    __isset_bit_vector.set(__SHIPMENTTIMESTAMP_ISSET_ID, value);
412
  }
413
 
414
  public long getDeliveryTimestamp() {
415
    return this.deliveryTimestamp;
416
  }
417
 
418
  public Shipment setDeliveryTimestamp(long deliveryTimestamp) {
419
    this.deliveryTimestamp = deliveryTimestamp;
420
    setDeliveryTimestampIsSet(true);
421
    return this;
422
  }
423
 
424
  public void unsetDeliveryTimestamp() {
425
    __isset_bit_vector.clear(__DELIVERYTIMESTAMP_ISSET_ID);
426
  }
427
 
428
  /** Returns true if field deliveryTimestamp is set (has been asigned a value) and false otherwise */
429
  public boolean isSetDeliveryTimestamp() {
430
    return __isset_bit_vector.get(__DELIVERYTIMESTAMP_ISSET_ID);
431
  }
432
 
433
  public void setDeliveryTimestampIsSet(boolean value) {
434
    __isset_bit_vector.set(__DELIVERYTIMESTAMP_ISSET_ID, value);
435
  }
436
 
437
  public double getValue() {
438
    return this.value;
439
  }
440
 
441
  public Shipment setValue(double value) {
442
    this.value = value;
443
    setValueIsSet(true);
444
    return this;
445
  }
446
 
447
  public void unsetValue() {
448
    __isset_bit_vector.clear(__VALUE_ISSET_ID);
449
  }
450
 
451
  /** Returns true if field value is set (has been asigned a value) and false otherwise */
452
  public boolean isSetValue() {
453
    return __isset_bit_vector.get(__VALUE_ISSET_ID);
454
  }
455
 
456
  public void setValueIsSet(boolean value) {
457
    __isset_bit_vector.set(__VALUE_ISSET_ID, value);
458
  }
459
 
460
  public double getInsurance() {
461
    return this.insurance;
462
  }
463
 
464
  public Shipment setInsurance(double insurance) {
465
    this.insurance = insurance;
466
    setInsuranceIsSet(true);
467
    return this;
468
  }
469
 
470
  public void unsetInsurance() {
471
    __isset_bit_vector.clear(__INSURANCE_ISSET_ID);
472
  }
473
 
474
  /** Returns true if field insurance is set (has been asigned a value) and false otherwise */
475
  public boolean isSetInsurance() {
476
    return __isset_bit_vector.get(__INSURANCE_ISSET_ID);
477
  }
478
 
479
  public void setInsuranceIsSet(boolean value) {
480
    __isset_bit_vector.set(__INSURANCE_ISSET_ID, value);
481
  }
482
 
483
  public double getWeight() {
484
    return this.weight;
485
  }
486
 
487
  public Shipment setWeight(double weight) {
488
    this.weight = weight;
489
    setWeightIsSet(true);
490
    return this;
491
  }
492
 
493
  public void unsetWeight() {
494
    __isset_bit_vector.clear(__WEIGHT_ISSET_ID);
495
  }
496
 
497
  /** Returns true if field weight is set (has been asigned a value) and false otherwise */
498
  public boolean isSetWeight() {
499
    return __isset_bit_vector.get(__WEIGHT_ISSET_ID);
500
  }
501
 
502
  public void setWeightIsSet(boolean value) {
503
    __isset_bit_vector.set(__WEIGHT_ISSET_ID, value);
504
  }
505
 
506
  public String getAirwayBillNo() {
507
    return this.airwayBillNo;
508
  }
509
 
510
  public Shipment setAirwayBillNo(String airwayBillNo) {
511
    this.airwayBillNo = airwayBillNo;
512
    return this;
513
  }
514
 
515
  public void unsetAirwayBillNo() {
516
    this.airwayBillNo = null;
517
  }
518
 
519
  /** Returns true if field airwayBillNo is set (has been asigned a value) and false otherwise */
520
  public boolean isSetAirwayBillNo() {
521
    return this.airwayBillNo != null;
522
  }
523
 
524
  public void setAirwayBillNoIsSet(boolean value) {
525
    if (!value) {
526
      this.airwayBillNo = null;
527
    }
528
  }
529
 
530
  public String getProvider() {
531
    return this.provider;
532
  }
533
 
534
  public Shipment setProvider(String provider) {
535
    this.provider = provider;
536
    return this;
537
  }
538
 
539
  public void unsetProvider() {
540
    this.provider = null;
541
  }
542
 
543
  /** Returns true if field provider is set (has been asigned a value) and false otherwise */
544
  public boolean isSetProvider() {
545
    return this.provider != null;
546
  }
547
 
548
  public void setProviderIsSet(boolean value) {
549
    if (!value) {
550
      this.provider = null;
551
    }
552
  }
553
 
554
  public void setFieldValue(_Fields field, Object value) {
555
    switch (field) {
556
    case ID:
557
      if (value == null) {
558
        unsetId();
559
      } else {
560
        setId((Long)value);
561
      }
562
      break;
563
 
564
    case ADDRESS:
565
      if (value == null) {
566
        unsetAddress();
567
      } else {
568
        setAddress((String)value);
569
      }
570
      break;
571
 
572
    case TRACKING_ID:
573
      if (value == null) {
574
        unsetTrackingId();
575
      } else {
576
        setTrackingId((String)value);
577
      }
578
      break;
579
 
580
    case LINE_ITEMS:
581
      if (value == null) {
582
        unsetLineItems();
583
      } else {
584
        setLineItems((List<LineItem>)value);
585
      }
586
      break;
587
 
588
    case STATUS:
589
      if (value == null) {
590
        unsetStatus();
591
      } else {
592
        setStatus((ShipmentStatus)value);
593
      }
594
      break;
595
 
596
    case SHIPMENT_TIMESTAMP:
597
      if (value == null) {
598
        unsetShipmentTimestamp();
599
      } else {
600
        setShipmentTimestamp((Long)value);
601
      }
602
      break;
603
 
604
    case DELIVERY_TIMESTAMP:
605
      if (value == null) {
606
        unsetDeliveryTimestamp();
607
      } else {
608
        setDeliveryTimestamp((Long)value);
609
      }
610
      break;
611
 
612
    case VALUE:
613
      if (value == null) {
614
        unsetValue();
615
      } else {
616
        setValue((Double)value);
617
      }
618
      break;
619
 
620
    case INSURANCE:
621
      if (value == null) {
622
        unsetInsurance();
623
      } else {
624
        setInsurance((Double)value);
625
      }
626
      break;
627
 
628
    case WEIGHT:
629
      if (value == null) {
630
        unsetWeight();
631
      } else {
632
        setWeight((Double)value);
633
      }
634
      break;
635
 
636
    case AIRWAY_BILL_NO:
637
      if (value == null) {
638
        unsetAirwayBillNo();
639
      } else {
640
        setAirwayBillNo((String)value);
641
      }
642
      break;
643
 
644
    case PROVIDER:
645
      if (value == null) {
646
        unsetProvider();
647
      } else {
648
        setProvider((String)value);
649
      }
650
      break;
651
 
652
    }
653
  }
654
 
655
  public void setFieldValue(int fieldID, Object value) {
656
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
657
  }
658
 
659
  public Object getFieldValue(_Fields field) {
660
    switch (field) {
661
    case ID:
662
      return new Long(getId());
663
 
664
    case ADDRESS:
665
      return getAddress();
666
 
667
    case TRACKING_ID:
668
      return getTrackingId();
669
 
670
    case LINE_ITEMS:
671
      return getLineItems();
672
 
673
    case STATUS:
674
      return getStatus();
675
 
676
    case SHIPMENT_TIMESTAMP:
677
      return new Long(getShipmentTimestamp());
678
 
679
    case DELIVERY_TIMESTAMP:
680
      return new Long(getDeliveryTimestamp());
681
 
682
    case VALUE:
683
      return new Double(getValue());
684
 
685
    case INSURANCE:
686
      return new Double(getInsurance());
687
 
688
    case WEIGHT:
689
      return new Double(getWeight());
690
 
691
    case AIRWAY_BILL_NO:
692
      return getAirwayBillNo();
693
 
694
    case PROVIDER:
695
      return getProvider();
696
 
697
    }
698
    throw new IllegalStateException();
699
  }
700
 
701
  public Object getFieldValue(int fieldId) {
702
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
703
  }
704
 
705
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
706
  public boolean isSet(_Fields field) {
707
    switch (field) {
708
    case ID:
709
      return isSetId();
710
    case ADDRESS:
711
      return isSetAddress();
712
    case TRACKING_ID:
713
      return isSetTrackingId();
714
    case LINE_ITEMS:
715
      return isSetLineItems();
716
    case STATUS:
717
      return isSetStatus();
718
    case SHIPMENT_TIMESTAMP:
719
      return isSetShipmentTimestamp();
720
    case DELIVERY_TIMESTAMP:
721
      return isSetDeliveryTimestamp();
722
    case VALUE:
723
      return isSetValue();
724
    case INSURANCE:
725
      return isSetInsurance();
726
    case WEIGHT:
727
      return isSetWeight();
728
    case AIRWAY_BILL_NO:
729
      return isSetAirwayBillNo();
730
    case PROVIDER:
731
      return isSetProvider();
732
    }
733
    throw new IllegalStateException();
734
  }
735
 
736
  public boolean isSet(int fieldID) {
737
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
738
  }
739
 
740
  @Override
741
  public boolean equals(Object that) {
742
    if (that == null)
743
      return false;
744
    if (that instanceof Shipment)
745
      return this.equals((Shipment)that);
746
    return false;
747
  }
748
 
749
  public boolean equals(Shipment that) {
750
    if (that == null)
751
      return false;
752
 
753
    boolean this_present_id = true;
754
    boolean that_present_id = true;
755
    if (this_present_id || that_present_id) {
756
      if (!(this_present_id && that_present_id))
757
        return false;
758
      if (this.id != that.id)
759
        return false;
760
    }
761
 
762
    boolean this_present_address = true && this.isSetAddress();
763
    boolean that_present_address = true && that.isSetAddress();
764
    if (this_present_address || that_present_address) {
765
      if (!(this_present_address && that_present_address))
766
        return false;
767
      if (!this.address.equals(that.address))
768
        return false;
769
    }
770
 
771
    boolean this_present_trackingId = true && this.isSetTrackingId();
772
    boolean that_present_trackingId = true && that.isSetTrackingId();
773
    if (this_present_trackingId || that_present_trackingId) {
774
      if (!(this_present_trackingId && that_present_trackingId))
775
        return false;
776
      if (!this.trackingId.equals(that.trackingId))
777
        return false;
778
    }
779
 
780
    boolean this_present_lineItems = true && this.isSetLineItems();
781
    boolean that_present_lineItems = true && that.isSetLineItems();
782
    if (this_present_lineItems || that_present_lineItems) {
783
      if (!(this_present_lineItems && that_present_lineItems))
784
        return false;
785
      if (!this.lineItems.equals(that.lineItems))
786
        return false;
787
    }
788
 
789
    boolean this_present_status = true && this.isSetStatus();
790
    boolean that_present_status = true && that.isSetStatus();
791
    if (this_present_status || that_present_status) {
792
      if (!(this_present_status && that_present_status))
793
        return false;
794
      if (!this.status.equals(that.status))
795
        return false;
796
    }
797
 
798
    boolean this_present_shipmentTimestamp = true;
799
    boolean that_present_shipmentTimestamp = true;
800
    if (this_present_shipmentTimestamp || that_present_shipmentTimestamp) {
801
      if (!(this_present_shipmentTimestamp && that_present_shipmentTimestamp))
802
        return false;
803
      if (this.shipmentTimestamp != that.shipmentTimestamp)
804
        return false;
805
    }
806
 
807
    boolean this_present_deliveryTimestamp = true;
808
    boolean that_present_deliveryTimestamp = true;
809
    if (this_present_deliveryTimestamp || that_present_deliveryTimestamp) {
810
      if (!(this_present_deliveryTimestamp && that_present_deliveryTimestamp))
811
        return false;
812
      if (this.deliveryTimestamp != that.deliveryTimestamp)
813
        return false;
814
    }
815
 
816
    boolean this_present_value = true;
817
    boolean that_present_value = true;
818
    if (this_present_value || that_present_value) {
819
      if (!(this_present_value && that_present_value))
820
        return false;
821
      if (this.value != that.value)
822
        return false;
823
    }
824
 
825
    boolean this_present_insurance = true;
826
    boolean that_present_insurance = true;
827
    if (this_present_insurance || that_present_insurance) {
828
      if (!(this_present_insurance && that_present_insurance))
829
        return false;
830
      if (this.insurance != that.insurance)
831
        return false;
832
    }
833
 
834
    boolean this_present_weight = true;
835
    boolean that_present_weight = true;
836
    if (this_present_weight || that_present_weight) {
837
      if (!(this_present_weight && that_present_weight))
838
        return false;
839
      if (this.weight != that.weight)
840
        return false;
841
    }
842
 
843
    boolean this_present_airwayBillNo = true && this.isSetAirwayBillNo();
844
    boolean that_present_airwayBillNo = true && that.isSetAirwayBillNo();
845
    if (this_present_airwayBillNo || that_present_airwayBillNo) {
846
      if (!(this_present_airwayBillNo && that_present_airwayBillNo))
847
        return false;
848
      if (!this.airwayBillNo.equals(that.airwayBillNo))
849
        return false;
850
    }
851
 
852
    boolean this_present_provider = true && this.isSetProvider();
853
    boolean that_present_provider = true && that.isSetProvider();
854
    if (this_present_provider || that_present_provider) {
855
      if (!(this_present_provider && that_present_provider))
856
        return false;
857
      if (!this.provider.equals(that.provider))
858
        return false;
859
    }
860
 
861
    return true;
862
  }
863
 
864
  @Override
865
  public int hashCode() {
866
    return 0;
867
  }
868
 
869
  public void read(TProtocol iprot) throws TException {
870
    TField field;
871
    iprot.readStructBegin();
872
    while (true)
873
    {
874
      field = iprot.readFieldBegin();
875
      if (field.type == TType.STOP) { 
876
        break;
877
      }
878
      _Fields fieldId = _Fields.findByThriftId(field.id);
879
      if (fieldId == null) {
880
        TProtocolUtil.skip(iprot, field.type);
881
      } else {
882
        switch (fieldId) {
883
          case ID:
884
            if (field.type == TType.I64) {
885
              this.id = iprot.readI64();
886
              setIdIsSet(true);
887
            } else { 
888
              TProtocolUtil.skip(iprot, field.type);
889
            }
890
            break;
891
          case ADDRESS:
892
            if (field.type == TType.STRING) {
893
              this.address = iprot.readString();
894
            } else { 
895
              TProtocolUtil.skip(iprot, field.type);
896
            }
897
            break;
898
          case TRACKING_ID:
899
            if (field.type == TType.STRING) {
900
              this.trackingId = iprot.readString();
901
            } else { 
902
              TProtocolUtil.skip(iprot, field.type);
903
            }
904
            break;
905
          case LINE_ITEMS:
906
            if (field.type == TType.LIST) {
907
              {
132 ashish 908
                TList _list17 = iprot.readListBegin();
909
                this.lineItems = new ArrayList<LineItem>(_list17.size);
910
                for (int _i18 = 0; _i18 < _list17.size; ++_i18)
68 ashish 911
                {
132 ashish 912
                  LineItem _elem19;
913
                  _elem19 = new LineItem();
914
                  _elem19.read(iprot);
915
                  this.lineItems.add(_elem19);
68 ashish 916
                }
917
                iprot.readListEnd();
918
              }
919
            } else { 
920
              TProtocolUtil.skip(iprot, field.type);
921
            }
922
            break;
923
          case STATUS:
924
            if (field.type == TType.I32) {
925
              this.status = ShipmentStatus.findByValue(iprot.readI32());
926
            } else { 
927
              TProtocolUtil.skip(iprot, field.type);
928
            }
929
            break;
930
          case SHIPMENT_TIMESTAMP:
931
            if (field.type == TType.I64) {
932
              this.shipmentTimestamp = iprot.readI64();
933
              setShipmentTimestampIsSet(true);
934
            } else { 
935
              TProtocolUtil.skip(iprot, field.type);
936
            }
937
            break;
938
          case DELIVERY_TIMESTAMP:
939
            if (field.type == TType.I64) {
940
              this.deliveryTimestamp = iprot.readI64();
941
              setDeliveryTimestampIsSet(true);
942
            } else { 
943
              TProtocolUtil.skip(iprot, field.type);
944
            }
945
            break;
946
          case VALUE:
947
            if (field.type == TType.DOUBLE) {
948
              this.value = iprot.readDouble();
949
              setValueIsSet(true);
950
            } else { 
951
              TProtocolUtil.skip(iprot, field.type);
952
            }
953
            break;
954
          case INSURANCE:
955
            if (field.type == TType.DOUBLE) {
956
              this.insurance = iprot.readDouble();
957
              setInsuranceIsSet(true);
958
            } else { 
959
              TProtocolUtil.skip(iprot, field.type);
960
            }
961
            break;
962
          case WEIGHT:
963
            if (field.type == TType.DOUBLE) {
964
              this.weight = iprot.readDouble();
965
              setWeightIsSet(true);
966
            } else { 
967
              TProtocolUtil.skip(iprot, field.type);
968
            }
969
            break;
970
          case AIRWAY_BILL_NO:
971
            if (field.type == TType.STRING) {
972
              this.airwayBillNo = iprot.readString();
973
            } else { 
974
              TProtocolUtil.skip(iprot, field.type);
975
            }
976
            break;
977
          case PROVIDER:
978
            if (field.type == TType.STRING) {
979
              this.provider = iprot.readString();
980
            } else { 
981
              TProtocolUtil.skip(iprot, field.type);
982
            }
983
            break;
984
        }
985
        iprot.readFieldEnd();
986
      }
987
    }
988
    iprot.readStructEnd();
989
    validate();
990
  }
991
 
992
  public void write(TProtocol oprot) throws TException {
993
    validate();
994
 
995
    oprot.writeStructBegin(STRUCT_DESC);
996
    oprot.writeFieldBegin(ID_FIELD_DESC);
997
    oprot.writeI64(this.id);
998
    oprot.writeFieldEnd();
999
    if (this.address != null) {
1000
      oprot.writeFieldBegin(ADDRESS_FIELD_DESC);
1001
      oprot.writeString(this.address);
1002
      oprot.writeFieldEnd();
1003
    }
1004
    if (this.trackingId != null) {
1005
      oprot.writeFieldBegin(TRACKING_ID_FIELD_DESC);
1006
      oprot.writeString(this.trackingId);
1007
      oprot.writeFieldEnd();
1008
    }
1009
    if (this.lineItems != null) {
1010
      oprot.writeFieldBegin(LINE_ITEMS_FIELD_DESC);
1011
      {
1012
        oprot.writeListBegin(new TList(TType.STRUCT, this.lineItems.size()));
132 ashish 1013
        for (LineItem _iter20 : this.lineItems)
68 ashish 1014
        {
132 ashish 1015
          _iter20.write(oprot);
68 ashish 1016
        }
1017
        oprot.writeListEnd();
1018
      }
1019
      oprot.writeFieldEnd();
1020
    }
1021
    if (this.status != null) {
1022
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
1023
      oprot.writeI32(this.status.getValue());
1024
      oprot.writeFieldEnd();
1025
    }
1026
    oprot.writeFieldBegin(SHIPMENT_TIMESTAMP_FIELD_DESC);
1027
    oprot.writeI64(this.shipmentTimestamp);
1028
    oprot.writeFieldEnd();
1029
    oprot.writeFieldBegin(DELIVERY_TIMESTAMP_FIELD_DESC);
1030
    oprot.writeI64(this.deliveryTimestamp);
1031
    oprot.writeFieldEnd();
1032
    oprot.writeFieldBegin(VALUE_FIELD_DESC);
1033
    oprot.writeDouble(this.value);
1034
    oprot.writeFieldEnd();
1035
    oprot.writeFieldBegin(INSURANCE_FIELD_DESC);
1036
    oprot.writeDouble(this.insurance);
1037
    oprot.writeFieldEnd();
1038
    oprot.writeFieldBegin(WEIGHT_FIELD_DESC);
1039
    oprot.writeDouble(this.weight);
1040
    oprot.writeFieldEnd();
1041
    if (this.airwayBillNo != null) {
1042
      oprot.writeFieldBegin(AIRWAY_BILL_NO_FIELD_DESC);
1043
      oprot.writeString(this.airwayBillNo);
1044
      oprot.writeFieldEnd();
1045
    }
1046
    if (this.provider != null) {
1047
      oprot.writeFieldBegin(PROVIDER_FIELD_DESC);
1048
      oprot.writeString(this.provider);
1049
      oprot.writeFieldEnd();
1050
    }
1051
    oprot.writeFieldStop();
1052
    oprot.writeStructEnd();
1053
  }
1054
 
1055
  @Override
1056
  public String toString() {
1057
    StringBuilder sb = new StringBuilder("Shipment(");
1058
    boolean first = true;
1059
 
1060
    sb.append("id:");
1061
    sb.append(this.id);
1062
    first = false;
1063
    if (!first) sb.append(", ");
1064
    sb.append("address:");
1065
    if (this.address == null) {
1066
      sb.append("null");
1067
    } else {
1068
      sb.append(this.address);
1069
    }
1070
    first = false;
1071
    if (!first) sb.append(", ");
1072
    sb.append("trackingId:");
1073
    if (this.trackingId == null) {
1074
      sb.append("null");
1075
    } else {
1076
      sb.append(this.trackingId);
1077
    }
1078
    first = false;
1079
    if (!first) sb.append(", ");
1080
    sb.append("lineItems:");
1081
    if (this.lineItems == null) {
1082
      sb.append("null");
1083
    } else {
1084
      sb.append(this.lineItems);
1085
    }
1086
    first = false;
1087
    if (!first) sb.append(", ");
1088
    sb.append("status:");
1089
    if (this.status == null) {
1090
      sb.append("null");
1091
    } else {
1092
      String status_name = status.name();
1093
      if (status_name != null) {
1094
        sb.append(status_name);
1095
        sb.append(" (");
1096
      }
1097
      sb.append(this.status);
1098
      if (status_name != null) {
1099
        sb.append(")");
1100
      }
1101
    }
1102
    first = false;
1103
    if (!first) sb.append(", ");
1104
    sb.append("shipmentTimestamp:");
1105
    sb.append(this.shipmentTimestamp);
1106
    first = false;
1107
    if (!first) sb.append(", ");
1108
    sb.append("deliveryTimestamp:");
1109
    sb.append(this.deliveryTimestamp);
1110
    first = false;
1111
    if (!first) sb.append(", ");
1112
    sb.append("value:");
1113
    sb.append(this.value);
1114
    first = false;
1115
    if (!first) sb.append(", ");
1116
    sb.append("insurance:");
1117
    sb.append(this.insurance);
1118
    first = false;
1119
    if (!first) sb.append(", ");
1120
    sb.append("weight:");
1121
    sb.append(this.weight);
1122
    first = false;
1123
    if (!first) sb.append(", ");
1124
    sb.append("airwayBillNo:");
1125
    if (this.airwayBillNo == null) {
1126
      sb.append("null");
1127
    } else {
1128
      sb.append(this.airwayBillNo);
1129
    }
1130
    first = false;
1131
    if (!first) sb.append(", ");
1132
    sb.append("provider:");
1133
    if (this.provider == null) {
1134
      sb.append("null");
1135
    } else {
1136
      sb.append(this.provider);
1137
    }
1138
    first = false;
1139
    sb.append(")");
1140
    return sb.toString();
1141
  }
1142
 
1143
  public void validate() throws TException {
1144
    // check for required fields
1145
  }
1146
 
1147
}
1148