Subversion Repositories SmartDukaan

Rev

Rev 68 | Rev 358 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.order;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

public class Transaction implements TBase<Transaction._Fields>, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("Transaction");

  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
  private static final TField ORDER_INFO_FIELD_DESC = new TField("orderInfo", TType.STRUCT, (short)2);
  private static final TField SHIPMENT_INFO_FIELD_DESC = new TField("shipmentInfo", TType.STRUCT, (short)3);
  private static final TField BILLING_INFO_FIELD_DESC = new TField("billingInfo", TType.STRUCT, (short)4);
  private static final TField PAYMENT_INFO_FIELD_DESC = new TField("paymentInfo", TType.STRUCT, (short)5);
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)6);
  private static final TField EXPECTED_DELIVERY_TIME_FIELD_DESC = new TField("expectedDeliveryTime", TType.I64, (short)7);
  private static final TField TRANSACTION_STATUS_FIELD_DESC = new TField("transactionStatus", TType.I32, (short)8);
  private static final TField STATUS_DESCRIPTION_FIELD_DESC = new TField("statusDescription", TType.STRING, (short)9);
  private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customer_id", TType.I64, (short)10);
  private static final TField SHOPPING_CARTID_FIELD_DESC = new TField("shoppingCartid", TType.I64, (short)11);

  private long id;
  private OrderInfo orderInfo;
  private ShipmentInfo shipmentInfo;
  private BillingInfo billingInfo;
  private PaymentInfo paymentInfo;
  private long createdOn;
  private long expectedDeliveryTime;
  private TransactionStatus transactionStatus;
  private String statusDescription;
  private long customer_id;
  private long shoppingCartid;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ID((short)1, "id"),
    ORDER_INFO((short)2, "orderInfo"),
    SHIPMENT_INFO((short)3, "shipmentInfo"),
    BILLING_INFO((short)4, "billingInfo"),
    PAYMENT_INFO((short)5, "paymentInfo"),
    CREATED_ON((short)6, "createdOn"),
    EXPECTED_DELIVERY_TIME((short)7, "expectedDeliveryTime"),
    /**
     * 
     * @see TransactionStatus
     */
    TRANSACTION_STATUS((short)8, "transactionStatus"),
    STATUS_DESCRIPTION((short)9, "statusDescription"),
    CUSTOMER_ID((short)10, "customer_id"),
    SHOPPING_CARTID((short)11, "shoppingCartid");

    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byId.put((int)field._thriftId, field);
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __ID_ISSET_ID = 0;
  private static final int __CREATEDON_ISSET_ID = 1;
  private static final int __EXPECTEDDELIVERYTIME_ISSET_ID = 2;
  private static final int __CUSTOMER_ID_ISSET_ID = 3;
  private static final int __SHOPPINGCARTID_ISSET_ID = 4;
  private BitSet __isset_bit_vector = new BitSet(5);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ORDER_INFO, new FieldMetaData("orderInfo", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, OrderInfo.class)));
    put(_Fields.SHIPMENT_INFO, new FieldMetaData("shipmentInfo", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, ShipmentInfo.class)));
    put(_Fields.BILLING_INFO, new FieldMetaData("billingInfo", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, BillingInfo.class)));
    put(_Fields.PAYMENT_INFO, new FieldMetaData("paymentInfo", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, PaymentInfo.class)));
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.EXPECTED_DELIVERY_TIME, new FieldMetaData("expectedDeliveryTime", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.TRANSACTION_STATUS, new FieldMetaData("transactionStatus", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, TransactionStatus.class)));
    put(_Fields.STATUS_DESCRIPTION, new FieldMetaData("statusDescription", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.CUSTOMER_ID, new FieldMetaData("customer_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.SHOPPING_CARTID, new FieldMetaData("shoppingCartid", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(Transaction.class, metaDataMap);
  }

  public Transaction() {
  }

  public Transaction(
    long id,
    OrderInfo orderInfo,
    ShipmentInfo shipmentInfo,
    BillingInfo billingInfo,
    PaymentInfo paymentInfo,
    long createdOn,
    long expectedDeliveryTime,
    TransactionStatus transactionStatus,
    String statusDescription,
    long customer_id,
    long shoppingCartid)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.orderInfo = orderInfo;
    this.shipmentInfo = shipmentInfo;
    this.billingInfo = billingInfo;
    this.paymentInfo = paymentInfo;
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    this.expectedDeliveryTime = expectedDeliveryTime;
    setExpectedDeliveryTimeIsSet(true);
    this.transactionStatus = transactionStatus;
    this.statusDescription = statusDescription;
    this.customer_id = customer_id;
    setCustomer_idIsSet(true);
    this.shoppingCartid = shoppingCartid;
    setShoppingCartidIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Transaction(Transaction other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    if (other.isSetOrderInfo()) {
      this.orderInfo = new OrderInfo(other.orderInfo);
    }
    if (other.isSetShipmentInfo()) {
      this.shipmentInfo = new ShipmentInfo(other.shipmentInfo);
    }
    if (other.isSetBillingInfo()) {
      this.billingInfo = new BillingInfo(other.billingInfo);
    }
    if (other.isSetPaymentInfo()) {
      this.paymentInfo = new PaymentInfo(other.paymentInfo);
    }
    this.createdOn = other.createdOn;
    this.expectedDeliveryTime = other.expectedDeliveryTime;
    if (other.isSetTransactionStatus()) {
      this.transactionStatus = other.transactionStatus;
    }
    if (other.isSetStatusDescription()) {
      this.statusDescription = other.statusDescription;
    }
    this.customer_id = other.customer_id;
    this.shoppingCartid = other.shoppingCartid;
  }

  public Transaction deepCopy() {
    return new Transaction(this);
  }

  @Deprecated
  public Transaction clone() {
    return new Transaction(this);
  }

  public long getId() {
    return this.id;
  }

  public Transaction setId(long id) {
    this.id = id;
    setIdIsSet(true);
    return this;
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been asigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  public OrderInfo getOrderInfo() {
    return this.orderInfo;
  }

  public Transaction setOrderInfo(OrderInfo orderInfo) {
    this.orderInfo = orderInfo;
    return this;
  }

  public void unsetOrderInfo() {
    this.orderInfo = null;
  }

  /** Returns true if field orderInfo is set (has been asigned a value) and false otherwise */
  public boolean isSetOrderInfo() {
    return this.orderInfo != null;
  }

  public void setOrderInfoIsSet(boolean value) {
    if (!value) {
      this.orderInfo = null;
    }
  }

  public ShipmentInfo getShipmentInfo() {
    return this.shipmentInfo;
  }

  public Transaction setShipmentInfo(ShipmentInfo shipmentInfo) {
    this.shipmentInfo = shipmentInfo;
    return this;
  }

  public void unsetShipmentInfo() {
    this.shipmentInfo = null;
  }

  /** Returns true if field shipmentInfo is set (has been asigned a value) and false otherwise */
  public boolean isSetShipmentInfo() {
    return this.shipmentInfo != null;
  }

  public void setShipmentInfoIsSet(boolean value) {
    if (!value) {
      this.shipmentInfo = null;
    }
  }

  public BillingInfo getBillingInfo() {
    return this.billingInfo;
  }

  public Transaction setBillingInfo(BillingInfo billingInfo) {
    this.billingInfo = billingInfo;
    return this;
  }

  public void unsetBillingInfo() {
    this.billingInfo = null;
  }

  /** Returns true if field billingInfo is set (has been asigned a value) and false otherwise */
  public boolean isSetBillingInfo() {
    return this.billingInfo != null;
  }

  public void setBillingInfoIsSet(boolean value) {
    if (!value) {
      this.billingInfo = null;
    }
  }

  public PaymentInfo getPaymentInfo() {
    return this.paymentInfo;
  }

  public Transaction setPaymentInfo(PaymentInfo paymentInfo) {
    this.paymentInfo = paymentInfo;
    return this;
  }

  public void unsetPaymentInfo() {
    this.paymentInfo = null;
  }

  /** Returns true if field paymentInfo is set (has been asigned a value) and false otherwise */
  public boolean isSetPaymentInfo() {
    return this.paymentInfo != null;
  }

  public void setPaymentInfoIsSet(boolean value) {
    if (!value) {
      this.paymentInfo = null;
    }
  }

  public long getCreatedOn() {
    return this.createdOn;
  }

  public Transaction setCreatedOn(long createdOn) {
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    return this;
  }

  public void unsetCreatedOn() {
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
  }

  /** Returns true if field createdOn is set (has been asigned a value) and false otherwise */
  public boolean isSetCreatedOn() {
    return __isset_bit_vector.get(__CREATEDON_ISSET_ID);
  }

  public void setCreatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
  }

  public long getExpectedDeliveryTime() {
    return this.expectedDeliveryTime;
  }

  public Transaction setExpectedDeliveryTime(long expectedDeliveryTime) {
    this.expectedDeliveryTime = expectedDeliveryTime;
    setExpectedDeliveryTimeIsSet(true);
    return this;
  }

  public void unsetExpectedDeliveryTime() {
    __isset_bit_vector.clear(__EXPECTEDDELIVERYTIME_ISSET_ID);
  }

  /** Returns true if field expectedDeliveryTime is set (has been asigned a value) and false otherwise */
  public boolean isSetExpectedDeliveryTime() {
    return __isset_bit_vector.get(__EXPECTEDDELIVERYTIME_ISSET_ID);
  }

  public void setExpectedDeliveryTimeIsSet(boolean value) {
    __isset_bit_vector.set(__EXPECTEDDELIVERYTIME_ISSET_ID, value);
  }

  /**
   * 
   * @see TransactionStatus
   */
  public TransactionStatus getTransactionStatus() {
    return this.transactionStatus;
  }

  /**
   * 
   * @see TransactionStatus
   */
  public Transaction setTransactionStatus(TransactionStatus transactionStatus) {
    this.transactionStatus = transactionStatus;
    return this;
  }

  public void unsetTransactionStatus() {
    this.transactionStatus = null;
  }

  /** Returns true if field transactionStatus is set (has been asigned a value) and false otherwise */
  public boolean isSetTransactionStatus() {
    return this.transactionStatus != null;
  }

  public void setTransactionStatusIsSet(boolean value) {
    if (!value) {
      this.transactionStatus = null;
    }
  }

  public String getStatusDescription() {
    return this.statusDescription;
  }

  public Transaction setStatusDescription(String statusDescription) {
    this.statusDescription = statusDescription;
    return this;
  }

  public void unsetStatusDescription() {
    this.statusDescription = null;
  }

  /** Returns true if field statusDescription is set (has been asigned a value) and false otherwise */
  public boolean isSetStatusDescription() {
    return this.statusDescription != null;
  }

  public void setStatusDescriptionIsSet(boolean value) {
    if (!value) {
      this.statusDescription = null;
    }
  }

  public long getCustomer_id() {
    return this.customer_id;
  }

  public Transaction setCustomer_id(long customer_id) {
    this.customer_id = customer_id;
    setCustomer_idIsSet(true);
    return this;
  }

  public void unsetCustomer_id() {
    __isset_bit_vector.clear(__CUSTOMER_ID_ISSET_ID);
  }

  /** Returns true if field customer_id is set (has been asigned a value) and false otherwise */
  public boolean isSetCustomer_id() {
    return __isset_bit_vector.get(__CUSTOMER_ID_ISSET_ID);
  }

  public void setCustomer_idIsSet(boolean value) {
    __isset_bit_vector.set(__CUSTOMER_ID_ISSET_ID, value);
  }

  public long getShoppingCartid() {
    return this.shoppingCartid;
  }

  public Transaction setShoppingCartid(long shoppingCartid) {
    this.shoppingCartid = shoppingCartid;
    setShoppingCartidIsSet(true);
    return this;
  }

  public void unsetShoppingCartid() {
    __isset_bit_vector.clear(__SHOPPINGCARTID_ISSET_ID);
  }

  /** Returns true if field shoppingCartid is set (has been asigned a value) and false otherwise */
  public boolean isSetShoppingCartid() {
    return __isset_bit_vector.get(__SHOPPINGCARTID_ISSET_ID);
  }

  public void setShoppingCartidIsSet(boolean value) {
    __isset_bit_vector.set(__SHOPPINGCARTID_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case ORDER_INFO:
      if (value == null) {
        unsetOrderInfo();
      } else {
        setOrderInfo((OrderInfo)value);
      }
      break;

    case SHIPMENT_INFO:
      if (value == null) {
        unsetShipmentInfo();
      } else {
        setShipmentInfo((ShipmentInfo)value);
      }
      break;

    case BILLING_INFO:
      if (value == null) {
        unsetBillingInfo();
      } else {
        setBillingInfo((BillingInfo)value);
      }
      break;

    case PAYMENT_INFO:
      if (value == null) {
        unsetPaymentInfo();
      } else {
        setPaymentInfo((PaymentInfo)value);
      }
      break;

    case CREATED_ON:
      if (value == null) {
        unsetCreatedOn();
      } else {
        setCreatedOn((Long)value);
      }
      break;

    case EXPECTED_DELIVERY_TIME:
      if (value == null) {
        unsetExpectedDeliveryTime();
      } else {
        setExpectedDeliveryTime((Long)value);
      }
      break;

    case TRANSACTION_STATUS:
      if (value == null) {
        unsetTransactionStatus();
      } else {
        setTransactionStatus((TransactionStatus)value);
      }
      break;

    case STATUS_DESCRIPTION:
      if (value == null) {
        unsetStatusDescription();
      } else {
        setStatusDescription((String)value);
      }
      break;

    case CUSTOMER_ID:
      if (value == null) {
        unsetCustomer_id();
      } else {
        setCustomer_id((Long)value);
      }
      break;

    case SHOPPING_CARTID:
      if (value == null) {
        unsetShoppingCartid();
      } else {
        setShoppingCartid((Long)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return new Long(getId());

    case ORDER_INFO:
      return getOrderInfo();

    case SHIPMENT_INFO:
      return getShipmentInfo();

    case BILLING_INFO:
      return getBillingInfo();

    case PAYMENT_INFO:
      return getPaymentInfo();

    case CREATED_ON:
      return new Long(getCreatedOn());

    case EXPECTED_DELIVERY_TIME:
      return new Long(getExpectedDeliveryTime());

    case TRANSACTION_STATUS:
      return getTransactionStatus();

    case STATUS_DESCRIPTION:
      return getStatusDescription();

    case CUSTOMER_ID:
      return new Long(getCustomer_id());

    case SHOPPING_CARTID:
      return new Long(getShoppingCartid());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case ID:
      return isSetId();
    case ORDER_INFO:
      return isSetOrderInfo();
    case SHIPMENT_INFO:
      return isSetShipmentInfo();
    case BILLING_INFO:
      return isSetBillingInfo();
    case PAYMENT_INFO:
      return isSetPaymentInfo();
    case CREATED_ON:
      return isSetCreatedOn();
    case EXPECTED_DELIVERY_TIME:
      return isSetExpectedDeliveryTime();
    case TRANSACTION_STATUS:
      return isSetTransactionStatus();
    case STATUS_DESCRIPTION:
      return isSetStatusDescription();
    case CUSTOMER_ID:
      return isSetCustomer_id();
    case SHOPPING_CARTID:
      return isSetShoppingCartid();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof Transaction)
      return this.equals((Transaction)that);
    return false;
  }

  public boolean equals(Transaction that) {
    if (that == null)
      return false;

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_orderInfo = true && this.isSetOrderInfo();
    boolean that_present_orderInfo = true && that.isSetOrderInfo();
    if (this_present_orderInfo || that_present_orderInfo) {
      if (!(this_present_orderInfo && that_present_orderInfo))
        return false;
      if (!this.orderInfo.equals(that.orderInfo))
        return false;
    }

    boolean this_present_shipmentInfo = true && this.isSetShipmentInfo();
    boolean that_present_shipmentInfo = true && that.isSetShipmentInfo();
    if (this_present_shipmentInfo || that_present_shipmentInfo) {
      if (!(this_present_shipmentInfo && that_present_shipmentInfo))
        return false;
      if (!this.shipmentInfo.equals(that.shipmentInfo))
        return false;
    }

    boolean this_present_billingInfo = true && this.isSetBillingInfo();
    boolean that_present_billingInfo = true && that.isSetBillingInfo();
    if (this_present_billingInfo || that_present_billingInfo) {
      if (!(this_present_billingInfo && that_present_billingInfo))
        return false;
      if (!this.billingInfo.equals(that.billingInfo))
        return false;
    }

    boolean this_present_paymentInfo = true && this.isSetPaymentInfo();
    boolean that_present_paymentInfo = true && that.isSetPaymentInfo();
    if (this_present_paymentInfo || that_present_paymentInfo) {
      if (!(this_present_paymentInfo && that_present_paymentInfo))
        return false;
      if (!this.paymentInfo.equals(that.paymentInfo))
        return false;
    }

    boolean this_present_createdOn = true;
    boolean that_present_createdOn = true;
    if (this_present_createdOn || that_present_createdOn) {
      if (!(this_present_createdOn && that_present_createdOn))
        return false;
      if (this.createdOn != that.createdOn)
        return false;
    }

    boolean this_present_expectedDeliveryTime = true;
    boolean that_present_expectedDeliveryTime = true;
    if (this_present_expectedDeliveryTime || that_present_expectedDeliveryTime) {
      if (!(this_present_expectedDeliveryTime && that_present_expectedDeliveryTime))
        return false;
      if (this.expectedDeliveryTime != that.expectedDeliveryTime)
        return false;
    }

    boolean this_present_transactionStatus = true && this.isSetTransactionStatus();
    boolean that_present_transactionStatus = true && that.isSetTransactionStatus();
    if (this_present_transactionStatus || that_present_transactionStatus) {
      if (!(this_present_transactionStatus && that_present_transactionStatus))
        return false;
      if (!this.transactionStatus.equals(that.transactionStatus))
        return false;
    }

    boolean this_present_statusDescription = true && this.isSetStatusDescription();
    boolean that_present_statusDescription = true && that.isSetStatusDescription();
    if (this_present_statusDescription || that_present_statusDescription) {
      if (!(this_present_statusDescription && that_present_statusDescription))
        return false;
      if (!this.statusDescription.equals(that.statusDescription))
        return false;
    }

    boolean this_present_customer_id = true;
    boolean that_present_customer_id = true;
    if (this_present_customer_id || that_present_customer_id) {
      if (!(this_present_customer_id && that_present_customer_id))
        return false;
      if (this.customer_id != that.customer_id)
        return false;
    }

    boolean this_present_shoppingCartid = true;
    boolean that_present_shoppingCartid = true;
    if (this_present_shoppingCartid || that_present_shoppingCartid) {
      if (!(this_present_shoppingCartid && that_present_shoppingCartid))
        return false;
      if (this.shoppingCartid != that.shoppingCartid)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case ID:
            if (field.type == TType.I64) {
              this.id = iprot.readI64();
              setIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ORDER_INFO:
            if (field.type == TType.STRUCT) {
              this.orderInfo = new OrderInfo();
              this.orderInfo.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SHIPMENT_INFO:
            if (field.type == TType.STRUCT) {
              this.shipmentInfo = new ShipmentInfo();
              this.shipmentInfo.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case BILLING_INFO:
            if (field.type == TType.STRUCT) {
              this.billingInfo = new BillingInfo();
              this.billingInfo.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PAYMENT_INFO:
            if (field.type == TType.STRUCT) {
              this.paymentInfo = new PaymentInfo();
              this.paymentInfo.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CREATED_ON:
            if (field.type == TType.I64) {
              this.createdOn = iprot.readI64();
              setCreatedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case EXPECTED_DELIVERY_TIME:
            if (field.type == TType.I64) {
              this.expectedDeliveryTime = iprot.readI64();
              setExpectedDeliveryTimeIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case TRANSACTION_STATUS:
            if (field.type == TType.I32) {
              this.transactionStatus = TransactionStatus.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case STATUS_DESCRIPTION:
            if (field.type == TType.STRING) {
              this.statusDescription = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CUSTOMER_ID:
            if (field.type == TType.I64) {
              this.customer_id = iprot.readI64();
              setCustomer_idIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SHOPPING_CARTID:
            if (field.type == TType.I64) {
              this.shoppingCartid = iprot.readI64();
              setShoppingCartidIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    if (this.orderInfo != null) {
      oprot.writeFieldBegin(ORDER_INFO_FIELD_DESC);
      this.orderInfo.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.shipmentInfo != null) {
      oprot.writeFieldBegin(SHIPMENT_INFO_FIELD_DESC);
      this.shipmentInfo.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.billingInfo != null) {
      oprot.writeFieldBegin(BILLING_INFO_FIELD_DESC);
      this.billingInfo.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.paymentInfo != null) {
      oprot.writeFieldBegin(PAYMENT_INFO_FIELD_DESC);
      this.paymentInfo.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
    oprot.writeI64(this.createdOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(EXPECTED_DELIVERY_TIME_FIELD_DESC);
    oprot.writeI64(this.expectedDeliveryTime);
    oprot.writeFieldEnd();
    if (this.transactionStatus != null) {
      oprot.writeFieldBegin(TRANSACTION_STATUS_FIELD_DESC);
      oprot.writeI32(this.transactionStatus.getValue());
      oprot.writeFieldEnd();
    }
    if (this.statusDescription != null) {
      oprot.writeFieldBegin(STATUS_DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.statusDescription);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CUSTOMER_ID_FIELD_DESC);
    oprot.writeI64(this.customer_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SHOPPING_CARTID_FIELD_DESC);
    oprot.writeI64(this.shoppingCartid);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("Transaction(");
    boolean first = true;

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("orderInfo:");
    if (this.orderInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.orderInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("shipmentInfo:");
    if (this.shipmentInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.shipmentInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("billingInfo:");
    if (this.billingInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.billingInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("paymentInfo:");
    if (this.paymentInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.paymentInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("createdOn:");
    sb.append(this.createdOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("expectedDeliveryTime:");
    sb.append(this.expectedDeliveryTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("transactionStatus:");
    if (this.transactionStatus == null) {
      sb.append("null");
    } else {
      String transactionStatus_name = transactionStatus.name();
      if (transactionStatus_name != null) {
        sb.append(transactionStatus_name);
        sb.append(" (");
      }
      sb.append(this.transactionStatus);
      if (transactionStatus_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("statusDescription:");
    if (this.statusDescription == null) {
      sb.append("null");
    } else {
      sb.append(this.statusDescription);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("customer_id:");
    sb.append(this.customer_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("shoppingCartid:");
    sb.append(this.shoppingCartid);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}