Subversion Repositories SmartDukaan

Rev

Go to most recent revision | 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
 
684 chandransh 26
public class Transaction implements TBase<Transaction._Fields>, java.io.Serializable, Cloneable, Comparable<Transaction> {
68 ashish 27
  private static final TStruct STRUCT_DESC = new TStruct("Transaction");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
483 rajveer 30
  private static final TField ORDERS_FIELD_DESC = new TField("orders", TType.LIST, (short)2);
684 chandransh 31
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)3);
32
  private static final TField TRANSACTION_STATUS_FIELD_DESC = new TField("transactionStatus", TType.I32, (short)4);
33
  private static final TField STATUS_DESCRIPTION_FIELD_DESC = new TField("statusDescription", TType.STRING, (short)5);
34
  private static final TField SHOPPING_CARTID_FIELD_DESC = new TField("shoppingCartid", TType.I64, (short)6);
35
  private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customer_id", TType.I64, (short)7);
68 ashish 36
 
37
  private long id;
483 rajveer 38
  private List<Order> orders;
68 ashish 39
  private long createdOn;
40
  private TransactionStatus transactionStatus;
41
  private String statusDescription;
483 rajveer 42
  private long shoppingCartid;
68 ashish 43
  private long customer_id;
44
 
45
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
46
  public enum _Fields implements TFieldIdEnum {
47
    ID((short)1, "id"),
483 rajveer 48
    ORDERS((short)2, "orders"),
684 chandransh 49
    CREATED_ON((short)3, "createdOn"),
68 ashish 50
    /**
51
     * 
52
     * @see TransactionStatus
53
     */
684 chandransh 54
    TRANSACTION_STATUS((short)4, "transactionStatus"),
55
    STATUS_DESCRIPTION((short)5, "statusDescription"),
56
    SHOPPING_CARTID((short)6, "shoppingCartid"),
57
    CUSTOMER_ID((short)7, "customer_id");
68 ashish 58
 
59
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
60
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
61
 
62
    static {
63
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
64
        byId.put((int)field._thriftId, field);
65
        byName.put(field.getFieldName(), field);
66
      }
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, or null if its not found.
71
     */
72
    public static _Fields findByThriftId(int fieldId) {
73
      return byId.get(fieldId);
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches fieldId, throwing an exception
78
     * if it is not found.
79
     */
80
    public static _Fields findByThriftIdOrThrow(int fieldId) {
81
      _Fields fields = findByThriftId(fieldId);
82
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
83
      return fields;
84
    }
85
 
86
    /**
87
     * Find the _Fields constant that matches name, or null if its not found.
88
     */
89
    public static _Fields findByName(String name) {
90
      return byName.get(name);
91
    }
92
 
93
    private final short _thriftId;
94
    private final String _fieldName;
95
 
96
    _Fields(short thriftId, String fieldName) {
97
      _thriftId = thriftId;
98
      _fieldName = fieldName;
99
    }
100
 
101
    public short getThriftFieldId() {
102
      return _thriftId;
103
    }
104
 
105
    public String getFieldName() {
106
      return _fieldName;
107
    }
108
  }
109
 
110
  // isset id assignments
111
  private static final int __ID_ISSET_ID = 0;
112
  private static final int __CREATEDON_ISSET_ID = 1;
483 rajveer 113
  private static final int __SHOPPINGCARTID_ISSET_ID = 2;
68 ashish 114
  private static final int __CUSTOMER_ID_ISSET_ID = 3;
483 rajveer 115
  private BitSet __isset_bit_vector = new BitSet(4);
68 ashish 116
 
117
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
118
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.I64)));
483 rajveer 120
    put(_Fields.ORDERS, new FieldMetaData("orders", TFieldRequirementType.DEFAULT, 
121
        new ListMetaData(TType.LIST, 
122
            new StructMetaData(TType.STRUCT, Order.class))));
68 ashish 123
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
124
        new FieldValueMetaData(TType.I64)));
125
    put(_Fields.TRANSACTION_STATUS, new FieldMetaData("transactionStatus", TFieldRequirementType.DEFAULT, 
126
        new EnumMetaData(TType.ENUM, TransactionStatus.class)));
127
    put(_Fields.STATUS_DESCRIPTION, new FieldMetaData("statusDescription", TFieldRequirementType.DEFAULT, 
128
        new FieldValueMetaData(TType.STRING)));
132 ashish 129
    put(_Fields.SHOPPING_CARTID, new FieldMetaData("shoppingCartid", TFieldRequirementType.DEFAULT, 
130
        new FieldValueMetaData(TType.I64)));
483 rajveer 131
    put(_Fields.CUSTOMER_ID, new FieldMetaData("customer_id", TFieldRequirementType.DEFAULT, 
358 ashish 132
        new FieldValueMetaData(TType.I64)));
68 ashish 133
  }});
134
 
135
  static {
136
    FieldMetaData.addStructMetaDataMap(Transaction.class, metaDataMap);
137
  }
138
 
139
  public Transaction() {
140
  }
141
 
142
  public Transaction(
143
    long id,
483 rajveer 144
    List<Order> orders,
68 ashish 145
    long createdOn,
146
    TransactionStatus transactionStatus,
147
    String statusDescription,
358 ashish 148
    long shoppingCartid,
483 rajveer 149
    long customer_id)
68 ashish 150
  {
151
    this();
152
    this.id = id;
153
    setIdIsSet(true);
483 rajveer 154
    this.orders = orders;
68 ashish 155
    this.createdOn = createdOn;
156
    setCreatedOnIsSet(true);
157
    this.transactionStatus = transactionStatus;
158
    this.statusDescription = statusDescription;
483 rajveer 159
    this.shoppingCartid = shoppingCartid;
160
    setShoppingCartidIsSet(true);
68 ashish 161
    this.customer_id = customer_id;
162
    setCustomer_idIsSet(true);
163
  }
164
 
165
  /**
166
   * Performs a deep copy on <i>other</i>.
167
   */
168
  public Transaction(Transaction other) {
169
    __isset_bit_vector.clear();
170
    __isset_bit_vector.or(other.__isset_bit_vector);
171
    this.id = other.id;
483 rajveer 172
    if (other.isSetOrders()) {
173
      List<Order> __this__orders = new ArrayList<Order>();
174
      for (Order other_element : other.orders) {
175
        __this__orders.add(new Order(other_element));
176
      }
177
      this.orders = __this__orders;
68 ashish 178
    }
179
    this.createdOn = other.createdOn;
180
    if (other.isSetTransactionStatus()) {
181
      this.transactionStatus = other.transactionStatus;
182
    }
183
    if (other.isSetStatusDescription()) {
184
      this.statusDescription = other.statusDescription;
185
    }
483 rajveer 186
    this.shoppingCartid = other.shoppingCartid;
68 ashish 187
    this.customer_id = other.customer_id;
188
  }
189
 
190
  public Transaction deepCopy() {
191
    return new Transaction(this);
192
  }
193
 
194
  @Deprecated
195
  public Transaction clone() {
196
    return new Transaction(this);
197
  }
198
 
199
  public long getId() {
200
    return this.id;
201
  }
202
 
203
  public Transaction setId(long id) {
204
    this.id = id;
205
    setIdIsSet(true);
206
    return this;
207
  }
208
 
209
  public void unsetId() {
210
    __isset_bit_vector.clear(__ID_ISSET_ID);
211
  }
212
 
213
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
214
  public boolean isSetId() {
215
    return __isset_bit_vector.get(__ID_ISSET_ID);
216
  }
217
 
218
  public void setIdIsSet(boolean value) {
219
    __isset_bit_vector.set(__ID_ISSET_ID, value);
220
  }
221
 
483 rajveer 222
  public int getOrdersSize() {
223
    return (this.orders == null) ? 0 : this.orders.size();
68 ashish 224
  }
225
 
483 rajveer 226
  public java.util.Iterator<Order> getOrdersIterator() {
227
    return (this.orders == null) ? null : this.orders.iterator();
68 ashish 228
  }
229
 
483 rajveer 230
  public void addToOrders(Order elem) {
231
    if (this.orders == null) {
232
      this.orders = new ArrayList<Order>();
68 ashish 233
    }
483 rajveer 234
    this.orders.add(elem);
68 ashish 235
  }
236
 
483 rajveer 237
  public List<Order> getOrders() {
238
    return this.orders;
68 ashish 239
  }
240
 
483 rajveer 241
  public Transaction setOrders(List<Order> orders) {
242
    this.orders = orders;
68 ashish 243
    return this;
244
  }
245
 
483 rajveer 246
  public void unsetOrders() {
247
    this.orders = null;
68 ashish 248
  }
249
 
483 rajveer 250
  /** Returns true if field orders is set (has been asigned a value) and false otherwise */
251
  public boolean isSetOrders() {
252
    return this.orders != null;
68 ashish 253
  }
254
 
483 rajveer 255
  public void setOrdersIsSet(boolean value) {
68 ashish 256
    if (!value) {
483 rajveer 257
      this.orders = null;
68 ashish 258
    }
259
  }
260
 
261
  public long getCreatedOn() {
262
    return this.createdOn;
263
  }
264
 
265
  public Transaction setCreatedOn(long createdOn) {
266
    this.createdOn = createdOn;
267
    setCreatedOnIsSet(true);
268
    return this;
269
  }
270
 
271
  public void unsetCreatedOn() {
272
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
273
  }
274
 
275
  /** Returns true if field createdOn is set (has been asigned a value) and false otherwise */
276
  public boolean isSetCreatedOn() {
277
    return __isset_bit_vector.get(__CREATEDON_ISSET_ID);
278
  }
279
 
280
  public void setCreatedOnIsSet(boolean value) {
281
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
282
  }
283
 
284
  /**
285
   * 
286
   * @see TransactionStatus
287
   */
288
  public TransactionStatus getTransactionStatus() {
289
    return this.transactionStatus;
290
  }
291
 
292
  /**
293
   * 
294
   * @see TransactionStatus
295
   */
296
  public Transaction setTransactionStatus(TransactionStatus transactionStatus) {
297
    this.transactionStatus = transactionStatus;
298
    return this;
299
  }
300
 
301
  public void unsetTransactionStatus() {
302
    this.transactionStatus = null;
303
  }
304
 
305
  /** Returns true if field transactionStatus is set (has been asigned a value) and false otherwise */
306
  public boolean isSetTransactionStatus() {
307
    return this.transactionStatus != null;
308
  }
309
 
310
  public void setTransactionStatusIsSet(boolean value) {
311
    if (!value) {
312
      this.transactionStatus = null;
313
    }
314
  }
315
 
316
  public String getStatusDescription() {
317
    return this.statusDescription;
318
  }
319
 
320
  public Transaction setStatusDescription(String statusDescription) {
321
    this.statusDescription = statusDescription;
322
    return this;
323
  }
324
 
325
  public void unsetStatusDescription() {
326
    this.statusDescription = null;
327
  }
328
 
329
  /** Returns true if field statusDescription is set (has been asigned a value) and false otherwise */
330
  public boolean isSetStatusDescription() {
331
    return this.statusDescription != null;
332
  }
333
 
334
  public void setStatusDescriptionIsSet(boolean value) {
335
    if (!value) {
336
      this.statusDescription = null;
337
    }
338
  }
339
 
132 ashish 340
  public long getShoppingCartid() {
341
    return this.shoppingCartid;
342
  }
343
 
344
  public Transaction setShoppingCartid(long shoppingCartid) {
345
    this.shoppingCartid = shoppingCartid;
346
    setShoppingCartidIsSet(true);
347
    return this;
348
  }
349
 
350
  public void unsetShoppingCartid() {
351
    __isset_bit_vector.clear(__SHOPPINGCARTID_ISSET_ID);
352
  }
353
 
354
  /** Returns true if field shoppingCartid is set (has been asigned a value) and false otherwise */
355
  public boolean isSetShoppingCartid() {
356
    return __isset_bit_vector.get(__SHOPPINGCARTID_ISSET_ID);
357
  }
358
 
359
  public void setShoppingCartidIsSet(boolean value) {
360
    __isset_bit_vector.set(__SHOPPINGCARTID_ISSET_ID, value);
361
  }
362
 
483 rajveer 363
  public long getCustomer_id() {
364
    return this.customer_id;
358 ashish 365
  }
366
 
483 rajveer 367
  public Transaction setCustomer_id(long customer_id) {
368
    this.customer_id = customer_id;
369
    setCustomer_idIsSet(true);
358 ashish 370
    return this;
371
  }
372
 
483 rajveer 373
  public void unsetCustomer_id() {
374
    __isset_bit_vector.clear(__CUSTOMER_ID_ISSET_ID);
358 ashish 375
  }
376
 
483 rajveer 377
  /** Returns true if field customer_id is set (has been asigned a value) and false otherwise */
378
  public boolean isSetCustomer_id() {
379
    return __isset_bit_vector.get(__CUSTOMER_ID_ISSET_ID);
358 ashish 380
  }
381
 
483 rajveer 382
  public void setCustomer_idIsSet(boolean value) {
383
    __isset_bit_vector.set(__CUSTOMER_ID_ISSET_ID, value);
358 ashish 384
  }
385
 
68 ashish 386
  public void setFieldValue(_Fields field, Object value) {
387
    switch (field) {
388
    case ID:
389
      if (value == null) {
390
        unsetId();
391
      } else {
392
        setId((Long)value);
393
      }
394
      break;
395
 
483 rajveer 396
    case ORDERS:
68 ashish 397
      if (value == null) {
483 rajveer 398
        unsetOrders();
68 ashish 399
      } else {
483 rajveer 400
        setOrders((List<Order>)value);
68 ashish 401
      }
402
      break;
403
 
404
    case CREATED_ON:
405
      if (value == null) {
406
        unsetCreatedOn();
407
      } else {
408
        setCreatedOn((Long)value);
409
      }
410
      break;
411
 
412
    case TRANSACTION_STATUS:
413
      if (value == null) {
414
        unsetTransactionStatus();
415
      } else {
416
        setTransactionStatus((TransactionStatus)value);
417
      }
418
      break;
419
 
420
    case STATUS_DESCRIPTION:
421
      if (value == null) {
422
        unsetStatusDescription();
423
      } else {
424
        setStatusDescription((String)value);
425
      }
426
      break;
427
 
132 ashish 428
    case SHOPPING_CARTID:
429
      if (value == null) {
430
        unsetShoppingCartid();
431
      } else {
432
        setShoppingCartid((Long)value);
433
      }
434
      break;
435
 
483 rajveer 436
    case CUSTOMER_ID:
358 ashish 437
      if (value == null) {
483 rajveer 438
        unsetCustomer_id();
358 ashish 439
      } else {
483 rajveer 440
        setCustomer_id((Long)value);
358 ashish 441
      }
442
      break;
443
 
68 ashish 444
    }
445
  }
446
 
447
  public void setFieldValue(int fieldID, Object value) {
448
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
449
  }
450
 
451
  public Object getFieldValue(_Fields field) {
452
    switch (field) {
453
    case ID:
454
      return new Long(getId());
455
 
483 rajveer 456
    case ORDERS:
457
      return getOrders();
68 ashish 458
 
459
    case CREATED_ON:
460
      return new Long(getCreatedOn());
461
 
462
    case TRANSACTION_STATUS:
463
      return getTransactionStatus();
464
 
465
    case STATUS_DESCRIPTION:
466
      return getStatusDescription();
467
 
132 ashish 468
    case SHOPPING_CARTID:
469
      return new Long(getShoppingCartid());
470
 
483 rajveer 471
    case CUSTOMER_ID:
472
      return new Long(getCustomer_id());
358 ashish 473
 
68 ashish 474
    }
475
    throw new IllegalStateException();
476
  }
477
 
478
  public Object getFieldValue(int fieldId) {
479
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
480
  }
481
 
482
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
483
  public boolean isSet(_Fields field) {
484
    switch (field) {
485
    case ID:
486
      return isSetId();
483 rajveer 487
    case ORDERS:
488
      return isSetOrders();
68 ashish 489
    case CREATED_ON:
490
      return isSetCreatedOn();
491
    case TRANSACTION_STATUS:
492
      return isSetTransactionStatus();
493
    case STATUS_DESCRIPTION:
494
      return isSetStatusDescription();
483 rajveer 495
    case SHOPPING_CARTID:
496
      return isSetShoppingCartid();
68 ashish 497
    case CUSTOMER_ID:
498
      return isSetCustomer_id();
499
    }
500
    throw new IllegalStateException();
501
  }
502
 
503
  public boolean isSet(int fieldID) {
504
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
505
  }
506
 
507
  @Override
508
  public boolean equals(Object that) {
509
    if (that == null)
510
      return false;
511
    if (that instanceof Transaction)
512
      return this.equals((Transaction)that);
513
    return false;
514
  }
515
 
516
  public boolean equals(Transaction that) {
517
    if (that == null)
518
      return false;
519
 
520
    boolean this_present_id = true;
521
    boolean that_present_id = true;
522
    if (this_present_id || that_present_id) {
523
      if (!(this_present_id && that_present_id))
524
        return false;
525
      if (this.id != that.id)
526
        return false;
527
    }
528
 
483 rajveer 529
    boolean this_present_orders = true && this.isSetOrders();
530
    boolean that_present_orders = true && that.isSetOrders();
531
    if (this_present_orders || that_present_orders) {
532
      if (!(this_present_orders && that_present_orders))
68 ashish 533
        return false;
483 rajveer 534
      if (!this.orders.equals(that.orders))
68 ashish 535
        return false;
536
    }
537
 
538
    boolean this_present_createdOn = true;
539
    boolean that_present_createdOn = true;
540
    if (this_present_createdOn || that_present_createdOn) {
541
      if (!(this_present_createdOn && that_present_createdOn))
542
        return false;
543
      if (this.createdOn != that.createdOn)
544
        return false;
545
    }
546
 
547
    boolean this_present_transactionStatus = true && this.isSetTransactionStatus();
548
    boolean that_present_transactionStatus = true && that.isSetTransactionStatus();
549
    if (this_present_transactionStatus || that_present_transactionStatus) {
550
      if (!(this_present_transactionStatus && that_present_transactionStatus))
551
        return false;
552
      if (!this.transactionStatus.equals(that.transactionStatus))
553
        return false;
554
    }
555
 
556
    boolean this_present_statusDescription = true && this.isSetStatusDescription();
557
    boolean that_present_statusDescription = true && that.isSetStatusDescription();
558
    if (this_present_statusDescription || that_present_statusDescription) {
559
      if (!(this_present_statusDescription && that_present_statusDescription))
560
        return false;
561
      if (!this.statusDescription.equals(that.statusDescription))
562
        return false;
563
    }
564
 
132 ashish 565
    boolean this_present_shoppingCartid = true;
566
    boolean that_present_shoppingCartid = true;
567
    if (this_present_shoppingCartid || that_present_shoppingCartid) {
568
      if (!(this_present_shoppingCartid && that_present_shoppingCartid))
569
        return false;
570
      if (this.shoppingCartid != that.shoppingCartid)
571
        return false;
572
    }
573
 
483 rajveer 574
    boolean this_present_customer_id = true;
575
    boolean that_present_customer_id = true;
576
    if (this_present_customer_id || that_present_customer_id) {
577
      if (!(this_present_customer_id && that_present_customer_id))
358 ashish 578
        return false;
483 rajveer 579
      if (this.customer_id != that.customer_id)
358 ashish 580
        return false;
581
    }
582
 
68 ashish 583
    return true;
584
  }
585
 
586
  @Override
587
  public int hashCode() {
588
    return 0;
589
  }
590
 
684 chandransh 591
  public int compareTo(Transaction other) {
592
    if (!getClass().equals(other.getClass())) {
593
      return getClass().getName().compareTo(other.getClass().getName());
594
    }
595
 
596
    int lastComparison = 0;
597
    Transaction typedOther = (Transaction)other;
598
 
599
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
600
    if (lastComparison != 0) {
601
      return lastComparison;
602
    }
603
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
604
    if (lastComparison != 0) {
605
      return lastComparison;
606
    }
607
    lastComparison = Boolean.valueOf(isSetOrders()).compareTo(isSetOrders());
608
    if (lastComparison != 0) {
609
      return lastComparison;
610
    }
611
    lastComparison = TBaseHelper.compareTo(orders, typedOther.orders);
612
    if (lastComparison != 0) {
613
      return lastComparison;
614
    }
615
    lastComparison = Boolean.valueOf(isSetCreatedOn()).compareTo(isSetCreatedOn());
616
    if (lastComparison != 0) {
617
      return lastComparison;
618
    }
619
    lastComparison = TBaseHelper.compareTo(createdOn, typedOther.createdOn);
620
    if (lastComparison != 0) {
621
      return lastComparison;
622
    }
623
    lastComparison = Boolean.valueOf(isSetTransactionStatus()).compareTo(isSetTransactionStatus());
624
    if (lastComparison != 0) {
625
      return lastComparison;
626
    }
627
    lastComparison = TBaseHelper.compareTo(transactionStatus, typedOther.transactionStatus);
628
    if (lastComparison != 0) {
629
      return lastComparison;
630
    }
631
    lastComparison = Boolean.valueOf(isSetStatusDescription()).compareTo(isSetStatusDescription());
632
    if (lastComparison != 0) {
633
      return lastComparison;
634
    }
635
    lastComparison = TBaseHelper.compareTo(statusDescription, typedOther.statusDescription);
636
    if (lastComparison != 0) {
637
      return lastComparison;
638
    }
639
    lastComparison = Boolean.valueOf(isSetShoppingCartid()).compareTo(isSetShoppingCartid());
640
    if (lastComparison != 0) {
641
      return lastComparison;
642
    }
643
    lastComparison = TBaseHelper.compareTo(shoppingCartid, typedOther.shoppingCartid);
644
    if (lastComparison != 0) {
645
      return lastComparison;
646
    }
647
    lastComparison = Boolean.valueOf(isSetCustomer_id()).compareTo(isSetCustomer_id());
648
    if (lastComparison != 0) {
649
      return lastComparison;
650
    }
651
    lastComparison = TBaseHelper.compareTo(customer_id, typedOther.customer_id);
652
    if (lastComparison != 0) {
653
      return lastComparison;
654
    }
655
    return 0;
656
  }
657
 
68 ashish 658
  public void read(TProtocol iprot) throws TException {
659
    TField field;
660
    iprot.readStructBegin();
661
    while (true)
662
    {
663
      field = iprot.readFieldBegin();
664
      if (field.type == TType.STOP) { 
665
        break;
666
      }
667
      _Fields fieldId = _Fields.findByThriftId(field.id);
668
      if (fieldId == null) {
669
        TProtocolUtil.skip(iprot, field.type);
670
      } else {
671
        switch (fieldId) {
672
          case ID:
673
            if (field.type == TType.I64) {
674
              this.id = iprot.readI64();
675
              setIdIsSet(true);
676
            } else { 
677
              TProtocolUtil.skip(iprot, field.type);
678
            }
679
            break;
483 rajveer 680
          case ORDERS:
681
            if (field.type == TType.LIST) {
682
              {
684 chandransh 683
                TList _list4 = iprot.readListBegin();
684
                this.orders = new ArrayList<Order>(_list4.size);
685
                for (int _i5 = 0; _i5 < _list4.size; ++_i5)
483 rajveer 686
                {
684 chandransh 687
                  Order _elem6;
688
                  _elem6 = new Order();
689
                  _elem6.read(iprot);
690
                  this.orders.add(_elem6);
483 rajveer 691
                }
692
                iprot.readListEnd();
693
              }
68 ashish 694
            } else { 
695
              TProtocolUtil.skip(iprot, field.type);
696
            }
697
            break;
698
          case CREATED_ON:
699
            if (field.type == TType.I64) {
700
              this.createdOn = iprot.readI64();
701
              setCreatedOnIsSet(true);
702
            } else { 
703
              TProtocolUtil.skip(iprot, field.type);
704
            }
705
            break;
706
          case TRANSACTION_STATUS:
707
            if (field.type == TType.I32) {
708
              this.transactionStatus = TransactionStatus.findByValue(iprot.readI32());
709
            } else { 
710
              TProtocolUtil.skip(iprot, field.type);
711
            }
712
            break;
713
          case STATUS_DESCRIPTION:
714
            if (field.type == TType.STRING) {
715
              this.statusDescription = iprot.readString();
716
            } else { 
717
              TProtocolUtil.skip(iprot, field.type);
718
            }
719
            break;
132 ashish 720
          case SHOPPING_CARTID:
721
            if (field.type == TType.I64) {
722
              this.shoppingCartid = iprot.readI64();
723
              setShoppingCartidIsSet(true);
724
            } else { 
725
              TProtocolUtil.skip(iprot, field.type);
726
            }
727
            break;
483 rajveer 728
          case CUSTOMER_ID:
358 ashish 729
            if (field.type == TType.I64) {
483 rajveer 730
              this.customer_id = iprot.readI64();
731
              setCustomer_idIsSet(true);
358 ashish 732
            } else { 
733
              TProtocolUtil.skip(iprot, field.type);
734
            }
735
            break;
68 ashish 736
        }
737
        iprot.readFieldEnd();
738
      }
739
    }
740
    iprot.readStructEnd();
741
    validate();
742
  }
743
 
744
  public void write(TProtocol oprot) throws TException {
745
    validate();
746
 
747
    oprot.writeStructBegin(STRUCT_DESC);
748
    oprot.writeFieldBegin(ID_FIELD_DESC);
749
    oprot.writeI64(this.id);
750
    oprot.writeFieldEnd();
483 rajveer 751
    if (this.orders != null) {
752
      oprot.writeFieldBegin(ORDERS_FIELD_DESC);
753
      {
754
        oprot.writeListBegin(new TList(TType.STRUCT, this.orders.size()));
684 chandransh 755
        for (Order _iter7 : this.orders)
483 rajveer 756
        {
684 chandransh 757
          _iter7.write(oprot);
483 rajveer 758
        }
759
        oprot.writeListEnd();
760
      }
68 ashish 761
      oprot.writeFieldEnd();
762
    }
763
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
764
    oprot.writeI64(this.createdOn);
765
    oprot.writeFieldEnd();
766
    if (this.transactionStatus != null) {
767
      oprot.writeFieldBegin(TRANSACTION_STATUS_FIELD_DESC);
768
      oprot.writeI32(this.transactionStatus.getValue());
769
      oprot.writeFieldEnd();
770
    }
771
    if (this.statusDescription != null) {
772
      oprot.writeFieldBegin(STATUS_DESCRIPTION_FIELD_DESC);
773
      oprot.writeString(this.statusDescription);
774
      oprot.writeFieldEnd();
775
    }
132 ashish 776
    oprot.writeFieldBegin(SHOPPING_CARTID_FIELD_DESC);
777
    oprot.writeI64(this.shoppingCartid);
778
    oprot.writeFieldEnd();
483 rajveer 779
    oprot.writeFieldBegin(CUSTOMER_ID_FIELD_DESC);
780
    oprot.writeI64(this.customer_id);
358 ashish 781
    oprot.writeFieldEnd();
68 ashish 782
    oprot.writeFieldStop();
783
    oprot.writeStructEnd();
784
  }
785
 
786
  @Override
787
  public String toString() {
788
    StringBuilder sb = new StringBuilder("Transaction(");
789
    boolean first = true;
790
 
791
    sb.append("id:");
792
    sb.append(this.id);
793
    first = false;
794
    if (!first) sb.append(", ");
483 rajveer 795
    sb.append("orders:");
796
    if (this.orders == null) {
68 ashish 797
      sb.append("null");
798
    } else {
483 rajveer 799
      sb.append(this.orders);
68 ashish 800
    }
801
    first = false;
802
    if (!first) sb.append(", ");
803
    sb.append("createdOn:");
804
    sb.append(this.createdOn);
805
    first = false;
806
    if (!first) sb.append(", ");
807
    sb.append("transactionStatus:");
808
    if (this.transactionStatus == null) {
809
      sb.append("null");
810
    } else {
811
      String transactionStatus_name = transactionStatus.name();
812
      if (transactionStatus_name != null) {
813
        sb.append(transactionStatus_name);
814
        sb.append(" (");
815
      }
816
      sb.append(this.transactionStatus);
817
      if (transactionStatus_name != null) {
818
        sb.append(")");
819
      }
820
    }
821
    first = false;
822
    if (!first) sb.append(", ");
823
    sb.append("statusDescription:");
824
    if (this.statusDescription == null) {
825
      sb.append("null");
826
    } else {
827
      sb.append(this.statusDescription);
828
    }
829
    first = false;
830
    if (!first) sb.append(", ");
132 ashish 831
    sb.append("shoppingCartid:");
832
    sb.append(this.shoppingCartid);
833
    first = false;
358 ashish 834
    if (!first) sb.append(", ");
483 rajveer 835
    sb.append("customer_id:");
836
    sb.append(this.customer_id);
358 ashish 837
    first = false;
68 ashish 838
    sb.append(")");
839
    return sb.toString();
840
  }
841
 
842
  public void validate() throws TException {
843
    // check for required fields
844
  }
845
 
846
}
847