Subversion Repositories SmartDukaan

Rev

Rev 3106 | Rev 3269 | 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.crm;

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 Ticket implements TBase<Ticket._Fields>, java.io.Serializable, Cloneable, Comparable<Ticket> {
  private static final TStruct STRUCT_DESC = new TStruct("Ticket");

  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
  private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customerId", TType.I64, (short)2);
  private static final TField OPEN_DATE_FIELD_DESC = new TField("openDate", TType.I64, (short)3);
  private static final TField CLOSE_DATE_FIELD_DESC = new TField("closeDate", TType.I64, (short)4);
  private static final TField DESCRIPTION_FIELD_DESC = new TField("description", TType.STRING, (short)5);
  private static final TField PRIORITY_FIELD_DESC = new TField("priority", TType.I32, (short)6);
  private static final TField CATEGORY_FIELD_DESC = new TField("category", TType.I32, (short)7);
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)8);
  private static final TField ASSIGNEE_ID_FIELD_DESC = new TField("assigneeId", TType.I64, (short)9);
  private static final TField CREATOR_ID_FIELD_DESC = new TField("creatorId", TType.I64, (short)10);
  private static final TField ORDER_ID_FIELD_DESC = new TField("orderId", TType.I64, (short)11);
  private static final TField AIRWAY_BILL_NO_FIELD_DESC = new TField("airwayBillNo", TType.STRING, (short)12);
  private static final TField PRODUCT_NAME_FIELD_DESC = new TField("productName", TType.STRING, (short)13);

  private long id;
  private long customerId;
  private long openDate;
  private long closeDate;
  private String description;
  private TicketPriority priority;
  private TicketCategory category;
  private TicketStatus status;
  private long assigneeId;
  private long creatorId;
  private long orderId;
  private String airwayBillNo;
  private String productName;

  /** 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"),
    CUSTOMER_ID((short)2, "customerId"),
    OPEN_DATE((short)3, "openDate"),
    CLOSE_DATE((short)4, "closeDate"),
    DESCRIPTION((short)5, "description"),
    /**
     * 
     * @see TicketPriority
     */
    PRIORITY((short)6, "priority"),
    /**
     * 
     * @see TicketCategory
     */
    CATEGORY((short)7, "category"),
    /**
     * 
     * @see TicketStatus
     */
    STATUS((short)8, "status"),
    ASSIGNEE_ID((short)9, "assigneeId"),
    CREATOR_ID((short)10, "creatorId"),
    ORDER_ID((short)11, "orderId"),
    AIRWAY_BILL_NO((short)12, "airwayBillNo"),
    PRODUCT_NAME((short)13, "productName");

    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 __CUSTOMERID_ISSET_ID = 1;
  private static final int __OPENDATE_ISSET_ID = 2;
  private static final int __CLOSEDATE_ISSET_ID = 3;
  private static final int __ASSIGNEEID_ISSET_ID = 4;
  private static final int __CREATORID_ISSET_ID = 5;
  private static final int __ORDERID_ISSET_ID = 6;
  private BitSet __isset_bit_vector = new BitSet(7);

  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.CUSTOMER_ID, new FieldMetaData("customerId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.OPEN_DATE, new FieldMetaData("openDate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.CLOSE_DATE, new FieldMetaData("closeDate", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.DESCRIPTION, new FieldMetaData("description", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PRIORITY, new FieldMetaData("priority", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, TicketPriority.class)));
    put(_Fields.CATEGORY, new FieldMetaData("category", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, TicketCategory.class)));
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, TicketStatus.class)));
    put(_Fields.ASSIGNEE_ID, new FieldMetaData("assigneeId", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.CREATOR_ID, new FieldMetaData("creatorId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ORDER_ID, new FieldMetaData("orderId", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.AIRWAY_BILL_NO, new FieldMetaData("airwayBillNo", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PRODUCT_NAME, new FieldMetaData("productName", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.STRING)));
  }});

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

  public Ticket() {
  }

  public Ticket(
    long id,
    long customerId,
    long openDate,
    String description,
    TicketPriority priority,
    TicketCategory category,
    TicketStatus status,
    long creatorId)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.customerId = customerId;
    setCustomerIdIsSet(true);
    this.openDate = openDate;
    setOpenDateIsSet(true);
    this.description = description;
    this.priority = priority;
    this.category = category;
    this.status = status;
    this.creatorId = creatorId;
    setCreatorIdIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Ticket(Ticket other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.customerId = other.customerId;
    this.openDate = other.openDate;
    this.closeDate = other.closeDate;
    if (other.isSetDescription()) {
      this.description = other.description;
    }
    if (other.isSetPriority()) {
      this.priority = other.priority;
    }
    if (other.isSetCategory()) {
      this.category = other.category;
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    this.assigneeId = other.assigneeId;
    this.creatorId = other.creatorId;
    this.orderId = other.orderId;
    if (other.isSetAirwayBillNo()) {
      this.airwayBillNo = other.airwayBillNo;
    }
    if (other.isSetProductName()) {
      this.productName = other.productName;
    }
  }

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

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

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

  public Ticket 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 long getCustomerId() {
    return this.customerId;
  }

  public Ticket setCustomerId(long customerId) {
    this.customerId = customerId;
    setCustomerIdIsSet(true);
    return this;
  }

  public void unsetCustomerId() {
    __isset_bit_vector.clear(__CUSTOMERID_ISSET_ID);
  }

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

  public void setCustomerIdIsSet(boolean value) {
    __isset_bit_vector.set(__CUSTOMERID_ISSET_ID, value);
  }

  public long getOpenDate() {
    return this.openDate;
  }

  public Ticket setOpenDate(long openDate) {
    this.openDate = openDate;
    setOpenDateIsSet(true);
    return this;
  }

  public void unsetOpenDate() {
    __isset_bit_vector.clear(__OPENDATE_ISSET_ID);
  }

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

  public void setOpenDateIsSet(boolean value) {
    __isset_bit_vector.set(__OPENDATE_ISSET_ID, value);
  }

  public long getCloseDate() {
    return this.closeDate;
  }

  public Ticket setCloseDate(long closeDate) {
    this.closeDate = closeDate;
    setCloseDateIsSet(true);
    return this;
  }

  public void unsetCloseDate() {
    __isset_bit_vector.clear(__CLOSEDATE_ISSET_ID);
  }

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

  public void setCloseDateIsSet(boolean value) {
    __isset_bit_vector.set(__CLOSEDATE_ISSET_ID, value);
  }

  public String getDescription() {
    return this.description;
  }

  public Ticket setDescription(String description) {
    this.description = description;
    return this;
  }

  public void unsetDescription() {
    this.description = null;
  }

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

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  /**
   * 
   * @see TicketPriority
   */
  public TicketPriority getPriority() {
    return this.priority;
  }

  /**
   * 
   * @see TicketPriority
   */
  public Ticket setPriority(TicketPriority priority) {
    this.priority = priority;
    return this;
  }

  public void unsetPriority() {
    this.priority = null;
  }

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

  public void setPriorityIsSet(boolean value) {
    if (!value) {
      this.priority = null;
    }
  }

  /**
   * 
   * @see TicketCategory
   */
  public TicketCategory getCategory() {
    return this.category;
  }

  /**
   * 
   * @see TicketCategory
   */
  public Ticket setCategory(TicketCategory category) {
    this.category = category;
    return this;
  }

  public void unsetCategory() {
    this.category = null;
  }

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

  public void setCategoryIsSet(boolean value) {
    if (!value) {
      this.category = null;
    }
  }

  /**
   * 
   * @see TicketStatus
   */
  public TicketStatus getStatus() {
    return this.status;
  }

  /**
   * 
   * @see TicketStatus
   */
  public Ticket setStatus(TicketStatus status) {
    this.status = status;
    return this;
  }

  public void unsetStatus() {
    this.status = null;
  }

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

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

  public long getAssigneeId() {
    return this.assigneeId;
  }

  public Ticket setAssigneeId(long assigneeId) {
    this.assigneeId = assigneeId;
    setAssigneeIdIsSet(true);
    return this;
  }

  public void unsetAssigneeId() {
    __isset_bit_vector.clear(__ASSIGNEEID_ISSET_ID);
  }

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

  public void setAssigneeIdIsSet(boolean value) {
    __isset_bit_vector.set(__ASSIGNEEID_ISSET_ID, value);
  }

  public long getCreatorId() {
    return this.creatorId;
  }

  public Ticket setCreatorId(long creatorId) {
    this.creatorId = creatorId;
    setCreatorIdIsSet(true);
    return this;
  }

  public void unsetCreatorId() {
    __isset_bit_vector.clear(__CREATORID_ISSET_ID);
  }

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

  public void setCreatorIdIsSet(boolean value) {
    __isset_bit_vector.set(__CREATORID_ISSET_ID, value);
  }

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

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

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

  /** Returns true if field orderId is set (has been asigned 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 Ticket setAirwayBillNo(String airwayBillNo) {
    this.airwayBillNo = airwayBillNo;
    return this;
  }

  public void unsetAirwayBillNo() {
    this.airwayBillNo = null;
  }

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

  public void setAirwayBillNoIsSet(boolean value) {
    if (!value) {
      this.airwayBillNo = null;
    }
  }

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

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

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

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

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

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

    case CUSTOMER_ID:
      if (value == null) {
        unsetCustomerId();
      } else {
        setCustomerId((Long)value);
      }
      break;

    case OPEN_DATE:
      if (value == null) {
        unsetOpenDate();
      } else {
        setOpenDate((Long)value);
      }
      break;

    case CLOSE_DATE:
      if (value == null) {
        unsetCloseDate();
      } else {
        setCloseDate((Long)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((String)value);
      }
      break;

    case PRIORITY:
      if (value == null) {
        unsetPriority();
      } else {
        setPriority((TicketPriority)value);
      }
      break;

    case CATEGORY:
      if (value == null) {
        unsetCategory();
      } else {
        setCategory((TicketCategory)value);
      }
      break;

    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((TicketStatus)value);
      }
      break;

    case ASSIGNEE_ID:
      if (value == null) {
        unsetAssigneeId();
      } else {
        setAssigneeId((Long)value);
      }
      break;

    case CREATOR_ID:
      if (value == null) {
        unsetCreatorId();
      } else {
        setCreatorId((Long)value);
      }
      break;

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

    case AIRWAY_BILL_NO:
      if (value == null) {
        unsetAirwayBillNo();
      } else {
        setAirwayBillNo((String)value);
      }
      break;

    case PRODUCT_NAME:
      if (value == null) {
        unsetProductName();
      } else {
        setProductName((String)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 CUSTOMER_ID:
      return new Long(getCustomerId());

    case OPEN_DATE:
      return new Long(getOpenDate());

    case CLOSE_DATE:
      return new Long(getCloseDate());

    case DESCRIPTION:
      return getDescription();

    case PRIORITY:
      return getPriority();

    case CATEGORY:
      return getCategory();

    case STATUS:
      return getStatus();

    case ASSIGNEE_ID:
      return new Long(getAssigneeId());

    case CREATOR_ID:
      return new Long(getCreatorId());

    case ORDER_ID:
      return new Long(getOrderId());

    case AIRWAY_BILL_NO:
      return getAirwayBillNo();

    case PRODUCT_NAME:
      return getProductName();

    }
    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 CUSTOMER_ID:
      return isSetCustomerId();
    case OPEN_DATE:
      return isSetOpenDate();
    case CLOSE_DATE:
      return isSetCloseDate();
    case DESCRIPTION:
      return isSetDescription();
    case PRIORITY:
      return isSetPriority();
    case CATEGORY:
      return isSetCategory();
    case STATUS:
      return isSetStatus();
    case ASSIGNEE_ID:
      return isSetAssigneeId();
    case CREATOR_ID:
      return isSetCreatorId();
    case ORDER_ID:
      return isSetOrderId();
    case AIRWAY_BILL_NO:
      return isSetAirwayBillNo();
    case PRODUCT_NAME:
      return isSetProductName();
    }
    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 Ticket)
      return this.equals((Ticket)that);
    return false;
  }

  public boolean equals(Ticket 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_customerId = true;
    boolean that_present_customerId = true;
    if (this_present_customerId || that_present_customerId) {
      if (!(this_present_customerId && that_present_customerId))
        return false;
      if (this.customerId != that.customerId)
        return false;
    }

    boolean this_present_openDate = true;
    boolean that_present_openDate = true;
    if (this_present_openDate || that_present_openDate) {
      if (!(this_present_openDate && that_present_openDate))
        return false;
      if (this.openDate != that.openDate)
        return false;
    }

    boolean this_present_closeDate = true && this.isSetCloseDate();
    boolean that_present_closeDate = true && that.isSetCloseDate();
    if (this_present_closeDate || that_present_closeDate) {
      if (!(this_present_closeDate && that_present_closeDate))
        return false;
      if (this.closeDate != that.closeDate)
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    boolean this_present_priority = true && this.isSetPriority();
    boolean that_present_priority = true && that.isSetPriority();
    if (this_present_priority || that_present_priority) {
      if (!(this_present_priority && that_present_priority))
        return false;
      if (!this.priority.equals(that.priority))
        return false;
    }

    boolean this_present_category = true && this.isSetCategory();
    boolean that_present_category = true && that.isSetCategory();
    if (this_present_category || that_present_category) {
      if (!(this_present_category && that_present_category))
        return false;
      if (!this.category.equals(that.category))
        return false;
    }

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_assigneeId = true && this.isSetAssigneeId();
    boolean that_present_assigneeId = true && that.isSetAssigneeId();
    if (this_present_assigneeId || that_present_assigneeId) {
      if (!(this_present_assigneeId && that_present_assigneeId))
        return false;
      if (this.assigneeId != that.assigneeId)
        return false;
    }

    boolean this_present_creatorId = true;
    boolean that_present_creatorId = true;
    if (this_present_creatorId || that_present_creatorId) {
      if (!(this_present_creatorId && that_present_creatorId))
        return false;
      if (this.creatorId != that.creatorId)
        return false;
    }

    boolean this_present_orderId = true && this.isSetOrderId();
    boolean that_present_orderId = true && that.isSetOrderId();
    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_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;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCustomerId()).compareTo(isSetCustomerId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(customerId, typedOther.customerId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOpenDate()).compareTo(isSetOpenDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(openDate, typedOther.openDate);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCloseDate()).compareTo(isSetCloseDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(closeDate, typedOther.closeDate);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(description, typedOther.description);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetPriority()).compareTo(isSetPriority());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(priority, typedOther.priority);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCategory()).compareTo(isSetCategory());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(category, typedOther.category);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAssigneeId()).compareTo(isSetAssigneeId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(assigneeId, typedOther.assigneeId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCreatorId()).compareTo(isSetCreatorId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(creatorId, typedOther.creatorId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOrderId()).compareTo(isSetOrderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(orderId, typedOther.orderId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAirwayBillNo()).compareTo(isSetAirwayBillNo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(airwayBillNo, typedOther.airwayBillNo);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetProductName()).compareTo(isSetProductName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(productName, typedOther.productName);
    if (lastComparison != 0) {
      return lastComparison;
    }
    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 CUSTOMER_ID:
            if (field.type == TType.I64) {
              this.customerId = iprot.readI64();
              setCustomerIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case OPEN_DATE:
            if (field.type == TType.I64) {
              this.openDate = iprot.readI64();
              setOpenDateIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CLOSE_DATE:
            if (field.type == TType.I64) {
              this.closeDate = iprot.readI64();
              setCloseDateIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DESCRIPTION:
            if (field.type == TType.STRING) {
              this.description = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PRIORITY:
            if (field.type == TType.I32) {
              this.priority = TicketPriority.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CATEGORY:
            if (field.type == TType.I32) {
              this.category = TicketCategory.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case STATUS:
            if (field.type == TType.I32) {
              this.status = TicketStatus.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ASSIGNEE_ID:
            if (field.type == TType.I64) {
              this.assigneeId = iprot.readI64();
              setAssigneeIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CREATOR_ID:
            if (field.type == TType.I64) {
              this.creatorId = iprot.readI64();
              setCreatorIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ORDER_ID:
            if (field.type == TType.I64) {
              this.orderId = iprot.readI64();
              setOrderIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AIRWAY_BILL_NO:
            if (field.type == TType.STRING) {
              this.airwayBillNo = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PRODUCT_NAME:
            if (field.type == TType.STRING) {
              this.productName = iprot.readString();
            } 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();
    oprot.writeFieldBegin(CUSTOMER_ID_FIELD_DESC);
    oprot.writeI64(this.customerId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(OPEN_DATE_FIELD_DESC);
    oprot.writeI64(this.openDate);
    oprot.writeFieldEnd();
    if (isSetCloseDate()) {
      oprot.writeFieldBegin(CLOSE_DATE_FIELD_DESC);
      oprot.writeI64(this.closeDate);
      oprot.writeFieldEnd();
    }
    if (this.description != null) {
      oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.description);
      oprot.writeFieldEnd();
    }
    if (this.priority != null) {
      oprot.writeFieldBegin(PRIORITY_FIELD_DESC);
      oprot.writeI32(this.priority.getValue());
      oprot.writeFieldEnd();
    }
    if (this.category != null) {
      oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
      oprot.writeI32(this.category.getValue());
      oprot.writeFieldEnd();
    }
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    if (isSetAssigneeId()) {
      oprot.writeFieldBegin(ASSIGNEE_ID_FIELD_DESC);
      oprot.writeI64(this.assigneeId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATOR_ID_FIELD_DESC);
    oprot.writeI64(this.creatorId);
    oprot.writeFieldEnd();
    if (isSetOrderId()) {
      oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
      oprot.writeI64(this.orderId);
      oprot.writeFieldEnd();
    }
    if (this.airwayBillNo != null) {
      if (isSetAirwayBillNo()) {
        oprot.writeFieldBegin(AIRWAY_BILL_NO_FIELD_DESC);
        oprot.writeString(this.airwayBillNo);
        oprot.writeFieldEnd();
      }
    }
    if (this.productName != null) {
      if (isSetProductName()) {
        oprot.writeFieldBegin(PRODUCT_NAME_FIELD_DESC);
        oprot.writeString(this.productName);
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("customerId:");
    sb.append(this.customerId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("openDate:");
    sb.append(this.openDate);
    first = false;
    if (isSetCloseDate()) {
      if (!first) sb.append(", ");
      sb.append("closeDate:");
      sb.append(this.closeDate);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("description:");
    if (this.description == null) {
      sb.append("null");
    } else {
      sb.append(this.description);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("priority:");
    if (this.priority == null) {
      sb.append("null");
    } else {
      String priority_name = priority.name();
      if (priority_name != null) {
        sb.append(priority_name);
        sb.append(" (");
      }
      sb.append(this.priority);
      if (priority_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("category:");
    if (this.category == null) {
      sb.append("null");
    } else {
      String category_name = category.name();
      if (category_name != null) {
        sb.append(category_name);
        sb.append(" (");
      }
      sb.append(this.category);
      if (category_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      String status_name = status.name();
      if (status_name != null) {
        sb.append(status_name);
        sb.append(" (");
      }
      sb.append(this.status);
      if (status_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (isSetAssigneeId()) {
      if (!first) sb.append(", ");
      sb.append("assigneeId:");
      sb.append(this.assigneeId);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("creatorId:");
    sb.append(this.creatorId);
    first = false;
    if (isSetOrderId()) {
      if (!first) sb.append(", ");
      sb.append("orderId:");
      sb.append(this.orderId);
      first = false;
    }
    if (isSetAirwayBillNo()) {
      if (!first) sb.append(", ");
      sb.append("airwayBillNo:");
      if (this.airwayBillNo == null) {
        sb.append("null");
      } else {
        sb.append(this.airwayBillNo);
      }
      first = false;
    }
    if (isSetProductName()) {
      if (!first) sb.append(", ");
      sb.append("productName:");
      if (this.productName == null) {
        sb.append("null");
      } else {
        sb.append(this.productName);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

}