Subversion Repositories SmartDukaan

Rev

Rev 4496 | 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.purchase;
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 Purchase implements org.apache.thrift.TBase<Purchase, Purchase._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Purchase");
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 PO_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("poId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField INVOICE_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("invoiceNumber", org.apache.thrift.protocol.TType.STRING, (short)3);
29
  private static final org.apache.thrift.protocol.TField RECEIVED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("receivedOn", org.apache.thrift.protocol.TType.I64, (short)4);
30
  private static final org.apache.thrift.protocol.TField FREIGHT_CHARGES_FIELD_DESC = new org.apache.thrift.protocol.TField("freightCharges", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
11801 manish.sha 31
  private static final org.apache.thrift.protocol.TField PURCHASE_COMMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("purchaseComments", org.apache.thrift.protocol.TType.STRING, (short)6);
4496 mandeep.dh 32
 
33
  private long id; // required
34
  private long poId; // required
35
  private String invoiceNumber; // required
36
  private long receivedOn; // required
37
  private double freightCharges; // required
11801 manish.sha 38
  private String purchaseComments; // required
4496 mandeep.dh 39
 
40
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
41
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
42
    ID((short)1, "id"),
43
    PO_ID((short)2, "poId"),
44
    INVOICE_NUMBER((short)3, "invoiceNumber"),
45
    RECEIVED_ON((short)4, "receivedOn"),
11801 manish.sha 46
    FREIGHT_CHARGES((short)5, "freightCharges"),
47
    PURCHASE_COMMENTS((short)6, "purchaseComments");
4496 mandeep.dh 48
 
49
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
50
 
51
    static {
52
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
53
        byName.put(field.getFieldName(), field);
54
      }
55
    }
56
 
57
    /**
58
     * Find the _Fields constant that matches fieldId, or null if its not found.
59
     */
60
    public static _Fields findByThriftId(int fieldId) {
61
      switch(fieldId) {
62
        case 1: // ID
63
          return ID;
64
        case 2: // PO_ID
65
          return PO_ID;
66
        case 3: // INVOICE_NUMBER
67
          return INVOICE_NUMBER;
68
        case 4: // RECEIVED_ON
69
          return RECEIVED_ON;
70
        case 5: // FREIGHT_CHARGES
71
          return FREIGHT_CHARGES;
11801 manish.sha 72
        case 6: // PURCHASE_COMMENTS
73
          return PURCHASE_COMMENTS;
4496 mandeep.dh 74
        default:
75
          return null;
76
      }
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches fieldId, throwing an exception
81
     * if it is not found.
82
     */
83
    public static _Fields findByThriftIdOrThrow(int fieldId) {
84
      _Fields fields = findByThriftId(fieldId);
85
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
86
      return fields;
87
    }
88
 
89
    /**
90
     * Find the _Fields constant that matches name, or null if its not found.
91
     */
92
    public static _Fields findByName(String name) {
93
      return byName.get(name);
94
    }
95
 
96
    private final short _thriftId;
97
    private final String _fieldName;
98
 
99
    _Fields(short thriftId, String fieldName) {
100
      _thriftId = thriftId;
101
      _fieldName = fieldName;
102
    }
103
 
104
    public short getThriftFieldId() {
105
      return _thriftId;
106
    }
107
 
108
    public String getFieldName() {
109
      return _fieldName;
110
    }
111
  }
112
 
113
  // isset id assignments
114
  private static final int __ID_ISSET_ID = 0;
115
  private static final int __POID_ISSET_ID = 1;
116
  private static final int __RECEIVEDON_ISSET_ID = 2;
117
  private static final int __FREIGHTCHARGES_ISSET_ID = 3;
118
  private BitSet __isset_bit_vector = new BitSet(4);
119
 
120
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
121
  static {
122
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
123
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
124
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
125
    tmpMap.put(_Fields.PO_ID, new org.apache.thrift.meta_data.FieldMetaData("poId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
126
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
127
    tmpMap.put(_Fields.INVOICE_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("invoiceNumber", org.apache.thrift.TFieldRequirementType.DEFAULT, 
128
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
129
    tmpMap.put(_Fields.RECEIVED_ON, new org.apache.thrift.meta_data.FieldMetaData("receivedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
130
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
131
    tmpMap.put(_Fields.FREIGHT_CHARGES, new org.apache.thrift.meta_data.FieldMetaData("freightCharges", org.apache.thrift.TFieldRequirementType.DEFAULT, 
132
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
11801 manish.sha 133
    tmpMap.put(_Fields.PURCHASE_COMMENTS, new org.apache.thrift.meta_data.FieldMetaData("purchaseComments", org.apache.thrift.TFieldRequirementType.DEFAULT, 
134
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
4496 mandeep.dh 135
    metaDataMap = Collections.unmodifiableMap(tmpMap);
136
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Purchase.class, metaDataMap);
137
  }
138
 
139
  public Purchase() {
140
  }
141
 
142
  public Purchase(
143
    long id,
144
    long poId,
145
    String invoiceNumber,
146
    long receivedOn,
11801 manish.sha 147
    double freightCharges,
148
    String purchaseComments)
4496 mandeep.dh 149
  {
150
    this();
151
    this.id = id;
152
    setIdIsSet(true);
153
    this.poId = poId;
154
    setPoIdIsSet(true);
155
    this.invoiceNumber = invoiceNumber;
156
    this.receivedOn = receivedOn;
157
    setReceivedOnIsSet(true);
158
    this.freightCharges = freightCharges;
159
    setFreightChargesIsSet(true);
11801 manish.sha 160
    this.purchaseComments = purchaseComments;
4496 mandeep.dh 161
  }
162
 
163
  /**
164
   * Performs a deep copy on <i>other</i>.
165
   */
166
  public Purchase(Purchase other) {
167
    __isset_bit_vector.clear();
168
    __isset_bit_vector.or(other.__isset_bit_vector);
169
    this.id = other.id;
170
    this.poId = other.poId;
171
    if (other.isSetInvoiceNumber()) {
172
      this.invoiceNumber = other.invoiceNumber;
173
    }
174
    this.receivedOn = other.receivedOn;
175
    this.freightCharges = other.freightCharges;
11801 manish.sha 176
    if (other.isSetPurchaseComments()) {
177
      this.purchaseComments = other.purchaseComments;
178
    }
4496 mandeep.dh 179
  }
180
 
181
  public Purchase deepCopy() {
182
    return new Purchase(this);
183
  }
184
 
185
  @Override
186
  public void clear() {
187
    setIdIsSet(false);
188
    this.id = 0;
189
    setPoIdIsSet(false);
190
    this.poId = 0;
191
    this.invoiceNumber = null;
192
    setReceivedOnIsSet(false);
193
    this.receivedOn = 0;
194
    setFreightChargesIsSet(false);
195
    this.freightCharges = 0.0;
11801 manish.sha 196
    this.purchaseComments = null;
4496 mandeep.dh 197
  }
198
 
199
  public long getId() {
200
    return this.id;
201
  }
202
 
203
  public void setId(long id) {
204
    this.id = id;
205
    setIdIsSet(true);
206
  }
207
 
208
  public void unsetId() {
209
    __isset_bit_vector.clear(__ID_ISSET_ID);
210
  }
211
 
212
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
213
  public boolean isSetId() {
214
    return __isset_bit_vector.get(__ID_ISSET_ID);
215
  }
216
 
217
  public void setIdIsSet(boolean value) {
218
    __isset_bit_vector.set(__ID_ISSET_ID, value);
219
  }
220
 
221
  public long getPoId() {
222
    return this.poId;
223
  }
224
 
225
  public void setPoId(long poId) {
226
    this.poId = poId;
227
    setPoIdIsSet(true);
228
  }
229
 
230
  public void unsetPoId() {
231
    __isset_bit_vector.clear(__POID_ISSET_ID);
232
  }
233
 
234
  /** Returns true if field poId is set (has been assigned a value) and false otherwise */
235
  public boolean isSetPoId() {
236
    return __isset_bit_vector.get(__POID_ISSET_ID);
237
  }
238
 
239
  public void setPoIdIsSet(boolean value) {
240
    __isset_bit_vector.set(__POID_ISSET_ID, value);
241
  }
242
 
243
  public String getInvoiceNumber() {
244
    return this.invoiceNumber;
245
  }
246
 
247
  public void setInvoiceNumber(String invoiceNumber) {
248
    this.invoiceNumber = invoiceNumber;
249
  }
250
 
251
  public void unsetInvoiceNumber() {
252
    this.invoiceNumber = null;
253
  }
254
 
255
  /** Returns true if field invoiceNumber is set (has been assigned a value) and false otherwise */
256
  public boolean isSetInvoiceNumber() {
257
    return this.invoiceNumber != null;
258
  }
259
 
260
  public void setInvoiceNumberIsSet(boolean value) {
261
    if (!value) {
262
      this.invoiceNumber = null;
263
    }
264
  }
265
 
266
  public long getReceivedOn() {
267
    return this.receivedOn;
268
  }
269
 
270
  public void setReceivedOn(long receivedOn) {
271
    this.receivedOn = receivedOn;
272
    setReceivedOnIsSet(true);
273
  }
274
 
275
  public void unsetReceivedOn() {
276
    __isset_bit_vector.clear(__RECEIVEDON_ISSET_ID);
277
  }
278
 
279
  /** Returns true if field receivedOn is set (has been assigned a value) and false otherwise */
280
  public boolean isSetReceivedOn() {
281
    return __isset_bit_vector.get(__RECEIVEDON_ISSET_ID);
282
  }
283
 
284
  public void setReceivedOnIsSet(boolean value) {
285
    __isset_bit_vector.set(__RECEIVEDON_ISSET_ID, value);
286
  }
287
 
288
  public double getFreightCharges() {
289
    return this.freightCharges;
290
  }
291
 
292
  public void setFreightCharges(double freightCharges) {
293
    this.freightCharges = freightCharges;
294
    setFreightChargesIsSet(true);
295
  }
296
 
297
  public void unsetFreightCharges() {
298
    __isset_bit_vector.clear(__FREIGHTCHARGES_ISSET_ID);
299
  }
300
 
301
  /** Returns true if field freightCharges is set (has been assigned a value) and false otherwise */
302
  public boolean isSetFreightCharges() {
303
    return __isset_bit_vector.get(__FREIGHTCHARGES_ISSET_ID);
304
  }
305
 
306
  public void setFreightChargesIsSet(boolean value) {
307
    __isset_bit_vector.set(__FREIGHTCHARGES_ISSET_ID, value);
308
  }
309
 
11801 manish.sha 310
  public String getPurchaseComments() {
311
    return this.purchaseComments;
312
  }
313
 
314
  public void setPurchaseComments(String purchaseComments) {
315
    this.purchaseComments = purchaseComments;
316
  }
317
 
318
  public void unsetPurchaseComments() {
319
    this.purchaseComments = null;
320
  }
321
 
322
  /** Returns true if field purchaseComments is set (has been assigned a value) and false otherwise */
323
  public boolean isSetPurchaseComments() {
324
    return this.purchaseComments != null;
325
  }
326
 
327
  public void setPurchaseCommentsIsSet(boolean value) {
328
    if (!value) {
329
      this.purchaseComments = null;
330
    }
331
  }
332
 
4496 mandeep.dh 333
  public void setFieldValue(_Fields field, Object value) {
334
    switch (field) {
335
    case ID:
336
      if (value == null) {
337
        unsetId();
338
      } else {
339
        setId((Long)value);
340
      }
341
      break;
342
 
343
    case PO_ID:
344
      if (value == null) {
345
        unsetPoId();
346
      } else {
347
        setPoId((Long)value);
348
      }
349
      break;
350
 
351
    case INVOICE_NUMBER:
352
      if (value == null) {
353
        unsetInvoiceNumber();
354
      } else {
355
        setInvoiceNumber((String)value);
356
      }
357
      break;
358
 
359
    case RECEIVED_ON:
360
      if (value == null) {
361
        unsetReceivedOn();
362
      } else {
363
        setReceivedOn((Long)value);
364
      }
365
      break;
366
 
367
    case FREIGHT_CHARGES:
368
      if (value == null) {
369
        unsetFreightCharges();
370
      } else {
371
        setFreightCharges((Double)value);
372
      }
373
      break;
374
 
11801 manish.sha 375
    case PURCHASE_COMMENTS:
376
      if (value == null) {
377
        unsetPurchaseComments();
378
      } else {
379
        setPurchaseComments((String)value);
380
      }
381
      break;
382
 
4496 mandeep.dh 383
    }
384
  }
385
 
386
  public Object getFieldValue(_Fields field) {
387
    switch (field) {
388
    case ID:
389
      return Long.valueOf(getId());
390
 
391
    case PO_ID:
392
      return Long.valueOf(getPoId());
393
 
394
    case INVOICE_NUMBER:
395
      return getInvoiceNumber();
396
 
397
    case RECEIVED_ON:
398
      return Long.valueOf(getReceivedOn());
399
 
400
    case FREIGHT_CHARGES:
401
      return Double.valueOf(getFreightCharges());
402
 
11801 manish.sha 403
    case PURCHASE_COMMENTS:
404
      return getPurchaseComments();
405
 
4496 mandeep.dh 406
    }
407
    throw new IllegalStateException();
408
  }
409
 
410
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
411
  public boolean isSet(_Fields field) {
412
    if (field == null) {
413
      throw new IllegalArgumentException();
414
    }
415
 
416
    switch (field) {
417
    case ID:
418
      return isSetId();
419
    case PO_ID:
420
      return isSetPoId();
421
    case INVOICE_NUMBER:
422
      return isSetInvoiceNumber();
423
    case RECEIVED_ON:
424
      return isSetReceivedOn();
425
    case FREIGHT_CHARGES:
426
      return isSetFreightCharges();
11801 manish.sha 427
    case PURCHASE_COMMENTS:
428
      return isSetPurchaseComments();
4496 mandeep.dh 429
    }
430
    throw new IllegalStateException();
431
  }
432
 
433
  @Override
434
  public boolean equals(Object that) {
435
    if (that == null)
436
      return false;
437
    if (that instanceof Purchase)
438
      return this.equals((Purchase)that);
439
    return false;
440
  }
441
 
442
  public boolean equals(Purchase that) {
443
    if (that == null)
444
      return false;
445
 
446
    boolean this_present_id = true;
447
    boolean that_present_id = true;
448
    if (this_present_id || that_present_id) {
449
      if (!(this_present_id && that_present_id))
450
        return false;
451
      if (this.id != that.id)
452
        return false;
453
    }
454
 
455
    boolean this_present_poId = true;
456
    boolean that_present_poId = true;
457
    if (this_present_poId || that_present_poId) {
458
      if (!(this_present_poId && that_present_poId))
459
        return false;
460
      if (this.poId != that.poId)
461
        return false;
462
    }
463
 
464
    boolean this_present_invoiceNumber = true && this.isSetInvoiceNumber();
465
    boolean that_present_invoiceNumber = true && that.isSetInvoiceNumber();
466
    if (this_present_invoiceNumber || that_present_invoiceNumber) {
467
      if (!(this_present_invoiceNumber && that_present_invoiceNumber))
468
        return false;
469
      if (!this.invoiceNumber.equals(that.invoiceNumber))
470
        return false;
471
    }
472
 
473
    boolean this_present_receivedOn = true;
474
    boolean that_present_receivedOn = true;
475
    if (this_present_receivedOn || that_present_receivedOn) {
476
      if (!(this_present_receivedOn && that_present_receivedOn))
477
        return false;
478
      if (this.receivedOn != that.receivedOn)
479
        return false;
480
    }
481
 
482
    boolean this_present_freightCharges = true;
483
    boolean that_present_freightCharges = true;
484
    if (this_present_freightCharges || that_present_freightCharges) {
485
      if (!(this_present_freightCharges && that_present_freightCharges))
486
        return false;
487
      if (this.freightCharges != that.freightCharges)
488
        return false;
489
    }
490
 
11801 manish.sha 491
    boolean this_present_purchaseComments = true && this.isSetPurchaseComments();
492
    boolean that_present_purchaseComments = true && that.isSetPurchaseComments();
493
    if (this_present_purchaseComments || that_present_purchaseComments) {
494
      if (!(this_present_purchaseComments && that_present_purchaseComments))
495
        return false;
496
      if (!this.purchaseComments.equals(that.purchaseComments))
497
        return false;
498
    }
499
 
4496 mandeep.dh 500
    return true;
501
  }
502
 
503
  @Override
504
  public int hashCode() {
505
    return 0;
506
  }
507
 
508
  public int compareTo(Purchase other) {
509
    if (!getClass().equals(other.getClass())) {
510
      return getClass().getName().compareTo(other.getClass().getName());
511
    }
512
 
513
    int lastComparison = 0;
514
    Purchase typedOther = (Purchase)other;
515
 
516
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
517
    if (lastComparison != 0) {
518
      return lastComparison;
519
    }
520
    if (isSetId()) {
521
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
522
      if (lastComparison != 0) {
523
        return lastComparison;
524
      }
525
    }
526
    lastComparison = Boolean.valueOf(isSetPoId()).compareTo(typedOther.isSetPoId());
527
    if (lastComparison != 0) {
528
      return lastComparison;
529
    }
530
    if (isSetPoId()) {
531
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.poId, typedOther.poId);
532
      if (lastComparison != 0) {
533
        return lastComparison;
534
      }
535
    }
536
    lastComparison = Boolean.valueOf(isSetInvoiceNumber()).compareTo(typedOther.isSetInvoiceNumber());
537
    if (lastComparison != 0) {
538
      return lastComparison;
539
    }
540
    if (isSetInvoiceNumber()) {
541
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.invoiceNumber, typedOther.invoiceNumber);
542
      if (lastComparison != 0) {
543
        return lastComparison;
544
      }
545
    }
546
    lastComparison = Boolean.valueOf(isSetReceivedOn()).compareTo(typedOther.isSetReceivedOn());
547
    if (lastComparison != 0) {
548
      return lastComparison;
549
    }
550
    if (isSetReceivedOn()) {
551
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.receivedOn, typedOther.receivedOn);
552
      if (lastComparison != 0) {
553
        return lastComparison;
554
      }
555
    }
556
    lastComparison = Boolean.valueOf(isSetFreightCharges()).compareTo(typedOther.isSetFreightCharges());
557
    if (lastComparison != 0) {
558
      return lastComparison;
559
    }
560
    if (isSetFreightCharges()) {
561
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.freightCharges, typedOther.freightCharges);
562
      if (lastComparison != 0) {
563
        return lastComparison;
564
      }
565
    }
11801 manish.sha 566
    lastComparison = Boolean.valueOf(isSetPurchaseComments()).compareTo(typedOther.isSetPurchaseComments());
567
    if (lastComparison != 0) {
568
      return lastComparison;
569
    }
570
    if (isSetPurchaseComments()) {
571
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.purchaseComments, typedOther.purchaseComments);
572
      if (lastComparison != 0) {
573
        return lastComparison;
574
      }
575
    }
4496 mandeep.dh 576
    return 0;
577
  }
578
 
579
  public _Fields fieldForId(int fieldId) {
580
    return _Fields.findByThriftId(fieldId);
581
  }
582
 
583
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
584
    org.apache.thrift.protocol.TField field;
585
    iprot.readStructBegin();
586
    while (true)
587
    {
588
      field = iprot.readFieldBegin();
589
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
590
        break;
591
      }
592
      switch (field.id) {
593
        case 1: // ID
594
          if (field.type == org.apache.thrift.protocol.TType.I64) {
595
            this.id = iprot.readI64();
596
            setIdIsSet(true);
597
          } else { 
598
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
599
          }
600
          break;
601
        case 2: // PO_ID
602
          if (field.type == org.apache.thrift.protocol.TType.I64) {
603
            this.poId = iprot.readI64();
604
            setPoIdIsSet(true);
605
          } else { 
606
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
607
          }
608
          break;
609
        case 3: // INVOICE_NUMBER
610
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
611
            this.invoiceNumber = iprot.readString();
612
          } else { 
613
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
614
          }
615
          break;
616
        case 4: // RECEIVED_ON
617
          if (field.type == org.apache.thrift.protocol.TType.I64) {
618
            this.receivedOn = iprot.readI64();
619
            setReceivedOnIsSet(true);
620
          } else { 
621
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
622
          }
623
          break;
624
        case 5: // FREIGHT_CHARGES
625
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
626
            this.freightCharges = iprot.readDouble();
627
            setFreightChargesIsSet(true);
628
          } else { 
629
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
630
          }
631
          break;
11801 manish.sha 632
        case 6: // PURCHASE_COMMENTS
633
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
634
            this.purchaseComments = iprot.readString();
635
          } else { 
636
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
637
          }
638
          break;
4496 mandeep.dh 639
        default:
640
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
641
      }
642
      iprot.readFieldEnd();
643
    }
644
    iprot.readStructEnd();
645
    validate();
646
  }
647
 
648
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
649
    validate();
650
 
651
    oprot.writeStructBegin(STRUCT_DESC);
652
    oprot.writeFieldBegin(ID_FIELD_DESC);
653
    oprot.writeI64(this.id);
654
    oprot.writeFieldEnd();
655
    oprot.writeFieldBegin(PO_ID_FIELD_DESC);
656
    oprot.writeI64(this.poId);
657
    oprot.writeFieldEnd();
658
    if (this.invoiceNumber != null) {
659
      oprot.writeFieldBegin(INVOICE_NUMBER_FIELD_DESC);
660
      oprot.writeString(this.invoiceNumber);
661
      oprot.writeFieldEnd();
662
    }
663
    oprot.writeFieldBegin(RECEIVED_ON_FIELD_DESC);
664
    oprot.writeI64(this.receivedOn);
665
    oprot.writeFieldEnd();
666
    oprot.writeFieldBegin(FREIGHT_CHARGES_FIELD_DESC);
667
    oprot.writeDouble(this.freightCharges);
668
    oprot.writeFieldEnd();
11801 manish.sha 669
    if (this.purchaseComments != null) {
670
      oprot.writeFieldBegin(PURCHASE_COMMENTS_FIELD_DESC);
671
      oprot.writeString(this.purchaseComments);
672
      oprot.writeFieldEnd();
673
    }
4496 mandeep.dh 674
    oprot.writeFieldStop();
675
    oprot.writeStructEnd();
676
  }
677
 
678
  @Override
679
  public String toString() {
680
    StringBuilder sb = new StringBuilder("Purchase(");
681
    boolean first = true;
682
 
683
    sb.append("id:");
684
    sb.append(this.id);
685
    first = false;
686
    if (!first) sb.append(", ");
687
    sb.append("poId:");
688
    sb.append(this.poId);
689
    first = false;
690
    if (!first) sb.append(", ");
691
    sb.append("invoiceNumber:");
692
    if (this.invoiceNumber == null) {
693
      sb.append("null");
694
    } else {
695
      sb.append(this.invoiceNumber);
696
    }
697
    first = false;
698
    if (!first) sb.append(", ");
699
    sb.append("receivedOn:");
700
    sb.append(this.receivedOn);
701
    first = false;
702
    if (!first) sb.append(", ");
703
    sb.append("freightCharges:");
704
    sb.append(this.freightCharges);
705
    first = false;
11801 manish.sha 706
    if (!first) sb.append(", ");
707
    sb.append("purchaseComments:");
708
    if (this.purchaseComments == null) {
709
      sb.append("null");
710
    } else {
711
      sb.append(this.purchaseComments);
712
    }
713
    first = false;
4496 mandeep.dh 714
    sb.append(")");
715
    return sb.toString();
716
  }
717
 
718
  public void validate() throws org.apache.thrift.TException {
719
    // check for required fields
720
  }
721
 
722
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
723
    try {
724
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
725
    } catch (org.apache.thrift.TException te) {
726
      throw new java.io.IOException(te);
727
    }
728
  }
729
 
730
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
731
    try {
732
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
733
      __isset_bit_vector = new BitSet(1);
734
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
735
    } catch (org.apache.thrift.TException te) {
736
      throw new java.io.IOException(te);
737
    }
738
  }
739
 
740
}
741