Subversion Repositories SmartDukaan

Rev

Rev 1302 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.user;

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.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

  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);
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField COMMUNICATION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("communicationType", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField ORDER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("orderId", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField AIRWAYBILL_NO_FIELD_DESC = new org.apache.thrift.protocol.TField("airwaybillNo", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField REPLY_TO_FIELD_DESC = new org.apache.thrift.protocol.TField("replyTo", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField PRODUCT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("productName", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField SUBJECT_FIELD_DESC = new org.apache.thrift.protocol.TField("subject", org.apache.thrift.protocol.TType.STRING, (short)8);
  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)9);
  private static final org.apache.thrift.protocol.TField COMMUNICATION_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("communication_timestamp", org.apache.thrift.protocol.TType.I64, (short)10);

  private long id; // required
  private long userId; // required
  private UserCommunicationType communicationType; // required
  private long orderId; // required
  private String airwaybillNo; // required
  private String replyTo; // required
  private String productName; // required
  private String subject; // required
  private String message; // required
  private long communication_timestamp; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ID((short)1, "id"),
    USER_ID((short)2, "userId"),
    /**
     * 
     * @see UserCommunicationType
     */
    COMMUNICATION_TYPE((short)3, "communicationType"),
    ORDER_ID((short)4, "orderId"),
    AIRWAYBILL_NO((short)5, "airwaybillNo"),
    REPLY_TO((short)6, "replyTo"),
    PRODUCT_NAME((short)7, "productName"),
    SUBJECT((short)8, "subject"),
    MESSAGE((short)9, "message"),
    COMMUNICATION_TIMESTAMP((short)10, "communication_timestamp");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ID
          return ID;
        case 2: // USER_ID
          return USER_ID;
        case 3: // COMMUNICATION_TYPE
          return COMMUNICATION_TYPE;
        case 4: // ORDER_ID
          return ORDER_ID;
        case 5: // AIRWAYBILL_NO
          return AIRWAYBILL_NO;
        case 6: // REPLY_TO
          return REPLY_TO;
        case 7: // PRODUCT_NAME
          return PRODUCT_NAME;
        case 8: // SUBJECT
          return SUBJECT;
        case 9: // MESSAGE
          return MESSAGE;
        case 10: // COMMUNICATION_TIMESTAMP
          return COMMUNICATION_TIMESTAMP;
        default:
          return null;
      }
    }

    /**
     * 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 __USERID_ISSET_ID = 1;
  private static final int __ORDERID_ISSET_ID = 2;
  private static final int __COMMUNICATION_TIMESTAMP_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.COMMUNICATION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("communicationType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, UserCommunicationType.class)));
    tmpMap.put(_Fields.ORDER_ID, new org.apache.thrift.meta_data.FieldMetaData("orderId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.AIRWAYBILL_NO, new org.apache.thrift.meta_data.FieldMetaData("airwaybillNo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.REPLY_TO, new org.apache.thrift.meta_data.FieldMetaData("replyTo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PRODUCT_NAME, new org.apache.thrift.meta_data.FieldMetaData("productName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SUBJECT, new org.apache.thrift.meta_data.FieldMetaData("subject", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.COMMUNICATION_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("communication_timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserCommunication.class, metaDataMap);
  }

  public UserCommunication() {
  }

  public UserCommunication(
    long id,
    long userId,
    UserCommunicationType communicationType,
    long orderId,
    String airwaybillNo,
    String replyTo,
    String productName,
    String subject,
    String message,
    long communication_timestamp)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.userId = userId;
    setUserIdIsSet(true);
    this.communicationType = communicationType;
    this.orderId = orderId;
    setOrderIdIsSet(true);
    this.airwaybillNo = airwaybillNo;
    this.replyTo = replyTo;
    this.productName = productName;
    this.subject = subject;
    this.message = message;
    this.communication_timestamp = communication_timestamp;
    setCommunication_timestampIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public UserCommunication(UserCommunication other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.userId = other.userId;
    if (other.isSetCommunicationType()) {
      this.communicationType = other.communicationType;
    }
    this.orderId = other.orderId;
    if (other.isSetAirwaybillNo()) {
      this.airwaybillNo = other.airwaybillNo;
    }
    if (other.isSetReplyTo()) {
      this.replyTo = other.replyTo;
    }
    if (other.isSetProductName()) {
      this.productName = other.productName;
    }
    if (other.isSetSubject()) {
      this.subject = other.subject;
    }
    if (other.isSetMessage()) {
      this.message = other.message;
    }
    this.communication_timestamp = other.communication_timestamp;
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    setUserIdIsSet(false);
    this.userId = 0;
    this.communicationType = null;
    setOrderIdIsSet(false);
    this.orderId = 0;
    this.airwaybillNo = null;
    this.replyTo = null;
    this.productName = null;
    this.subject = null;
    this.message = null;
    setCommunication_timestampIsSet(false);
    this.communication_timestamp = 0;
  }

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

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

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

  /** Returns true if field id is set (has been assigned 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 long getUserId() {
    return this.userId;
  }

  public void setUserId(long userId) {
    this.userId = userId;
    setUserIdIsSet(true);
  }

  public void unsetUserId() {
    __isset_bit_vector.clear(__USERID_ISSET_ID);
  }

  /** Returns true if field userId is set (has been assigned a value) and false otherwise */
  public boolean isSetUserId() {
    return __isset_bit_vector.get(__USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
  }

  /**
   * 
   * @see UserCommunicationType
   */
  public UserCommunicationType getCommunicationType() {
    return this.communicationType;
  }

  /**
   * 
   * @see UserCommunicationType
   */
  public void setCommunicationType(UserCommunicationType communicationType) {
    this.communicationType = communicationType;
  }

  public void unsetCommunicationType() {
    this.communicationType = null;
  }

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

  public void setCommunicationTypeIsSet(boolean value) {
    if (!value) {
      this.communicationType = null;
    }
  }

  public long getOrderId() {
    return this.orderId;
  }

  public void setOrderId(long orderId) {
    this.orderId = orderId;
    setOrderIdIsSet(true);
  }

  public void unsetOrderId() {
    __isset_bit_vector.clear(__ORDERID_ISSET_ID);
  }

  /** Returns true if field orderId is set (has been assigned a value) and false otherwise */
  public boolean isSetOrderId() {
    return __isset_bit_vector.get(__ORDERID_ISSET_ID);
  }

  public void setOrderIdIsSet(boolean value) {
    __isset_bit_vector.set(__ORDERID_ISSET_ID, value);
  }

  public String getAirwaybillNo() {
    return this.airwaybillNo;
  }

  public void setAirwaybillNo(String airwaybillNo) {
    this.airwaybillNo = airwaybillNo;
  }

  public void unsetAirwaybillNo() {
    this.airwaybillNo = null;
  }

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

  public void setAirwaybillNoIsSet(boolean value) {
    if (!value) {
      this.airwaybillNo = null;
    }
  }

  public String getReplyTo() {
    return this.replyTo;
  }

  public void setReplyTo(String replyTo) {
    this.replyTo = replyTo;
  }

  public void unsetReplyTo() {
    this.replyTo = null;
  }

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

  public void setReplyToIsSet(boolean value) {
    if (!value) {
      this.replyTo = null;
    }
  }

  public String getProductName() {
    return this.productName;
  }

  public void setProductName(String productName) {
    this.productName = productName;
  }

  public void unsetProductName() {
    this.productName = null;
  }

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

  public void setProductNameIsSet(boolean value) {
    if (!value) {
      this.productName = null;
    }
  }

  public String getSubject() {
    return this.subject;
  }

  public void setSubject(String subject) {
    this.subject = subject;
  }

  public void unsetSubject() {
    this.subject = null;
  }

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

  public void setSubjectIsSet(boolean value) {
    if (!value) {
      this.subject = null;
    }
  }

  public String getMessage() {
    return this.message;
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public void unsetMessage() {
    this.message = null;
  }

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

  public void setMessageIsSet(boolean value) {
    if (!value) {
      this.message = null;
    }
  }

  public long getCommunication_timestamp() {
    return this.communication_timestamp;
  }

  public void setCommunication_timestamp(long communication_timestamp) {
    this.communication_timestamp = communication_timestamp;
    setCommunication_timestampIsSet(true);
  }

  public void unsetCommunication_timestamp() {
    __isset_bit_vector.clear(__COMMUNICATION_TIMESTAMP_ISSET_ID);
  }

  /** Returns true if field communication_timestamp is set (has been assigned a value) and false otherwise */
  public boolean isSetCommunication_timestamp() {
    return __isset_bit_vector.get(__COMMUNICATION_TIMESTAMP_ISSET_ID);
  }

  public void setCommunication_timestampIsSet(boolean value) {
    __isset_bit_vector.set(__COMMUNICATION_TIMESTAMP_ISSET_ID, value);
  }

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

    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case COMMUNICATION_TYPE:
      if (value == null) {
        unsetCommunicationType();
      } else {
        setCommunicationType((UserCommunicationType)value);
      }
      break;

    case ORDER_ID:
      if (value == null) {
        unsetOrderId();
      } else {
        setOrderId((Long)value);
      }
      break;

    case AIRWAYBILL_NO:
      if (value == null) {
        unsetAirwaybillNo();
      } else {
        setAirwaybillNo((String)value);
      }
      break;

    case REPLY_TO:
      if (value == null) {
        unsetReplyTo();
      } else {
        setReplyTo((String)value);
      }
      break;

    case PRODUCT_NAME:
      if (value == null) {
        unsetProductName();
      } else {
        setProductName((String)value);
      }
      break;

    case SUBJECT:
      if (value == null) {
        unsetSubject();
      } else {
        setSubject((String)value);
      }
      break;

    case MESSAGE:
      if (value == null) {
        unsetMessage();
      } else {
        setMessage((String)value);
      }
      break;

    case COMMUNICATION_TIMESTAMP:
      if (value == null) {
        unsetCommunication_timestamp();
      } else {
        setCommunication_timestamp((Long)value);
      }
      break;

    }
  }

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

    case USER_ID:
      return Long.valueOf(getUserId());

    case COMMUNICATION_TYPE:
      return getCommunicationType();

    case ORDER_ID:
      return Long.valueOf(getOrderId());

    case AIRWAYBILL_NO:
      return getAirwaybillNo();

    case REPLY_TO:
      return getReplyTo();

    case PRODUCT_NAME:
      return getProductName();

    case SUBJECT:
      return getSubject();

    case MESSAGE:
      return getMessage();

    case COMMUNICATION_TIMESTAMP:
      return Long.valueOf(getCommunication_timestamp());

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case ID:
      return isSetId();
    case USER_ID:
      return isSetUserId();
    case COMMUNICATION_TYPE:
      return isSetCommunicationType();
    case ORDER_ID:
      return isSetOrderId();
    case AIRWAYBILL_NO:
      return isSetAirwaybillNo();
    case REPLY_TO:
      return isSetReplyTo();
    case PRODUCT_NAME:
      return isSetProductName();
    case SUBJECT:
      return isSetSubject();
    case MESSAGE:
      return isSetMessage();
    case COMMUNICATION_TIMESTAMP:
      return isSetCommunication_timestamp();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(UserCommunication 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_userId = true;
    boolean that_present_userId = true;
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (this.userId != that.userId)
        return false;
    }

    boolean this_present_communicationType = true && this.isSetCommunicationType();
    boolean that_present_communicationType = true && that.isSetCommunicationType();
    if (this_present_communicationType || that_present_communicationType) {
      if (!(this_present_communicationType && that_present_communicationType))
        return false;
      if (!this.communicationType.equals(that.communicationType))
        return false;
    }

    boolean this_present_orderId = true;
    boolean that_present_orderId = true;
    if (this_present_orderId || that_present_orderId) {
      if (!(this_present_orderId && that_present_orderId))
        return false;
      if (this.orderId != that.orderId)
        return false;
    }

    boolean this_present_airwaybillNo = true && this.isSetAirwaybillNo();
    boolean that_present_airwaybillNo = true && that.isSetAirwaybillNo();
    if (this_present_airwaybillNo || that_present_airwaybillNo) {
      if (!(this_present_airwaybillNo && that_present_airwaybillNo))
        return false;
      if (!this.airwaybillNo.equals(that.airwaybillNo))
        return false;
    }

    boolean this_present_replyTo = true && this.isSetReplyTo();
    boolean that_present_replyTo = true && that.isSetReplyTo();
    if (this_present_replyTo || that_present_replyTo) {
      if (!(this_present_replyTo && that_present_replyTo))
        return false;
      if (!this.replyTo.equals(that.replyTo))
        return false;
    }

    boolean this_present_productName = true && this.isSetProductName();
    boolean that_present_productName = true && that.isSetProductName();
    if (this_present_productName || that_present_productName) {
      if (!(this_present_productName && that_present_productName))
        return false;
      if (!this.productName.equals(that.productName))
        return false;
    }

    boolean this_present_subject = true && this.isSetSubject();
    boolean that_present_subject = true && that.isSetSubject();
    if (this_present_subject || that_present_subject) {
      if (!(this_present_subject && that_present_subject))
        return false;
      if (!this.subject.equals(that.subject))
        return false;
    }

    boolean this_present_message = true && this.isSetMessage();
    boolean that_present_message = true && that.isSetMessage();
    if (this_present_message || that_present_message) {
      if (!(this_present_message && that_present_message))
        return false;
      if (!this.message.equals(that.message))
        return false;
    }

    boolean this_present_communication_timestamp = true;
    boolean that_present_communication_timestamp = true;
    if (this_present_communication_timestamp || that_present_communication_timestamp) {
      if (!(this_present_communication_timestamp && that_present_communication_timestamp))
        return false;
      if (this.communication_timestamp != that.communication_timestamp)
        return false;
    }

    return true;
  }

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

  public int compareTo(UserCommunication other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    UserCommunication typedOther = (UserCommunication)other;

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCommunicationType()).compareTo(typedOther.isSetCommunicationType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCommunicationType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.communicationType, typedOther.communicationType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrderId()).compareTo(typedOther.isSetOrderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrderId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orderId, typedOther.orderId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAirwaybillNo()).compareTo(typedOther.isSetAirwaybillNo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAirwaybillNo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.airwaybillNo, typedOther.airwaybillNo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetReplyTo()).compareTo(typedOther.isSetReplyTo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReplyTo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.replyTo, typedOther.replyTo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProductName()).compareTo(typedOther.isSetProductName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProductName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.productName, typedOther.productName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSubject()).compareTo(typedOther.isSetSubject());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSubject()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.subject, typedOther.subject);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCommunication_timestamp()).compareTo(typedOther.isSetCommunication_timestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCommunication_timestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.communication_timestamp, typedOther.communication_timestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // USER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.userId = iprot.readI64();
            setUserIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // COMMUNICATION_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.communicationType = UserCommunicationType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ORDER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.orderId = iprot.readI64();
            setOrderIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // AIRWAYBILL_NO
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.airwaybillNo = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // REPLY_TO
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.replyTo = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // PRODUCT_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.productName = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // SUBJECT
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.subject = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // MESSAGE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.message = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // COMMUNICATION_TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.communication_timestamp = iprot.readI64();
            setCommunication_timestampIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    if (this.communicationType != null) {
      oprot.writeFieldBegin(COMMUNICATION_TYPE_FIELD_DESC);
      oprot.writeI32(this.communicationType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
    oprot.writeI64(this.orderId);
    oprot.writeFieldEnd();
    if (this.airwaybillNo != null) {
      oprot.writeFieldBegin(AIRWAYBILL_NO_FIELD_DESC);
      oprot.writeString(this.airwaybillNo);
      oprot.writeFieldEnd();
    }
    if (this.replyTo != null) {
      oprot.writeFieldBegin(REPLY_TO_FIELD_DESC);
      oprot.writeString(this.replyTo);
      oprot.writeFieldEnd();
    }
    if (this.productName != null) {
      oprot.writeFieldBegin(PRODUCT_NAME_FIELD_DESC);
      oprot.writeString(this.productName);
      oprot.writeFieldEnd();
    }
    if (this.subject != null) {
      oprot.writeFieldBegin(SUBJECT_FIELD_DESC);
      oprot.writeString(this.subject);
      oprot.writeFieldEnd();
    }
    if (this.message != null) {
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
      oprot.writeString(this.message);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(COMMUNICATION_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.communication_timestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("communicationType:");
    if (this.communicationType == null) {
      sb.append("null");
    } else {
      sb.append(this.communicationType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("orderId:");
    sb.append(this.orderId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("airwaybillNo:");
    if (this.airwaybillNo == null) {
      sb.append("null");
    } else {
      sb.append(this.airwaybillNo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("replyTo:");
    if (this.replyTo == null) {
      sb.append("null");
    } else {
      sb.append(this.replyTo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("productName:");
    if (this.productName == null) {
      sb.append("null");
    } else {
      sb.append(this.productName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("subject:");
    if (this.subject == null) {
      sb.append("null");
    } else {
      sb.append(this.subject);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("message:");
    if (this.message == null) {
      sb.append("null");
    } else {
      sb.append(this.message);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("communication_timestamp:");
    sb.append(this.communication_timestamp);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

}