Subversion Repositories SmartDukaan

Rev

Go to most recent revision | 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.warehouse;

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

  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField ORIGIN_WAREHOUSE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("originWarehouseId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField DESTINATION_WAREHOUSE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("destinationWarehouseId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("quantity", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField TRANSFER_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("transferDate", org.apache.thrift.protocol.TType.I64, (short)5);

  private long itemId; // required
  private long originWarehouseId; // required
  private long destinationWarehouseId; // required
  private long quantity; // required
  private long transferDate; // 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 {
    ITEM_ID((short)1, "itemId"),
    ORIGIN_WAREHOUSE_ID((short)2, "originWarehouseId"),
    DESTINATION_WAREHOUSE_ID((short)3, "destinationWarehouseId"),
    QUANTITY((short)4, "quantity"),
    TRANSFER_DATE((short)5, "transferDate");

    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: // ITEM_ID
          return ITEM_ID;
        case 2: // ORIGIN_WAREHOUSE_ID
          return ORIGIN_WAREHOUSE_ID;
        case 3: // DESTINATION_WAREHOUSE_ID
          return DESTINATION_WAREHOUSE_ID;
        case 4: // QUANTITY
          return QUANTITY;
        case 5: // TRANSFER_DATE
          return TRANSFER_DATE;
        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 __ITEMID_ISSET_ID = 0;
  private static final int __ORIGINWAREHOUSEID_ISSET_ID = 1;
  private static final int __DESTINATIONWAREHOUSEID_ISSET_ID = 2;
  private static final int __QUANTITY_ISSET_ID = 3;
  private static final int __TRANSFERDATE_ISSET_ID = 4;
  private BitSet __isset_bit_vector = new BitSet(5);

  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.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ORIGIN_WAREHOUSE_ID, new org.apache.thrift.meta_data.FieldMetaData("originWarehouseId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DESTINATION_WAREHOUSE_ID, new org.apache.thrift.meta_data.FieldMetaData("destinationWarehouseId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("quantity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TRANSFER_DATE, new org.apache.thrift.meta_data.FieldMetaData("transferDate", 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(InTransitInventory.class, metaDataMap);
  }

  public InTransitInventory() {
  }

  public InTransitInventory(
    long itemId,
    long originWarehouseId,
    long destinationWarehouseId,
    long quantity,
    long transferDate)
  {
    this();
    this.itemId = itemId;
    setItemIdIsSet(true);
    this.originWarehouseId = originWarehouseId;
    setOriginWarehouseIdIsSet(true);
    this.destinationWarehouseId = destinationWarehouseId;
    setDestinationWarehouseIdIsSet(true);
    this.quantity = quantity;
    setQuantityIsSet(true);
    this.transferDate = transferDate;
    setTransferDateIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public InTransitInventory(InTransitInventory other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.itemId = other.itemId;
    this.originWarehouseId = other.originWarehouseId;
    this.destinationWarehouseId = other.destinationWarehouseId;
    this.quantity = other.quantity;
    this.transferDate = other.transferDate;
  }

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

  @Override
  public void clear() {
    setItemIdIsSet(false);
    this.itemId = 0;
    setOriginWarehouseIdIsSet(false);
    this.originWarehouseId = 0;
    setDestinationWarehouseIdIsSet(false);
    this.destinationWarehouseId = 0;
    setQuantityIsSet(false);
    this.quantity = 0;
    setTransferDateIsSet(false);
    this.transferDate = 0;
  }

  public long getItemId() {
    return this.itemId;
  }

  public void setItemId(long itemId) {
    this.itemId = itemId;
    setItemIdIsSet(true);
  }

  public void unsetItemId() {
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
  }

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

  public void setItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
  }

  public long getOriginWarehouseId() {
    return this.originWarehouseId;
  }

  public void setOriginWarehouseId(long originWarehouseId) {
    this.originWarehouseId = originWarehouseId;
    setOriginWarehouseIdIsSet(true);
  }

  public void unsetOriginWarehouseId() {
    __isset_bit_vector.clear(__ORIGINWAREHOUSEID_ISSET_ID);
  }

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

  public void setOriginWarehouseIdIsSet(boolean value) {
    __isset_bit_vector.set(__ORIGINWAREHOUSEID_ISSET_ID, value);
  }

  public long getDestinationWarehouseId() {
    return this.destinationWarehouseId;
  }

  public void setDestinationWarehouseId(long destinationWarehouseId) {
    this.destinationWarehouseId = destinationWarehouseId;
    setDestinationWarehouseIdIsSet(true);
  }

  public void unsetDestinationWarehouseId() {
    __isset_bit_vector.clear(__DESTINATIONWAREHOUSEID_ISSET_ID);
  }

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

  public void setDestinationWarehouseIdIsSet(boolean value) {
    __isset_bit_vector.set(__DESTINATIONWAREHOUSEID_ISSET_ID, value);
  }

  public long getQuantity() {
    return this.quantity;
  }

  public void setQuantity(long quantity) {
    this.quantity = quantity;
    setQuantityIsSet(true);
  }

  public void unsetQuantity() {
    __isset_bit_vector.clear(__QUANTITY_ISSET_ID);
  }

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

  public void setQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__QUANTITY_ISSET_ID, value);
  }

  public long getTransferDate() {
    return this.transferDate;
  }

  public void setTransferDate(long transferDate) {
    this.transferDate = transferDate;
    setTransferDateIsSet(true);
  }

  public void unsetTransferDate() {
    __isset_bit_vector.clear(__TRANSFERDATE_ISSET_ID);
  }

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

  public void setTransferDateIsSet(boolean value) {
    __isset_bit_vector.set(__TRANSFERDATE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ITEM_ID:
      if (value == null) {
        unsetItemId();
      } else {
        setItemId((Long)value);
      }
      break;

    case ORIGIN_WAREHOUSE_ID:
      if (value == null) {
        unsetOriginWarehouseId();
      } else {
        setOriginWarehouseId((Long)value);
      }
      break;

    case DESTINATION_WAREHOUSE_ID:
      if (value == null) {
        unsetDestinationWarehouseId();
      } else {
        setDestinationWarehouseId((Long)value);
      }
      break;

    case QUANTITY:
      if (value == null) {
        unsetQuantity();
      } else {
        setQuantity((Long)value);
      }
      break;

    case TRANSFER_DATE:
      if (value == null) {
        unsetTransferDate();
      } else {
        setTransferDate((Long)value);
      }
      break;

    }
  }

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

    case ORIGIN_WAREHOUSE_ID:
      return Long.valueOf(getOriginWarehouseId());

    case DESTINATION_WAREHOUSE_ID:
      return Long.valueOf(getDestinationWarehouseId());

    case QUANTITY:
      return Long.valueOf(getQuantity());

    case TRANSFER_DATE:
      return Long.valueOf(getTransferDate());

    }
    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 ITEM_ID:
      return isSetItemId();
    case ORIGIN_WAREHOUSE_ID:
      return isSetOriginWarehouseId();
    case DESTINATION_WAREHOUSE_ID:
      return isSetDestinationWarehouseId();
    case QUANTITY:
      return isSetQuantity();
    case TRANSFER_DATE:
      return isSetTransferDate();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_itemId = true;
    boolean that_present_itemId = true;
    if (this_present_itemId || that_present_itemId) {
      if (!(this_present_itemId && that_present_itemId))
        return false;
      if (this.itemId != that.itemId)
        return false;
    }

    boolean this_present_originWarehouseId = true;
    boolean that_present_originWarehouseId = true;
    if (this_present_originWarehouseId || that_present_originWarehouseId) {
      if (!(this_present_originWarehouseId && that_present_originWarehouseId))
        return false;
      if (this.originWarehouseId != that.originWarehouseId)
        return false;
    }

    boolean this_present_destinationWarehouseId = true;
    boolean that_present_destinationWarehouseId = true;
    if (this_present_destinationWarehouseId || that_present_destinationWarehouseId) {
      if (!(this_present_destinationWarehouseId && that_present_destinationWarehouseId))
        return false;
      if (this.destinationWarehouseId != that.destinationWarehouseId)
        return false;
    }

    boolean this_present_quantity = true;
    boolean that_present_quantity = true;
    if (this_present_quantity || that_present_quantity) {
      if (!(this_present_quantity && that_present_quantity))
        return false;
      if (this.quantity != that.quantity)
        return false;
    }

    boolean this_present_transferDate = true;
    boolean that_present_transferDate = true;
    if (this_present_transferDate || that_present_transferDate) {
      if (!(this_present_transferDate && that_present_transferDate))
        return false;
      if (this.transferDate != that.transferDate)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItemId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOriginWarehouseId()).compareTo(typedOther.isSetOriginWarehouseId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOriginWarehouseId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.originWarehouseId, typedOther.originWarehouseId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDestinationWarehouseId()).compareTo(typedOther.isSetDestinationWarehouseId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDestinationWarehouseId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.destinationWarehouseId, typedOther.destinationWarehouseId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(typedOther.isSetQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuantity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.quantity, typedOther.quantity);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTransferDate()).compareTo(typedOther.isSetTransferDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTransferDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transferDate, typedOther.transferDate);
      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: // ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.itemId = iprot.readI64();
            setItemIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ORIGIN_WAREHOUSE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.originWarehouseId = iprot.readI64();
            setOriginWarehouseIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // DESTINATION_WAREHOUSE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.destinationWarehouseId = iprot.readI64();
            setDestinationWarehouseIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // QUANTITY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.quantity = iprot.readI64();
            setQuantityIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // TRANSFER_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.transferDate = iprot.readI64();
            setTransferDateIsSet(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(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.itemId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ORIGIN_WAREHOUSE_ID_FIELD_DESC);
    oprot.writeI64(this.originWarehouseId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DESTINATION_WAREHOUSE_ID_FIELD_DESC);
    oprot.writeI64(this.destinationWarehouseId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
    oprot.writeI64(this.quantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TRANSFER_DATE_FIELD_DESC);
    oprot.writeI64(this.transferDate);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("itemId:");
    sb.append(this.itemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("originWarehouseId:");
    sb.append(this.originWarehouseId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("destinationWarehouseId:");
    sb.append(this.destinationWarehouseId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("quantity:");
    sb.append(this.quantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("transferDate:");
    sb.append(this.transferDate);
    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);
    }
  }

}