Subversion Repositories SmartDukaan

Rev

Rev 483 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 483 Rev 684
Line 21... Line 21...
21
 
21
 
22
import org.apache.thrift.*;
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
24
import org.apache.thrift.protocol.*;
25
 
25
 
26
public class Transaction implements TBase<Transaction._Fields>, java.io.Serializable, Cloneable {
26
public class Transaction implements TBase<Transaction._Fields>, java.io.Serializable, Cloneable, Comparable<Transaction> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Transaction");
27
  private static final TStruct STRUCT_DESC = new TStruct("Transaction");
28
 
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField ORDERS_FIELD_DESC = new TField("orders", TType.LIST, (short)2);
30
  private static final TField ORDERS_FIELD_DESC = new TField("orders", TType.LIST, (short)2);
31
  private static final TField PAYMENT_INFO_FIELD_DESC = new TField("paymentInfo", TType.STRUCT, (short)3);
-
 
32
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)4);
31
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)3);
33
  private static final TField TRANSACTION_STATUS_FIELD_DESC = new TField("transactionStatus", TType.I32, (short)5);
32
  private static final TField TRANSACTION_STATUS_FIELD_DESC = new TField("transactionStatus", TType.I32, (short)4);
34
  private static final TField STATUS_DESCRIPTION_FIELD_DESC = new TField("statusDescription", TType.STRING, (short)6);
33
  private static final TField STATUS_DESCRIPTION_FIELD_DESC = new TField("statusDescription", TType.STRING, (short)5);
35
  private static final TField SHOPPING_CARTID_FIELD_DESC = new TField("shoppingCartid", TType.I64, (short)7);
34
  private static final TField SHOPPING_CARTID_FIELD_DESC = new TField("shoppingCartid", TType.I64, (short)6);
36
  private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customer_id", TType.I64, (short)8);
35
  private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customer_id", TType.I64, (short)7);
37
 
36
 
38
  private long id;
37
  private long id;
39
  private List<Order> orders;
38
  private List<Order> orders;
40
  private PaymentInfo paymentInfo;
-
 
41
  private long createdOn;
39
  private long createdOn;
42
  private TransactionStatus transactionStatus;
40
  private TransactionStatus transactionStatus;
43
  private String statusDescription;
41
  private String statusDescription;
44
  private long shoppingCartid;
42
  private long shoppingCartid;
45
  private long customer_id;
43
  private long customer_id;
46
 
44
 
47
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
45
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
48
  public enum _Fields implements TFieldIdEnum {
46
  public enum _Fields implements TFieldIdEnum {
49
    ID((short)1, "id"),
47
    ID((short)1, "id"),
50
    ORDERS((short)2, "orders"),
48
    ORDERS((short)2, "orders"),
51
    PAYMENT_INFO((short)3, "paymentInfo"),
-
 
52
    CREATED_ON((short)4, "createdOn"),
49
    CREATED_ON((short)3, "createdOn"),
53
    /**
50
    /**
54
     * 
51
     * 
55
     * @see TransactionStatus
52
     * @see TransactionStatus
56
     */
53
     */
57
    TRANSACTION_STATUS((short)5, "transactionStatus"),
54
    TRANSACTION_STATUS((short)4, "transactionStatus"),
58
    STATUS_DESCRIPTION((short)6, "statusDescription"),
55
    STATUS_DESCRIPTION((short)5, "statusDescription"),
59
    SHOPPING_CARTID((short)7, "shoppingCartid"),
56
    SHOPPING_CARTID((short)6, "shoppingCartid"),
60
    CUSTOMER_ID((short)8, "customer_id");
57
    CUSTOMER_ID((short)7, "customer_id");
61
 
58
 
62
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
59
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
63
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
60
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
64
 
61
 
65
    static {
62
    static {
Line 121... Line 118...
121
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
118
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
122
        new FieldValueMetaData(TType.I64)));
119
        new FieldValueMetaData(TType.I64)));
123
    put(_Fields.ORDERS, new FieldMetaData("orders", TFieldRequirementType.DEFAULT, 
120
    put(_Fields.ORDERS, new FieldMetaData("orders", TFieldRequirementType.DEFAULT, 
124
        new ListMetaData(TType.LIST, 
121
        new ListMetaData(TType.LIST, 
125
            new StructMetaData(TType.STRUCT, Order.class))));
122
            new StructMetaData(TType.STRUCT, Order.class))));
126
    put(_Fields.PAYMENT_INFO, new FieldMetaData("paymentInfo", TFieldRequirementType.DEFAULT, 
-
 
127
        new StructMetaData(TType.STRUCT, PaymentInfo.class)));
-
 
128
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
123
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
129
        new FieldValueMetaData(TType.I64)));
124
        new FieldValueMetaData(TType.I64)));
130
    put(_Fields.TRANSACTION_STATUS, new FieldMetaData("transactionStatus", TFieldRequirementType.DEFAULT, 
125
    put(_Fields.TRANSACTION_STATUS, new FieldMetaData("transactionStatus", TFieldRequirementType.DEFAULT, 
131
        new EnumMetaData(TType.ENUM, TransactionStatus.class)));
126
        new EnumMetaData(TType.ENUM, TransactionStatus.class)));
132
    put(_Fields.STATUS_DESCRIPTION, new FieldMetaData("statusDescription", TFieldRequirementType.DEFAULT, 
127
    put(_Fields.STATUS_DESCRIPTION, new FieldMetaData("statusDescription", TFieldRequirementType.DEFAULT, 
Line 145... Line 140...
145
  }
140
  }
146
 
141
 
147
  public Transaction(
142
  public Transaction(
148
    long id,
143
    long id,
149
    List<Order> orders,
144
    List<Order> orders,
150
    PaymentInfo paymentInfo,
-
 
151
    long createdOn,
145
    long createdOn,
152
    TransactionStatus transactionStatus,
146
    TransactionStatus transactionStatus,
153
    String statusDescription,
147
    String statusDescription,
154
    long shoppingCartid,
148
    long shoppingCartid,
155
    long customer_id)
149
    long customer_id)
156
  {
150
  {
157
    this();
151
    this();
158
    this.id = id;
152
    this.id = id;
159
    setIdIsSet(true);
153
    setIdIsSet(true);
160
    this.orders = orders;
154
    this.orders = orders;
161
    this.paymentInfo = paymentInfo;
-
 
162
    this.createdOn = createdOn;
155
    this.createdOn = createdOn;
163
    setCreatedOnIsSet(true);
156
    setCreatedOnIsSet(true);
164
    this.transactionStatus = transactionStatus;
157
    this.transactionStatus = transactionStatus;
165
    this.statusDescription = statusDescription;
158
    this.statusDescription = statusDescription;
166
    this.shoppingCartid = shoppingCartid;
159
    this.shoppingCartid = shoppingCartid;
Line 181... Line 174...
181
      for (Order other_element : other.orders) {
174
      for (Order other_element : other.orders) {
182
        __this__orders.add(new Order(other_element));
175
        __this__orders.add(new Order(other_element));
183
      }
176
      }
184
      this.orders = __this__orders;
177
      this.orders = __this__orders;
185
    }
178
    }
186
    if (other.isSetPaymentInfo()) {
-
 
187
      this.paymentInfo = new PaymentInfo(other.paymentInfo);
-
 
188
    }
-
 
189
    this.createdOn = other.createdOn;
179
    this.createdOn = other.createdOn;
190
    if (other.isSetTransactionStatus()) {
180
    if (other.isSetTransactionStatus()) {
191
      this.transactionStatus = other.transactionStatus;
181
      this.transactionStatus = other.transactionStatus;
192
    }
182
    }
193
    if (other.isSetStatusDescription()) {
183
    if (other.isSetStatusDescription()) {
Line 266... Line 256...
266
    if (!value) {
256
    if (!value) {
267
      this.orders = null;
257
      this.orders = null;
268
    }
258
    }
269
  }
259
  }
270
 
260
 
271
  public PaymentInfo getPaymentInfo() {
-
 
272
    return this.paymentInfo;
-
 
273
  }
-
 
274
 
-
 
275
  public Transaction setPaymentInfo(PaymentInfo paymentInfo) {
-
 
276
    this.paymentInfo = paymentInfo;
-
 
277
    return this;
-
 
278
  }
-
 
279
 
-
 
280
  public void unsetPaymentInfo() {
-
 
281
    this.paymentInfo = null;
-
 
282
  }
-
 
283
 
-
 
284
  /** Returns true if field paymentInfo is set (has been asigned a value) and false otherwise */
-
 
285
  public boolean isSetPaymentInfo() {
-
 
286
    return this.paymentInfo != null;
-
 
287
  }
-
 
288
 
-
 
289
  public void setPaymentInfoIsSet(boolean value) {
-
 
290
    if (!value) {
-
 
291
      this.paymentInfo = null;
-
 
292
    }
-
 
293
  }
-
 
294
 
-
 
295
  public long getCreatedOn() {
261
  public long getCreatedOn() {
296
    return this.createdOn;
262
    return this.createdOn;
297
  }
263
  }
298
 
264
 
299
  public Transaction setCreatedOn(long createdOn) {
265
  public Transaction setCreatedOn(long createdOn) {
Line 433... Line 399...
433
      } else {
399
      } else {
434
        setOrders((List<Order>)value);
400
        setOrders((List<Order>)value);
435
      }
401
      }
436
      break;
402
      break;
437
 
403
 
438
    case PAYMENT_INFO:
-
 
439
      if (value == null) {
-
 
440
        unsetPaymentInfo();
-
 
441
      } else {
-
 
442
        setPaymentInfo((PaymentInfo)value);
-
 
443
      }
-
 
444
      break;
-
 
445
 
-
 
446
    case CREATED_ON:
404
    case CREATED_ON:
447
      if (value == null) {
405
      if (value == null) {
448
        unsetCreatedOn();
406
        unsetCreatedOn();
449
      } else {
407
      } else {
450
        setCreatedOn((Long)value);
408
        setCreatedOn((Long)value);
Line 496... Line 454...
496
      return new Long(getId());
454
      return new Long(getId());
497
 
455
 
498
    case ORDERS:
456
    case ORDERS:
499
      return getOrders();
457
      return getOrders();
500
 
458
 
501
    case PAYMENT_INFO:
-
 
502
      return getPaymentInfo();
-
 
503
 
-
 
504
    case CREATED_ON:
459
    case CREATED_ON:
505
      return new Long(getCreatedOn());
460
      return new Long(getCreatedOn());
506
 
461
 
507
    case TRANSACTION_STATUS:
462
    case TRANSACTION_STATUS:
508
      return getTransactionStatus();
463
      return getTransactionStatus();
Line 529... Line 484...
529
    switch (field) {
484
    switch (field) {
530
    case ID:
485
    case ID:
531
      return isSetId();
486
      return isSetId();
532
    case ORDERS:
487
    case ORDERS:
533
      return isSetOrders();
488
      return isSetOrders();
534
    case PAYMENT_INFO:
-
 
535
      return isSetPaymentInfo();
-
 
536
    case CREATED_ON:
489
    case CREATED_ON:
537
      return isSetCreatedOn();
490
      return isSetCreatedOn();
538
    case TRANSACTION_STATUS:
491
    case TRANSACTION_STATUS:
539
      return isSetTransactionStatus();
492
      return isSetTransactionStatus();
540
    case STATUS_DESCRIPTION:
493
    case STATUS_DESCRIPTION:
Line 580... Line 533...
580
        return false;
533
        return false;
581
      if (!this.orders.equals(that.orders))
534
      if (!this.orders.equals(that.orders))
582
        return false;
535
        return false;
583
    }
536
    }
584
 
537
 
585
    boolean this_present_paymentInfo = true && this.isSetPaymentInfo();
-
 
586
    boolean that_present_paymentInfo = true && that.isSetPaymentInfo();
-
 
587
    if (this_present_paymentInfo || that_present_paymentInfo) {
-
 
588
      if (!(this_present_paymentInfo && that_present_paymentInfo))
-
 
589
        return false;
-
 
590
      if (!this.paymentInfo.equals(that.paymentInfo))
-
 
591
        return false;
-
 
592
    }
-
 
593
 
-
 
594
    boolean this_present_createdOn = true;
538
    boolean this_present_createdOn = true;
595
    boolean that_present_createdOn = true;
539
    boolean that_present_createdOn = true;
596
    if (this_present_createdOn || that_present_createdOn) {
540
    if (this_present_createdOn || that_present_createdOn) {
597
      if (!(this_present_createdOn && that_present_createdOn))
541
      if (!(this_present_createdOn && that_present_createdOn))
598
        return false;
542
        return false;
Line 642... Line 586...
642
  @Override
586
  @Override
643
  public int hashCode() {
587
  public int hashCode() {
644
    return 0;
588
    return 0;
645
  }
589
  }
646
 
590
 
-
 
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
 
647
  public void read(TProtocol iprot) throws TException {
658
  public void read(TProtocol iprot) throws TException {
648
    TField field;
659
    TField field;
649
    iprot.readStructBegin();
660
    iprot.readStructBegin();
650
    while (true)
661
    while (true)
651
    {
662
    {
Line 667... Line 678...
667
            }
678
            }
668
            break;
679
            break;
669
          case ORDERS:
680
          case ORDERS:
670
            if (field.type == TType.LIST) {
681
            if (field.type == TType.LIST) {
671
              {
682
              {
672
                TList _list9 = iprot.readListBegin();
683
                TList _list4 = iprot.readListBegin();
673
                this.orders = new ArrayList<Order>(_list9.size);
684
                this.orders = new ArrayList<Order>(_list4.size);
674
                for (int _i10 = 0; _i10 < _list9.size; ++_i10)
685
                for (int _i5 = 0; _i5 < _list4.size; ++_i5)
675
                {
686
                {
676
                  Order _elem11;
687
                  Order _elem6;
677
                  _elem11 = new Order();
688
                  _elem6 = new Order();
678
                  _elem11.read(iprot);
689
                  _elem6.read(iprot);
679
                  this.orders.add(_elem11);
690
                  this.orders.add(_elem6);
680
                }
691
                }
681
                iprot.readListEnd();
692
                iprot.readListEnd();
682
              }
693
              }
683
            } else { 
694
            } else { 
684
              TProtocolUtil.skip(iprot, field.type);
695
              TProtocolUtil.skip(iprot, field.type);
685
            }
696
            }
686
            break;
697
            break;
687
          case PAYMENT_INFO:
-
 
688
            if (field.type == TType.STRUCT) {
-
 
689
              this.paymentInfo = new PaymentInfo();
-
 
690
              this.paymentInfo.read(iprot);
-
 
691
            } else { 
-
 
692
              TProtocolUtil.skip(iprot, field.type);
-
 
693
            }
-
 
694
            break;
-
 
695
          case CREATED_ON:
698
          case CREATED_ON:
696
            if (field.type == TType.I64) {
699
            if (field.type == TType.I64) {
697
              this.createdOn = iprot.readI64();
700
              this.createdOn = iprot.readI64();
698
              setCreatedOnIsSet(true);
701
              setCreatedOnIsSet(true);
699
            } else { 
702
            } else { 
Line 747... Line 750...
747
    oprot.writeFieldEnd();
750
    oprot.writeFieldEnd();
748
    if (this.orders != null) {
751
    if (this.orders != null) {
749
      oprot.writeFieldBegin(ORDERS_FIELD_DESC);
752
      oprot.writeFieldBegin(ORDERS_FIELD_DESC);
750
      {
753
      {
751
        oprot.writeListBegin(new TList(TType.STRUCT, this.orders.size()));
754
        oprot.writeListBegin(new TList(TType.STRUCT, this.orders.size()));
752
        for (Order _iter12 : this.orders)
755
        for (Order _iter7 : this.orders)
753
        {
756
        {
754
          _iter12.write(oprot);
757
          _iter7.write(oprot);
755
        }
758
        }
756
        oprot.writeListEnd();
759
        oprot.writeListEnd();
757
      }
760
      }
758
      oprot.writeFieldEnd();
761
      oprot.writeFieldEnd();
759
    }
762
    }
760
    if (this.paymentInfo != null) {
-
 
761
      oprot.writeFieldBegin(PAYMENT_INFO_FIELD_DESC);
-
 
762
      this.paymentInfo.write(oprot);
-
 
763
      oprot.writeFieldEnd();
-
 
764
    }
-
 
765
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
763
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
766
    oprot.writeI64(this.createdOn);
764
    oprot.writeI64(this.createdOn);
767
    oprot.writeFieldEnd();
765
    oprot.writeFieldEnd();
768
    if (this.transactionStatus != null) {
766
    if (this.transactionStatus != null) {
769
      oprot.writeFieldBegin(TRANSACTION_STATUS_FIELD_DESC);
767
      oprot.writeFieldBegin(TRANSACTION_STATUS_FIELD_DESC);
Line 800... Line 798...
800
    } else {
798
    } else {
801
      sb.append(this.orders);
799
      sb.append(this.orders);
802
    }
800
    }
803
    first = false;
801
    first = false;
804
    if (!first) sb.append(", ");
802
    if (!first) sb.append(", ");
805
    sb.append("paymentInfo:");
-
 
806
    if (this.paymentInfo == null) {
-
 
807
      sb.append("null");
-
 
808
    } else {
-
 
809
      sb.append(this.paymentInfo);
-
 
810
    }
-
 
811
    first = false;
-
 
812
    if (!first) sb.append(", ");
-
 
813
    sb.append("createdOn:");
803
    sb.append("createdOn:");
814
    sb.append(this.createdOn);
804
    sb.append(this.createdOn);
815
    first = false;
805
    first = false;
816
    if (!first) sb.append(", ");
806
    if (!first) sb.append(", ");
817
    sb.append("transactionStatus:");
807
    sb.append("transactionStatus:");