Subversion Repositories SmartDukaan

Rev

Rev 886 | Blame | Last modification | View Log | RSS feed

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

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 InventoryService {

  public interface Iface {

    /**
     * For closing the open session in sqlalchemy
     */
    public void closeSession() throws TException;

    /**
     * Availability and inventory attributes
     * 
     * @param item
     */
    public long addItem(Item item) throws InventoryServiceException, TException;

    public long updateItem(Item item) throws InventoryServiceException, TException;

    public long addWarehouse(Warehouse warehouse) throws InventoryServiceException, TException;

    public boolean isActive(long itemId) throws InventoryServiceException, TException;

    public void updateInventory(long warehouse_id, String timestamp, Map<String,Long> availability) throws InventoryServiceException, TException;

    public void retireWarehouse(long warehouse_id) throws InventoryServiceException, TException;

    public void startItemOn(long item_id, long timestamp) throws InventoryServiceException, TException;

    public void retireItemOn(long item_id, long timestamp) throws InventoryServiceException, TException;

    public void changeItemStatus(long item_id, long timestamp, status newstatus) throws InventoryServiceException, TException;

    public Item getItem(long item_id) throws InventoryServiceException, TException;

    public List<Item> getItemsByCatalogId(long catalog_item_id) throws InventoryServiceException, TException;

    public List<Item> getAllItems(boolean isActive) throws InventoryServiceException, TException;

    public List<Item> getAllItemsByStatus(status itemStatus) throws InventoryServiceException, TException;

    public ItemInventory getItemInventory(long item_id) throws InventoryServiceException, TException;

    public ItemInventory getItemInventoryByItemId(long item_id) throws InventoryServiceException, TException;

    public long getItemAvailibilityAtWarehouse(long warehouse_id, long item_id) throws InventoryServiceException, TException;

    public boolean markItemAsContentComplete(long entityId) throws InventoryServiceException, TException;

    /**
     * Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
     * The size of list will always be 2.
     * 
     * @param warehouse_loc
     * @param item_id
     */
    public List<Long> getItemAvailabilityAtLocation(long warehouse_loc, long item_id) throws InventoryServiceException, TException;

    public List<Warehouse> getAllWarehouses(boolean isActive) throws InventoryServiceException, TException;

    public Warehouse getWarehouse(long warehouse_id) throws InventoryServiceException, TException;

    public List<Warehouse> getAllWarehousesForItem(long item_id) throws InventoryServiceException, TException;

    public List<Item> getAllItemsForWarehouse(long warehouse_id) throws InventoryServiceException, TException;

    /**
     * Increases the reservation count for an item in a warehouse. Should always succeed normally.
     * 
     * @param itemId
     * @param warehouseId
     * @param quantity
     */
    public boolean reserveItemInWarehouse(long itemId, long warehouseId, double quantity) throws InventoryServiceException, TException;

    /**
     * Decreases the reservation count for an item in a warehouse. Should always succeed normally.
     * 
     * @param itemId
     * @param warehouseId
     * @param quantity
     */
    public boolean reduceReservationCount(long itemId, long warehouseId, double quantity) throws InventoryServiceException, TException;

    public List<Item> getBestSellers() throws InventoryServiceException, TException;

    public List<Long> getBestSellersCatalogIds(long beginIndex, long totalItems, long category) throws InventoryServiceException, TException;

    public long getBestSellersCount() throws InventoryServiceException, TException;

    public List<Item> getBestDeals() throws InventoryServiceException, TException;

    public List<Long> getBestDealsCatalogIds(long beginIndex, long totalItems, long category) throws InventoryServiceException, TException;

    public long getBestDealsCount() throws InventoryServiceException, TException;

    public List<Item> getLatestArrivals() throws InventoryServiceException, TException;

    public List<Long> getLatestArrivalsCatalogIds(long beginIndex, long totalItems, long category) throws InventoryServiceException, TException;

    public long getLatestArrivalsCount() throws InventoryServiceException, TException;

    public boolean putCategoryObject(byte[] object) throws TException;

    public byte[] getCategoryObject() throws TException;

  }

  public static class Client implements Iface {
    public Client(TProtocol prot)
    {
      this(prot, prot);
    }

    public Client(TProtocol iprot, TProtocol oprot)
    {
      iprot_ = iprot;
      oprot_ = oprot;
    }

    protected TProtocol iprot_;
    protected TProtocol oprot_;

    protected int seqid_;

    public TProtocol getInputProtocol()
    {
      return this.iprot_;
    }

    public TProtocol getOutputProtocol()
    {
      return this.oprot_;
    }

    public void closeSession() throws TException
    {
      send_closeSession();
      recv_closeSession();
    }

    public void send_closeSession() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("closeSession", TMessageType.CALL, seqid_));
      closeSession_args args = new closeSession_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_closeSession() throws TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      closeSession_result result = new closeSession_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      return;
    }

    public long addItem(Item item) throws InventoryServiceException, TException
    {
      send_addItem(item);
      return recv_addItem();
    }

    public void send_addItem(Item item) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("addItem", TMessageType.CALL, seqid_));
      addItem_args args = new addItem_args();
      args.item = item;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_addItem() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      addItem_result result = new addItem_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "addItem failed: unknown result");
    }

    public long updateItem(Item item) throws InventoryServiceException, TException
    {
      send_updateItem(item);
      return recv_updateItem();
    }

    public void send_updateItem(Item item) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("updateItem", TMessageType.CALL, seqid_));
      updateItem_args args = new updateItem_args();
      args.item = item;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_updateItem() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      updateItem_result result = new updateItem_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "updateItem failed: unknown result");
    }

    public long addWarehouse(Warehouse warehouse) throws InventoryServiceException, TException
    {
      send_addWarehouse(warehouse);
      return recv_addWarehouse();
    }

    public void send_addWarehouse(Warehouse warehouse) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("addWarehouse", TMessageType.CALL, seqid_));
      addWarehouse_args args = new addWarehouse_args();
      args.warehouse = warehouse;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_addWarehouse() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      addWarehouse_result result = new addWarehouse_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "addWarehouse failed: unknown result");
    }

    public boolean isActive(long itemId) throws InventoryServiceException, TException
    {
      send_isActive(itemId);
      return recv_isActive();
    }

    public void send_isActive(long itemId) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("isActive", TMessageType.CALL, seqid_));
      isActive_args args = new isActive_args();
      args.itemId = itemId;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public boolean recv_isActive() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      isActive_result result = new isActive_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.isex != null) {
        throw result.isex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "isActive failed: unknown result");
    }

    public void updateInventory(long warehouse_id, String timestamp, Map<String,Long> availability) throws InventoryServiceException, TException
    {
      send_updateInventory(warehouse_id, timestamp, availability);
      recv_updateInventory();
    }

    public void send_updateInventory(long warehouse_id, String timestamp, Map<String,Long> availability) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("updateInventory", TMessageType.CALL, seqid_));
      updateInventory_args args = new updateInventory_args();
      args.warehouse_id = warehouse_id;
      args.timestamp = timestamp;
      args.availability = availability;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_updateInventory() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      updateInventory_result result = new updateInventory_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.cex != null) {
        throw result.cex;
      }
      return;
    }

    public void retireWarehouse(long warehouse_id) throws InventoryServiceException, TException
    {
      send_retireWarehouse(warehouse_id);
      recv_retireWarehouse();
    }

    public void send_retireWarehouse(long warehouse_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("retireWarehouse", TMessageType.CALL, seqid_));
      retireWarehouse_args args = new retireWarehouse_args();
      args.warehouse_id = warehouse_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_retireWarehouse() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      retireWarehouse_result result = new retireWarehouse_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.cex != null) {
        throw result.cex;
      }
      return;
    }

    public void startItemOn(long item_id, long timestamp) throws InventoryServiceException, TException
    {
      send_startItemOn(item_id, timestamp);
      recv_startItemOn();
    }

    public void send_startItemOn(long item_id, long timestamp) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("startItemOn", TMessageType.CALL, seqid_));
      startItemOn_args args = new startItemOn_args();
      args.item_id = item_id;
      args.timestamp = timestamp;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_startItemOn() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      startItemOn_result result = new startItemOn_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.cex != null) {
        throw result.cex;
      }
      return;
    }

    public void retireItemOn(long item_id, long timestamp) throws InventoryServiceException, TException
    {
      send_retireItemOn(item_id, timestamp);
      recv_retireItemOn();
    }

    public void send_retireItemOn(long item_id, long timestamp) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("retireItemOn", TMessageType.CALL, seqid_));
      retireItemOn_args args = new retireItemOn_args();
      args.item_id = item_id;
      args.timestamp = timestamp;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_retireItemOn() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      retireItemOn_result result = new retireItemOn_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.cex != null) {
        throw result.cex;
      }
      return;
    }

    public void changeItemStatus(long item_id, long timestamp, status newstatus) throws InventoryServiceException, TException
    {
      send_changeItemStatus(item_id, timestamp, newstatus);
      recv_changeItemStatus();
    }

    public void send_changeItemStatus(long item_id, long timestamp, status newstatus) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("changeItemStatus", TMessageType.CALL, seqid_));
      changeItemStatus_args args = new changeItemStatus_args();
      args.item_id = item_id;
      args.timestamp = timestamp;
      args.newstatus = newstatus;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_changeItemStatus() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      changeItemStatus_result result = new changeItemStatus_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.cex != null) {
        throw result.cex;
      }
      return;
    }

    public Item getItem(long item_id) throws InventoryServiceException, TException
    {
      send_getItem(item_id);
      return recv_getItem();
    }

    public void send_getItem(long item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getItem", TMessageType.CALL, seqid_));
      getItem_args args = new getItem_args();
      args.item_id = item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public Item recv_getItem() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getItem_result result = new getItem_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getItem failed: unknown result");
    }

    public List<Item> getItemsByCatalogId(long catalog_item_id) throws InventoryServiceException, TException
    {
      send_getItemsByCatalogId(catalog_item_id);
      return recv_getItemsByCatalogId();
    }

    public void send_getItemsByCatalogId(long catalog_item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getItemsByCatalogId", TMessageType.CALL, seqid_));
      getItemsByCatalogId_args args = new getItemsByCatalogId_args();
      args.catalog_item_id = catalog_item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getItemsByCatalogId() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getItemsByCatalogId_result result = new getItemsByCatalogId_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getItemsByCatalogId failed: unknown result");
    }

    public List<Item> getAllItems(boolean isActive) throws InventoryServiceException, TException
    {
      send_getAllItems(isActive);
      return recv_getAllItems();
    }

    public void send_getAllItems(boolean isActive) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getAllItems", TMessageType.CALL, seqid_));
      getAllItems_args args = new getAllItems_args();
      args.isActive = isActive;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getAllItems() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getAllItems_result result = new getAllItems_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getAllItems failed: unknown result");
    }

    public List<Item> getAllItemsByStatus(status itemStatus) throws InventoryServiceException, TException
    {
      send_getAllItemsByStatus(itemStatus);
      return recv_getAllItemsByStatus();
    }

    public void send_getAllItemsByStatus(status itemStatus) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getAllItemsByStatus", TMessageType.CALL, seqid_));
      getAllItemsByStatus_args args = new getAllItemsByStatus_args();
      args.itemStatus = itemStatus;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getAllItemsByStatus() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getAllItemsByStatus_result result = new getAllItemsByStatus_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getAllItemsByStatus failed: unknown result");
    }

    public ItemInventory getItemInventory(long item_id) throws InventoryServiceException, TException
    {
      send_getItemInventory(item_id);
      return recv_getItemInventory();
    }

    public void send_getItemInventory(long item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getItemInventory", TMessageType.CALL, seqid_));
      getItemInventory_args args = new getItemInventory_args();
      args.item_id = item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public ItemInventory recv_getItemInventory() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getItemInventory_result result = new getItemInventory_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getItemInventory failed: unknown result");
    }

    public ItemInventory getItemInventoryByItemId(long item_id) throws InventoryServiceException, TException
    {
      send_getItemInventoryByItemId(item_id);
      return recv_getItemInventoryByItemId();
    }

    public void send_getItemInventoryByItemId(long item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getItemInventoryByItemId", TMessageType.CALL, seqid_));
      getItemInventoryByItemId_args args = new getItemInventoryByItemId_args();
      args.item_id = item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public ItemInventory recv_getItemInventoryByItemId() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getItemInventoryByItemId_result result = new getItemInventoryByItemId_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getItemInventoryByItemId failed: unknown result");
    }

    public long getItemAvailibilityAtWarehouse(long warehouse_id, long item_id) throws InventoryServiceException, TException
    {
      send_getItemAvailibilityAtWarehouse(warehouse_id, item_id);
      return recv_getItemAvailibilityAtWarehouse();
    }

    public void send_getItemAvailibilityAtWarehouse(long warehouse_id, long item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getItemAvailibilityAtWarehouse", TMessageType.CALL, seqid_));
      getItemAvailibilityAtWarehouse_args args = new getItemAvailibilityAtWarehouse_args();
      args.warehouse_id = warehouse_id;
      args.item_id = item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_getItemAvailibilityAtWarehouse() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getItemAvailibilityAtWarehouse_result result = new getItemAvailibilityAtWarehouse_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getItemAvailibilityAtWarehouse failed: unknown result");
    }

    public boolean markItemAsContentComplete(long entityId) throws InventoryServiceException, TException
    {
      send_markItemAsContentComplete(entityId);
      return recv_markItemAsContentComplete();
    }

    public void send_markItemAsContentComplete(long entityId) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("markItemAsContentComplete", TMessageType.CALL, seqid_));
      markItemAsContentComplete_args args = new markItemAsContentComplete_args();
      args.entityId = entityId;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public boolean recv_markItemAsContentComplete() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      markItemAsContentComplete_result result = new markItemAsContentComplete_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "markItemAsContentComplete failed: unknown result");
    }

    public List<Long> getItemAvailabilityAtLocation(long warehouse_loc, long item_id) throws InventoryServiceException, TException
    {
      send_getItemAvailabilityAtLocation(warehouse_loc, item_id);
      return recv_getItemAvailabilityAtLocation();
    }

    public void send_getItemAvailabilityAtLocation(long warehouse_loc, long item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getItemAvailabilityAtLocation", TMessageType.CALL, seqid_));
      getItemAvailabilityAtLocation_args args = new getItemAvailabilityAtLocation_args();
      args.warehouse_loc = warehouse_loc;
      args.item_id = item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Long> recv_getItemAvailabilityAtLocation() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getItemAvailabilityAtLocation_result result = new getItemAvailabilityAtLocation_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.isex != null) {
        throw result.isex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getItemAvailabilityAtLocation failed: unknown result");
    }

    public List<Warehouse> getAllWarehouses(boolean isActive) throws InventoryServiceException, TException
    {
      send_getAllWarehouses(isActive);
      return recv_getAllWarehouses();
    }

    public void send_getAllWarehouses(boolean isActive) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getAllWarehouses", TMessageType.CALL, seqid_));
      getAllWarehouses_args args = new getAllWarehouses_args();
      args.isActive = isActive;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Warehouse> recv_getAllWarehouses() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getAllWarehouses_result result = new getAllWarehouses_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getAllWarehouses failed: unknown result");
    }

    public Warehouse getWarehouse(long warehouse_id) throws InventoryServiceException, TException
    {
      send_getWarehouse(warehouse_id);
      return recv_getWarehouse();
    }

    public void send_getWarehouse(long warehouse_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getWarehouse", TMessageType.CALL, seqid_));
      getWarehouse_args args = new getWarehouse_args();
      args.warehouse_id = warehouse_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public Warehouse recv_getWarehouse() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getWarehouse_result result = new getWarehouse_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getWarehouse failed: unknown result");
    }

    public List<Warehouse> getAllWarehousesForItem(long item_id) throws InventoryServiceException, TException
    {
      send_getAllWarehousesForItem(item_id);
      return recv_getAllWarehousesForItem();
    }

    public void send_getAllWarehousesForItem(long item_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getAllWarehousesForItem", TMessageType.CALL, seqid_));
      getAllWarehousesForItem_args args = new getAllWarehousesForItem_args();
      args.item_id = item_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Warehouse> recv_getAllWarehousesForItem() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getAllWarehousesForItem_result result = new getAllWarehousesForItem_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getAllWarehousesForItem failed: unknown result");
    }

    public List<Item> getAllItemsForWarehouse(long warehouse_id) throws InventoryServiceException, TException
    {
      send_getAllItemsForWarehouse(warehouse_id);
      return recv_getAllItemsForWarehouse();
    }

    public void send_getAllItemsForWarehouse(long warehouse_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getAllItemsForWarehouse", TMessageType.CALL, seqid_));
      getAllItemsForWarehouse_args args = new getAllItemsForWarehouse_args();
      args.warehouse_id = warehouse_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getAllItemsForWarehouse() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getAllItemsForWarehouse_result result = new getAllItemsForWarehouse_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getAllItemsForWarehouse failed: unknown result");
    }

    public boolean reserveItemInWarehouse(long itemId, long warehouseId, double quantity) throws InventoryServiceException, TException
    {
      send_reserveItemInWarehouse(itemId, warehouseId, quantity);
      return recv_reserveItemInWarehouse();
    }

    public void send_reserveItemInWarehouse(long itemId, long warehouseId, double quantity) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("reserveItemInWarehouse", TMessageType.CALL, seqid_));
      reserveItemInWarehouse_args args = new reserveItemInWarehouse_args();
      args.itemId = itemId;
      args.warehouseId = warehouseId;
      args.quantity = quantity;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public boolean recv_reserveItemInWarehouse() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      reserveItemInWarehouse_result result = new reserveItemInWarehouse_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "reserveItemInWarehouse failed: unknown result");
    }

    public boolean reduceReservationCount(long itemId, long warehouseId, double quantity) throws InventoryServiceException, TException
    {
      send_reduceReservationCount(itemId, warehouseId, quantity);
      return recv_reduceReservationCount();
    }

    public void send_reduceReservationCount(long itemId, long warehouseId, double quantity) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("reduceReservationCount", TMessageType.CALL, seqid_));
      reduceReservationCount_args args = new reduceReservationCount_args();
      args.itemId = itemId;
      args.warehouseId = warehouseId;
      args.quantity = quantity;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public boolean recv_reduceReservationCount() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      reduceReservationCount_result result = new reduceReservationCount_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "reduceReservationCount failed: unknown result");
    }

    public List<Item> getBestSellers() throws InventoryServiceException, TException
    {
      send_getBestSellers();
      return recv_getBestSellers();
    }

    public void send_getBestSellers() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getBestSellers", TMessageType.CALL, seqid_));
      getBestSellers_args args = new getBestSellers_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getBestSellers() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getBestSellers_result result = new getBestSellers_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.isex != null) {
        throw result.isex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getBestSellers failed: unknown result");
    }

    public List<Long> getBestSellersCatalogIds(long beginIndex, long totalItems, long category) throws InventoryServiceException, TException
    {
      send_getBestSellersCatalogIds(beginIndex, totalItems, category);
      return recv_getBestSellersCatalogIds();
    }

    public void send_getBestSellersCatalogIds(long beginIndex, long totalItems, long category) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getBestSellersCatalogIds", TMessageType.CALL, seqid_));
      getBestSellersCatalogIds_args args = new getBestSellersCatalogIds_args();
      args.beginIndex = beginIndex;
      args.totalItems = totalItems;
      args.category = category;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Long> recv_getBestSellersCatalogIds() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getBestSellersCatalogIds_result result = new getBestSellersCatalogIds_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getBestSellersCatalogIds failed: unknown result");
    }

    public long getBestSellersCount() throws InventoryServiceException, TException
    {
      send_getBestSellersCount();
      return recv_getBestSellersCount();
    }

    public void send_getBestSellersCount() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getBestSellersCount", TMessageType.CALL, seqid_));
      getBestSellersCount_args args = new getBestSellersCount_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_getBestSellersCount() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getBestSellersCount_result result = new getBestSellersCount_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getBestSellersCount failed: unknown result");
    }

    public List<Item> getBestDeals() throws InventoryServiceException, TException
    {
      send_getBestDeals();
      return recv_getBestDeals();
    }

    public void send_getBestDeals() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getBestDeals", TMessageType.CALL, seqid_));
      getBestDeals_args args = new getBestDeals_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getBestDeals() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getBestDeals_result result = new getBestDeals_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.isex != null) {
        throw result.isex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getBestDeals failed: unknown result");
    }

    public List<Long> getBestDealsCatalogIds(long beginIndex, long totalItems, long category) throws InventoryServiceException, TException
    {
      send_getBestDealsCatalogIds(beginIndex, totalItems, category);
      return recv_getBestDealsCatalogIds();
    }

    public void send_getBestDealsCatalogIds(long beginIndex, long totalItems, long category) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getBestDealsCatalogIds", TMessageType.CALL, seqid_));
      getBestDealsCatalogIds_args args = new getBestDealsCatalogIds_args();
      args.beginIndex = beginIndex;
      args.totalItems = totalItems;
      args.category = category;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Long> recv_getBestDealsCatalogIds() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getBestDealsCatalogIds_result result = new getBestDealsCatalogIds_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getBestDealsCatalogIds failed: unknown result");
    }

    public long getBestDealsCount() throws InventoryServiceException, TException
    {
      send_getBestDealsCount();
      return recv_getBestDealsCount();
    }

    public void send_getBestDealsCount() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getBestDealsCount", TMessageType.CALL, seqid_));
      getBestDealsCount_args args = new getBestDealsCount_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_getBestDealsCount() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getBestDealsCount_result result = new getBestDealsCount_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getBestDealsCount failed: unknown result");
    }

    public List<Item> getLatestArrivals() throws InventoryServiceException, TException
    {
      send_getLatestArrivals();
      return recv_getLatestArrivals();
    }

    public void send_getLatestArrivals() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getLatestArrivals", TMessageType.CALL, seqid_));
      getLatestArrivals_args args = new getLatestArrivals_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Item> recv_getLatestArrivals() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getLatestArrivals_result result = new getLatestArrivals_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.isex != null) {
        throw result.isex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getLatestArrivals failed: unknown result");
    }

    public List<Long> getLatestArrivalsCatalogIds(long beginIndex, long totalItems, long category) throws InventoryServiceException, TException
    {
      send_getLatestArrivalsCatalogIds(beginIndex, totalItems, category);
      return recv_getLatestArrivalsCatalogIds();
    }

    public void send_getLatestArrivalsCatalogIds(long beginIndex, long totalItems, long category) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getLatestArrivalsCatalogIds", TMessageType.CALL, seqid_));
      getLatestArrivalsCatalogIds_args args = new getLatestArrivalsCatalogIds_args();
      args.beginIndex = beginIndex;
      args.totalItems = totalItems;
      args.category = category;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Long> recv_getLatestArrivalsCatalogIds() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getLatestArrivalsCatalogIds_result result = new getLatestArrivalsCatalogIds_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getLatestArrivalsCatalogIds failed: unknown result");
    }

    public long getLatestArrivalsCount() throws InventoryServiceException, TException
    {
      send_getLatestArrivalsCount();
      return recv_getLatestArrivalsCount();
    }

    public void send_getLatestArrivalsCount() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getLatestArrivalsCount", TMessageType.CALL, seqid_));
      getLatestArrivalsCount_args args = new getLatestArrivalsCount_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_getLatestArrivalsCount() throws InventoryServiceException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getLatestArrivalsCount_result result = new getLatestArrivalsCount_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.cex != null) {
        throw result.cex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getLatestArrivalsCount failed: unknown result");
    }

    public boolean putCategoryObject(byte[] object) throws TException
    {
      send_putCategoryObject(object);
      return recv_putCategoryObject();
    }

    public void send_putCategoryObject(byte[] object) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("putCategoryObject", TMessageType.CALL, seqid_));
      putCategoryObject_args args = new putCategoryObject_args();
      args.object = object;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public boolean recv_putCategoryObject() throws TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      putCategoryObject_result result = new putCategoryObject_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "putCategoryObject failed: unknown result");
    }

    public byte[] getCategoryObject() throws TException
    {
      send_getCategoryObject();
      return recv_getCategoryObject();
    }

    public void send_getCategoryObject() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getCategoryObject", TMessageType.CALL, seqid_));
      getCategoryObject_args args = new getCategoryObject_args();
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public byte[] recv_getCategoryObject() throws TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getCategoryObject_result result = new getCategoryObject_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getCategoryObject failed: unknown result");
    }

  }
  public static class Processor implements TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(Iface iface)
    {
      iface_ = iface;
      processMap_.put("closeSession", new closeSession());
      processMap_.put("addItem", new addItem());
      processMap_.put("updateItem", new updateItem());
      processMap_.put("addWarehouse", new addWarehouse());
      processMap_.put("isActive", new isActive());
      processMap_.put("updateInventory", new updateInventory());
      processMap_.put("retireWarehouse", new retireWarehouse());
      processMap_.put("startItemOn", new startItemOn());
      processMap_.put("retireItemOn", new retireItemOn());
      processMap_.put("changeItemStatus", new changeItemStatus());
      processMap_.put("getItem", new getItem());
      processMap_.put("getItemsByCatalogId", new getItemsByCatalogId());
      processMap_.put("getAllItems", new getAllItems());
      processMap_.put("getAllItemsByStatus", new getAllItemsByStatus());
      processMap_.put("getItemInventory", new getItemInventory());
      processMap_.put("getItemInventoryByItemId", new getItemInventoryByItemId());
      processMap_.put("getItemAvailibilityAtWarehouse", new getItemAvailibilityAtWarehouse());
      processMap_.put("markItemAsContentComplete", new markItemAsContentComplete());
      processMap_.put("getItemAvailabilityAtLocation", new getItemAvailabilityAtLocation());
      processMap_.put("getAllWarehouses", new getAllWarehouses());
      processMap_.put("getWarehouse", new getWarehouse());
      processMap_.put("getAllWarehousesForItem", new getAllWarehousesForItem());
      processMap_.put("getAllItemsForWarehouse", new getAllItemsForWarehouse());
      processMap_.put("reserveItemInWarehouse", new reserveItemInWarehouse());
      processMap_.put("reduceReservationCount", new reduceReservationCount());
      processMap_.put("getBestSellers", new getBestSellers());
      processMap_.put("getBestSellersCatalogIds", new getBestSellersCatalogIds());
      processMap_.put("getBestSellersCount", new getBestSellersCount());
      processMap_.put("getBestDeals", new getBestDeals());
      processMap_.put("getBestDealsCatalogIds", new getBestDealsCatalogIds());
      processMap_.put("getBestDealsCount", new getBestDealsCount());
      processMap_.put("getLatestArrivals", new getLatestArrivals());
      processMap_.put("getLatestArrivalsCatalogIds", new getLatestArrivalsCatalogIds());
      processMap_.put("getLatestArrivalsCount", new getLatestArrivalsCount());
      processMap_.put("putCategoryObject", new putCategoryObject());
      processMap_.put("getCategoryObject", new getCategoryObject());
    }

    protected static interface ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
    }

    private Iface iface_;
    protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();

    public boolean process(TProtocol iprot, TProtocol oprot) throws TException
    {
      TMessage msg = iprot.readMessageBegin();
      ProcessFunction fn = processMap_.get(msg.name);
      if (fn == null) {
        TProtocolUtil.skip(iprot, TType.STRUCT);
        iprot.readMessageEnd();
        TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
        oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
        x.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
        return true;
      }
      fn.process(msg.seqid, iprot, oprot);
      return true;
    }

    private class closeSession implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        closeSession_args args = new closeSession_args();
        args.read(iprot);
        iprot.readMessageEnd();
        closeSession_result result = new closeSession_result();
        iface_.closeSession();
        oprot.writeMessageBegin(new TMessage("closeSession", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class addItem implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        addItem_args args = new addItem_args();
        args.read(iprot);
        iprot.readMessageEnd();
        addItem_result result = new addItem_result();
        try {
          result.success = iface_.addItem(args.item);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing addItem", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing addItem");
          oprot.writeMessageBegin(new TMessage("addItem", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("addItem", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class updateItem implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        updateItem_args args = new updateItem_args();
        args.read(iprot);
        iprot.readMessageEnd();
        updateItem_result result = new updateItem_result();
        try {
          result.success = iface_.updateItem(args.item);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing updateItem", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing updateItem");
          oprot.writeMessageBegin(new TMessage("updateItem", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("updateItem", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class addWarehouse implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        addWarehouse_args args = new addWarehouse_args();
        args.read(iprot);
        iprot.readMessageEnd();
        addWarehouse_result result = new addWarehouse_result();
        try {
          result.success = iface_.addWarehouse(args.warehouse);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing addWarehouse", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing addWarehouse");
          oprot.writeMessageBegin(new TMessage("addWarehouse", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("addWarehouse", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class isActive implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        isActive_args args = new isActive_args();
        args.read(iprot);
        iprot.readMessageEnd();
        isActive_result result = new isActive_result();
        try {
          result.success = iface_.isActive(args.itemId);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException isex) {
          result.isex = isex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing isActive", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing isActive");
          oprot.writeMessageBegin(new TMessage("isActive", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("isActive", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class updateInventory implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        updateInventory_args args = new updateInventory_args();
        args.read(iprot);
        iprot.readMessageEnd();
        updateInventory_result result = new updateInventory_result();
        try {
          iface_.updateInventory(args.warehouse_id, args.timestamp, args.availability);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing updateInventory", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing updateInventory");
          oprot.writeMessageBegin(new TMessage("updateInventory", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("updateInventory", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class retireWarehouse implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        retireWarehouse_args args = new retireWarehouse_args();
        args.read(iprot);
        iprot.readMessageEnd();
        retireWarehouse_result result = new retireWarehouse_result();
        try {
          iface_.retireWarehouse(args.warehouse_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing retireWarehouse", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing retireWarehouse");
          oprot.writeMessageBegin(new TMessage("retireWarehouse", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("retireWarehouse", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class startItemOn implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        startItemOn_args args = new startItemOn_args();
        args.read(iprot);
        iprot.readMessageEnd();
        startItemOn_result result = new startItemOn_result();
        try {
          iface_.startItemOn(args.item_id, args.timestamp);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing startItemOn", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing startItemOn");
          oprot.writeMessageBegin(new TMessage("startItemOn", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("startItemOn", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class retireItemOn implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        retireItemOn_args args = new retireItemOn_args();
        args.read(iprot);
        iprot.readMessageEnd();
        retireItemOn_result result = new retireItemOn_result();
        try {
          iface_.retireItemOn(args.item_id, args.timestamp);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing retireItemOn", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing retireItemOn");
          oprot.writeMessageBegin(new TMessage("retireItemOn", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("retireItemOn", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class changeItemStatus implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        changeItemStatus_args args = new changeItemStatus_args();
        args.read(iprot);
        iprot.readMessageEnd();
        changeItemStatus_result result = new changeItemStatus_result();
        try {
          iface_.changeItemStatus(args.item_id, args.timestamp, args.newstatus);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing changeItemStatus", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing changeItemStatus");
          oprot.writeMessageBegin(new TMessage("changeItemStatus", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("changeItemStatus", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getItem implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getItem_args args = new getItem_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getItem_result result = new getItem_result();
        try {
          result.success = iface_.getItem(args.item_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getItem", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getItem");
          oprot.writeMessageBegin(new TMessage("getItem", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getItem", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getItemsByCatalogId implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getItemsByCatalogId_args args = new getItemsByCatalogId_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getItemsByCatalogId_result result = new getItemsByCatalogId_result();
        try {
          result.success = iface_.getItemsByCatalogId(args.catalog_item_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getItemsByCatalogId", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getItemsByCatalogId");
          oprot.writeMessageBegin(new TMessage("getItemsByCatalogId", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getItemsByCatalogId", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getAllItems implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getAllItems_args args = new getAllItems_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getAllItems_result result = new getAllItems_result();
        try {
          result.success = iface_.getAllItems(args.isActive);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getAllItems", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getAllItems");
          oprot.writeMessageBegin(new TMessage("getAllItems", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getAllItems", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getAllItemsByStatus implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getAllItemsByStatus_args args = new getAllItemsByStatus_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getAllItemsByStatus_result result = new getAllItemsByStatus_result();
        try {
          result.success = iface_.getAllItemsByStatus(args.itemStatus);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getAllItemsByStatus", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getAllItemsByStatus");
          oprot.writeMessageBegin(new TMessage("getAllItemsByStatus", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getAllItemsByStatus", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getItemInventory implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getItemInventory_args args = new getItemInventory_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getItemInventory_result result = new getItemInventory_result();
        try {
          result.success = iface_.getItemInventory(args.item_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getItemInventory", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getItemInventory");
          oprot.writeMessageBegin(new TMessage("getItemInventory", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getItemInventory", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getItemInventoryByItemId implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getItemInventoryByItemId_args args = new getItemInventoryByItemId_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getItemInventoryByItemId_result result = new getItemInventoryByItemId_result();
        try {
          result.success = iface_.getItemInventoryByItemId(args.item_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getItemInventoryByItemId", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getItemInventoryByItemId");
          oprot.writeMessageBegin(new TMessage("getItemInventoryByItemId", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getItemInventoryByItemId", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getItemAvailibilityAtWarehouse implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getItemAvailibilityAtWarehouse_args args = new getItemAvailibilityAtWarehouse_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getItemAvailibilityAtWarehouse_result result = new getItemAvailibilityAtWarehouse_result();
        try {
          result.success = iface_.getItemAvailibilityAtWarehouse(args.warehouse_id, args.item_id);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getItemAvailibilityAtWarehouse", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getItemAvailibilityAtWarehouse");
          oprot.writeMessageBegin(new TMessage("getItemAvailibilityAtWarehouse", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getItemAvailibilityAtWarehouse", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class markItemAsContentComplete implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        markItemAsContentComplete_args args = new markItemAsContentComplete_args();
        args.read(iprot);
        iprot.readMessageEnd();
        markItemAsContentComplete_result result = new markItemAsContentComplete_result();
        try {
          result.success = iface_.markItemAsContentComplete(args.entityId);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing markItemAsContentComplete", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing markItemAsContentComplete");
          oprot.writeMessageBegin(new TMessage("markItemAsContentComplete", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("markItemAsContentComplete", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getItemAvailabilityAtLocation implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getItemAvailabilityAtLocation_args args = new getItemAvailabilityAtLocation_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getItemAvailabilityAtLocation_result result = new getItemAvailabilityAtLocation_result();
        try {
          result.success = iface_.getItemAvailabilityAtLocation(args.warehouse_loc, args.item_id);
        } catch (InventoryServiceException isex) {
          result.isex = isex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getItemAvailabilityAtLocation", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getItemAvailabilityAtLocation");
          oprot.writeMessageBegin(new TMessage("getItemAvailabilityAtLocation", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getItemAvailabilityAtLocation", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getAllWarehouses implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getAllWarehouses_args args = new getAllWarehouses_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getAllWarehouses_result result = new getAllWarehouses_result();
        try {
          result.success = iface_.getAllWarehouses(args.isActive);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getAllWarehouses", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getAllWarehouses");
          oprot.writeMessageBegin(new TMessage("getAllWarehouses", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getAllWarehouses", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getWarehouse implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getWarehouse_args args = new getWarehouse_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getWarehouse_result result = new getWarehouse_result();
        try {
          result.success = iface_.getWarehouse(args.warehouse_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getWarehouse", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getWarehouse");
          oprot.writeMessageBegin(new TMessage("getWarehouse", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getWarehouse", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getAllWarehousesForItem implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getAllWarehousesForItem_args args = new getAllWarehousesForItem_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getAllWarehousesForItem_result result = new getAllWarehousesForItem_result();
        try {
          result.success = iface_.getAllWarehousesForItem(args.item_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getAllWarehousesForItem", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getAllWarehousesForItem");
          oprot.writeMessageBegin(new TMessage("getAllWarehousesForItem", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getAllWarehousesForItem", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getAllItemsForWarehouse implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getAllItemsForWarehouse_args args = new getAllItemsForWarehouse_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getAllItemsForWarehouse_result result = new getAllItemsForWarehouse_result();
        try {
          result.success = iface_.getAllItemsForWarehouse(args.warehouse_id);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getAllItemsForWarehouse", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getAllItemsForWarehouse");
          oprot.writeMessageBegin(new TMessage("getAllItemsForWarehouse", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getAllItemsForWarehouse", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class reserveItemInWarehouse implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        reserveItemInWarehouse_args args = new reserveItemInWarehouse_args();
        args.read(iprot);
        iprot.readMessageEnd();
        reserveItemInWarehouse_result result = new reserveItemInWarehouse_result();
        try {
          result.success = iface_.reserveItemInWarehouse(args.itemId, args.warehouseId, args.quantity);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing reserveItemInWarehouse", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing reserveItemInWarehouse");
          oprot.writeMessageBegin(new TMessage("reserveItemInWarehouse", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("reserveItemInWarehouse", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class reduceReservationCount implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        reduceReservationCount_args args = new reduceReservationCount_args();
        args.read(iprot);
        iprot.readMessageEnd();
        reduceReservationCount_result result = new reduceReservationCount_result();
        try {
          result.success = iface_.reduceReservationCount(args.itemId, args.warehouseId, args.quantity);
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing reduceReservationCount", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing reduceReservationCount");
          oprot.writeMessageBegin(new TMessage("reduceReservationCount", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("reduceReservationCount", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getBestSellers implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getBestSellers_args args = new getBestSellers_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getBestSellers_result result = new getBestSellers_result();
        try {
          result.success = iface_.getBestSellers();
        } catch (InventoryServiceException isex) {
          result.isex = isex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getBestSellers", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getBestSellers");
          oprot.writeMessageBegin(new TMessage("getBestSellers", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getBestSellers", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getBestSellersCatalogIds implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getBestSellersCatalogIds_args args = new getBestSellersCatalogIds_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getBestSellersCatalogIds_result result = new getBestSellersCatalogIds_result();
        try {
          result.success = iface_.getBestSellersCatalogIds(args.beginIndex, args.totalItems, args.category);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getBestSellersCatalogIds", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getBestSellersCatalogIds");
          oprot.writeMessageBegin(new TMessage("getBestSellersCatalogIds", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getBestSellersCatalogIds", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getBestSellersCount implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getBestSellersCount_args args = new getBestSellersCount_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getBestSellersCount_result result = new getBestSellersCount_result();
        try {
          result.success = iface_.getBestSellersCount();
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getBestSellersCount", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getBestSellersCount");
          oprot.writeMessageBegin(new TMessage("getBestSellersCount", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getBestSellersCount", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getBestDeals implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getBestDeals_args args = new getBestDeals_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getBestDeals_result result = new getBestDeals_result();
        try {
          result.success = iface_.getBestDeals();
        } catch (InventoryServiceException isex) {
          result.isex = isex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getBestDeals", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getBestDeals");
          oprot.writeMessageBegin(new TMessage("getBestDeals", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getBestDeals", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getBestDealsCatalogIds implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getBestDealsCatalogIds_args args = new getBestDealsCatalogIds_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getBestDealsCatalogIds_result result = new getBestDealsCatalogIds_result();
        try {
          result.success = iface_.getBestDealsCatalogIds(args.beginIndex, args.totalItems, args.category);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getBestDealsCatalogIds", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getBestDealsCatalogIds");
          oprot.writeMessageBegin(new TMessage("getBestDealsCatalogIds", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getBestDealsCatalogIds", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getBestDealsCount implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getBestDealsCount_args args = new getBestDealsCount_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getBestDealsCount_result result = new getBestDealsCount_result();
        try {
          result.success = iface_.getBestDealsCount();
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getBestDealsCount", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getBestDealsCount");
          oprot.writeMessageBegin(new TMessage("getBestDealsCount", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getBestDealsCount", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getLatestArrivals implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getLatestArrivals_args args = new getLatestArrivals_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getLatestArrivals_result result = new getLatestArrivals_result();
        try {
          result.success = iface_.getLatestArrivals();
        } catch (InventoryServiceException isex) {
          result.isex = isex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getLatestArrivals", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getLatestArrivals");
          oprot.writeMessageBegin(new TMessage("getLatestArrivals", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getLatestArrivals", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getLatestArrivalsCatalogIds implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getLatestArrivalsCatalogIds_args args = new getLatestArrivalsCatalogIds_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getLatestArrivalsCatalogIds_result result = new getLatestArrivalsCatalogIds_result();
        try {
          result.success = iface_.getLatestArrivalsCatalogIds(args.beginIndex, args.totalItems, args.category);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getLatestArrivalsCatalogIds", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getLatestArrivalsCatalogIds");
          oprot.writeMessageBegin(new TMessage("getLatestArrivalsCatalogIds", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getLatestArrivalsCatalogIds", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getLatestArrivalsCount implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getLatestArrivalsCount_args args = new getLatestArrivalsCount_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getLatestArrivalsCount_result result = new getLatestArrivalsCount_result();
        try {
          result.success = iface_.getLatestArrivalsCount();
          result.setSuccessIsSet(true);
        } catch (InventoryServiceException cex) {
          result.cex = cex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getLatestArrivalsCount", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getLatestArrivalsCount");
          oprot.writeMessageBegin(new TMessage("getLatestArrivalsCount", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getLatestArrivalsCount", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class putCategoryObject implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        putCategoryObject_args args = new putCategoryObject_args();
        args.read(iprot);
        iprot.readMessageEnd();
        putCategoryObject_result result = new putCategoryObject_result();
        result.success = iface_.putCategoryObject(args.object);
        result.setSuccessIsSet(true);
        oprot.writeMessageBegin(new TMessage("putCategoryObject", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getCategoryObject implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getCategoryObject_args args = new getCategoryObject_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getCategoryObject_result result = new getCategoryObject_result();
        result.success = iface_.getCategoryObject();
        oprot.writeMessageBegin(new TMessage("getCategoryObject", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

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

    public closeSession_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public closeSession_args(closeSession_args other) {
    }

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 closeSession_args)
        return this.equals((closeSession_args)that);
      return false;
    }

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

      return true;
    }

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

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

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

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append(")");
      return sb.toString();
    }

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

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

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

    public closeSession_result() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public closeSession_result(closeSession_result other) {
    }

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 closeSession_result)
        return this.equals((closeSession_result)that);
      return false;
    }

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

      return true;
    }

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

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

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

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_FIELD_DESC = new TField("item", TType.STRUCT, (short)1);

    private Item item;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM((short)1, "item");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM, new FieldMetaData("item", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, Item.class)));
    }});

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

    public addItem_args() {
    }

    public addItem_args(
      Item item)
    {
      this();
      this.item = item;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addItem_args(addItem_args other) {
      if (other.isSetItem()) {
        this.item = new Item(other.item);
      }
    }

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

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

    public Item getItem() {
      return this.item;
    }

    public addItem_args setItem(Item item) {
      this.item = item;
      return this;
    }

    public void unsetItem() {
      this.item = null;
    }

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

    public void setItemIsSet(boolean value) {
      if (!value) {
        this.item = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM:
        if (value == null) {
          unsetItem();
        } else {
          setItem((Item)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM:
        return getItem();

      }
      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 ITEM:
        return isSetItem();
      }
      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 addItem_args)
        return this.equals((addItem_args)that);
      return false;
    }

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

      boolean this_present_item = true && this.isSetItem();
      boolean that_present_item = true && that.isSetItem();
      if (this_present_item || that_present_item) {
        if (!(this_present_item && that_present_item))
          return false;
        if (!this.item.equals(that.item))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case ITEM:
              if (field.type == TType.STRUCT) {
                this.item = new Item();
                this.item.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (this.item != null) {
        oprot.writeFieldBegin(ITEM_FIELD_DESC);
        this.item.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item:");
      if (this.item == null) {
        sb.append("null");
      } else {
        sb.append(this.item);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public addItem_result() {
    }

    public addItem_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addItem_result(addItem_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public long getSuccess() {
      return this.success;
    }

    public addItem_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public addItem_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 addItem_result)
        return this.equals((addItem_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_FIELD_DESC = new TField("item", TType.STRUCT, (short)1);

    private Item item;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM((short)1, "item");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM, new FieldMetaData("item", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, Item.class)));
    }});

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

    public updateItem_args() {
    }

    public updateItem_args(
      Item item)
    {
      this();
      this.item = item;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public updateItem_args(updateItem_args other) {
      if (other.isSetItem()) {
        this.item = new Item(other.item);
      }
    }

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

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

    public Item getItem() {
      return this.item;
    }

    public updateItem_args setItem(Item item) {
      this.item = item;
      return this;
    }

    public void unsetItem() {
      this.item = null;
    }

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

    public void setItemIsSet(boolean value) {
      if (!value) {
        this.item = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM:
        if (value == null) {
          unsetItem();
        } else {
          setItem((Item)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM:
        return getItem();

      }
      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 ITEM:
        return isSetItem();
      }
      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 updateItem_args)
        return this.equals((updateItem_args)that);
      return false;
    }

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

      boolean this_present_item = true && this.isSetItem();
      boolean that_present_item = true && that.isSetItem();
      if (this_present_item || that_present_item) {
        if (!(this_present_item && that_present_item))
          return false;
        if (!this.item.equals(that.item))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case ITEM:
              if (field.type == TType.STRUCT) {
                this.item = new Item();
                this.item.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (this.item != null) {
        oprot.writeFieldBegin(ITEM_FIELD_DESC);
        this.item.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item:");
      if (this.item == null) {
        sb.append("null");
      } else {
        sb.append(this.item);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public updateItem_result() {
    }

    public updateItem_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public updateItem_result(updateItem_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public long getSuccess() {
      return this.success;
    }

    public updateItem_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public updateItem_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 updateItem_result)
        return this.equals((updateItem_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_FIELD_DESC = new TField("warehouse", TType.STRUCT, (short)1);

    private Warehouse warehouse;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE((short)1, "warehouse");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE, new FieldMetaData("warehouse", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, Warehouse.class)));
    }});

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

    public addWarehouse_args() {
    }

    public addWarehouse_args(
      Warehouse warehouse)
    {
      this();
      this.warehouse = warehouse;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addWarehouse_args(addWarehouse_args other) {
      if (other.isSetWarehouse()) {
        this.warehouse = new Warehouse(other.warehouse);
      }
    }

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

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

    public Warehouse getWarehouse() {
      return this.warehouse;
    }

    public addWarehouse_args setWarehouse(Warehouse warehouse) {
      this.warehouse = warehouse;
      return this;
    }

    public void unsetWarehouse() {
      this.warehouse = null;
    }

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

    public void setWarehouseIsSet(boolean value) {
      if (!value) {
        this.warehouse = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE:
        if (value == null) {
          unsetWarehouse();
        } else {
          setWarehouse((Warehouse)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE:
        return getWarehouse();

      }
      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 WAREHOUSE:
        return isSetWarehouse();
      }
      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 addWarehouse_args)
        return this.equals((addWarehouse_args)that);
      return false;
    }

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

      boolean this_present_warehouse = true && this.isSetWarehouse();
      boolean that_present_warehouse = true && that.isSetWarehouse();
      if (this_present_warehouse || that_present_warehouse) {
        if (!(this_present_warehouse && that_present_warehouse))
          return false;
        if (!this.warehouse.equals(that.warehouse))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetWarehouse()).compareTo(isSetWarehouse());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouse, typedOther.warehouse);
      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 WAREHOUSE:
              if (field.type == TType.STRUCT) {
                this.warehouse = new Warehouse();
                this.warehouse.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (this.warehouse != null) {
        oprot.writeFieldBegin(WAREHOUSE_FIELD_DESC);
        this.warehouse.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse:");
      if (this.warehouse == null) {
        sb.append("null");
      } else {
        sb.append(this.warehouse);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public addWarehouse_result() {
    }

    public addWarehouse_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addWarehouse_result(addWarehouse_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public long getSuccess() {
      return this.success;
    }

    public addWarehouse_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public addWarehouse_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 addWarehouse_result)
        return this.equals((addWarehouse_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)1);

    private long itemId;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "itemId");

      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 __ITEMID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public isActive_args() {
    }

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

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

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

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

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

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

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

    /** Returns true if field itemId is set (has been asigned 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM_ID:
        if (value == null) {
          unsetItemId();
        } else {
          setItemId((Long)value);
        }
        break;

      }
    }

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

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

      }
      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 ITEM_ID:
        return isSetItemId();
      }
      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 isActive_args)
        return this.equals((isActive_args)that);
      return false;
    }

    public boolean equals(isActive_args 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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.itemId = iprot.readI64();
                setItemIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.itemId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("itemId:");
      sb.append(this.itemId);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);
    private static final TField ISEX_FIELD_DESC = new TField("isex", TType.STRUCT, (short)1);

    private boolean success;
    private InventoryServiceException isex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ISEX((short)1, "isex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
      put(_Fields.ISEX, new FieldMetaData("isex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public isActive_result() {
    }

    public isActive_result(
      boolean success,
      InventoryServiceException isex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.isex = isex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isActive_result(isActive_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetIsex()) {
        this.isex = new InventoryServiceException(other.isex);
      }
    }

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

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

    public boolean isSuccess() {
      return this.success;
    }

    public isActive_result setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getIsex() {
      return this.isex;
    }

    public isActive_result setIsex(InventoryServiceException isex) {
      this.isex = isex;
      return this;
    }

    public void unsetIsex() {
      this.isex = null;
    }

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

    public void setIsexIsSet(boolean value) {
      if (!value) {
        this.isex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      case ISEX:
        if (value == null) {
          unsetIsex();
        } else {
          setIsex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Boolean(isSuccess());

      case ISEX:
        return getIsex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case ISEX:
        return isSetIsex();
      }
      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 isActive_result)
        return this.equals((isActive_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_isex = true && this.isSetIsex();
      boolean that_present_isex = true && that.isSetIsex();
      if (this_present_isex || that_present_isex) {
        if (!(this_present_isex && that_present_isex))
          return false;
        if (!this.isex.equals(that.isex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetIsex()).compareTo(isSetIsex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(isex, typedOther.isex);
      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 SUCCESS:
              if (field.type == TType.BOOL) {
                this.success = iprot.readBool();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ISEX:
              if (field.type == TType.STRUCT) {
                this.isex = new InventoryServiceException();
                this.isex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetIsex()) {
        oprot.writeFieldBegin(ISEX_FIELD_DESC);
        this.isex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("isex:");
      if (this.isex == null) {
        sb.append("null");
      } else {
        sb.append(this.isex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);
    private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.STRING, (short)2);
    private static final TField AVAILABILITY_FIELD_DESC = new TField("availability", TType.MAP, (short)3);

    private long warehouse_id;
    private String timestamp;
    private Map<String,Long> availability;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE_ID((short)1, "warehouse_id"),
      TIMESTAMP((short)2, "timestamp"),
      AVAILABILITY((short)3, "availability");

      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 __WAREHOUSE_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
      put(_Fields.AVAILABILITY, new FieldMetaData("availability", TFieldRequirementType.DEFAULT, 
          new MapMetaData(TType.MAP, 
              new FieldValueMetaData(TType.STRING), 
              new FieldValueMetaData(TType.I64))));
    }});

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

    public updateInventory_args() {
    }

    public updateInventory_args(
      long warehouse_id,
      String timestamp,
      Map<String,Long> availability)
    {
      this();
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      this.timestamp = timestamp;
      this.availability = availability;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public updateInventory_args(updateInventory_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.warehouse_id = other.warehouse_id;
      if (other.isSetTimestamp()) {
        this.timestamp = other.timestamp;
      }
      if (other.isSetAvailability()) {
        Map<String,Long> __this__availability = new HashMap<String,Long>();
        for (Map.Entry<String, Long> other_element : other.availability.entrySet()) {

          String other_element_key = other_element.getKey();
          Long other_element_value = other_element.getValue();

          String __this__availability_copy_key = other_element_key;

          Long __this__availability_copy_value = other_element_value;

          __this__availability.put(__this__availability_copy_key, __this__availability_copy_value);
        }
        this.availability = __this__availability;
      }
    }

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

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

    public long getWarehouse_id() {
      return this.warehouse_id;
    }

    public updateInventory_args setWarehouse_id(long warehouse_id) {
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      return this;
    }

    public void unsetWarehouse_id() {
      __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
    }

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

    public void setWarehouse_idIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
    }

    public String getTimestamp() {
      return this.timestamp;
    }

    public updateInventory_args setTimestamp(String timestamp) {
      this.timestamp = timestamp;
      return this;
    }

    public void unsetTimestamp() {
      this.timestamp = null;
    }

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

    public void setTimestampIsSet(boolean value) {
      if (!value) {
        this.timestamp = null;
      }
    }

    public int getAvailabilitySize() {
      return (this.availability == null) ? 0 : this.availability.size();
    }

    public void putToAvailability(String key, long val) {
      if (this.availability == null) {
        this.availability = new HashMap<String,Long>();
      }
      this.availability.put(key, val);
    }

    public Map<String,Long> getAvailability() {
      return this.availability;
    }

    public updateInventory_args setAvailability(Map<String,Long> availability) {
      this.availability = availability;
      return this;
    }

    public void unsetAvailability() {
      this.availability = null;
    }

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

    public void setAvailabilityIsSet(boolean value) {
      if (!value) {
        this.availability = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouse_id();
        } else {
          setWarehouse_id((Long)value);
        }
        break;

      case TIMESTAMP:
        if (value == null) {
          unsetTimestamp();
        } else {
          setTimestamp((String)value);
        }
        break;

      case AVAILABILITY:
        if (value == null) {
          unsetAvailability();
        } else {
          setAvailability((Map<String,Long>)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE_ID:
        return new Long(getWarehouse_id());

      case TIMESTAMP:
        return getTimestamp();

      case AVAILABILITY:
        return getAvailability();

      }
      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 WAREHOUSE_ID:
        return isSetWarehouse_id();
      case TIMESTAMP:
        return isSetTimestamp();
      case AVAILABILITY:
        return isSetAvailability();
      }
      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 updateInventory_args)
        return this.equals((updateInventory_args)that);
      return false;
    }

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

      boolean this_present_warehouse_id = true;
      boolean that_present_warehouse_id = true;
      if (this_present_warehouse_id || that_present_warehouse_id) {
        if (!(this_present_warehouse_id && that_present_warehouse_id))
          return false;
        if (this.warehouse_id != that.warehouse_id)
          return false;
      }

      boolean this_present_timestamp = true && this.isSetTimestamp();
      boolean that_present_timestamp = true && that.isSetTimestamp();
      if (this_present_timestamp || that_present_timestamp) {
        if (!(this_present_timestamp && that_present_timestamp))
          return false;
        if (!this.timestamp.equals(that.timestamp))
          return false;
      }

      boolean this_present_availability = true && this.isSetAvailability();
      boolean that_present_availability = true && that.isSetAvailability();
      if (this_present_availability || that_present_availability) {
        if (!(this_present_availability && that_present_availability))
          return false;
        if (!this.availability.equals(that.availability))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouse_id = iprot.readI64();
                setWarehouse_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TIMESTAMP:
              if (field.type == TType.STRING) {
                this.timestamp = iprot.readString();
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case AVAILABILITY:
              if (field.type == TType.MAP) {
                {
                  TMap _map10 = iprot.readMapBegin();
                  this.availability = new HashMap<String,Long>(2*_map10.size);
                  for (int _i11 = 0; _i11 < _map10.size; ++_i11)
                  {
                    String _key12;
                    long _val13;
                    _key12 = iprot.readString();
                    _val13 = iprot.readI64();
                    this.availability.put(_key12, _val13);
                  }
                  iprot.readMapEnd();
                }
              } 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(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouse_id);
      oprot.writeFieldEnd();
      if (this.timestamp != null) {
        oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
        oprot.writeString(this.timestamp);
        oprot.writeFieldEnd();
      }
      if (this.availability != null) {
        oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
        {
          oprot.writeMapBegin(new TMap(TType.STRING, TType.I64, this.availability.size()));
          for (Map.Entry<String, Long> _iter14 : this.availability.entrySet())
          {
            oprot.writeString(_iter14.getKey());
            oprot.writeI64(_iter14.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse_id:");
      sb.append(this.warehouse_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("timestamp:");
      if (this.timestamp == null) {
        sb.append("null");
      } else {
        sb.append(this.timestamp);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("availability:");
      if (this.availability == null) {
        sb.append("null");
      } else {
        sb.append(this.availability);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public updateInventory_result() {
    }

    public updateInventory_result(
      InventoryServiceException cex)
    {
      this();
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public updateInventory_result(updateInventory_result other) {
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public updateInventory_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CEX:
        return getCex();

      }
      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 CEX:
        return isSetCex();
      }
      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 updateInventory_result)
        return this.equals((updateInventory_result)that);
      return false;
    }

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

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);

    private long warehouse_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE_ID((short)1, "warehouse_id");

      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 __WAREHOUSE_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public retireWarehouse_args() {
    }

    public retireWarehouse_args(
      long warehouse_id)
    {
      this();
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public retireWarehouse_args(retireWarehouse_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.warehouse_id = other.warehouse_id;
    }

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

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

    public long getWarehouse_id() {
      return this.warehouse_id;
    }

    public retireWarehouse_args setWarehouse_id(long warehouse_id) {
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      return this;
    }

    public void unsetWarehouse_id() {
      __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
    }

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

    public void setWarehouse_idIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouse_id();
        } else {
          setWarehouse_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE_ID:
        return new Long(getWarehouse_id());

      }
      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 WAREHOUSE_ID:
        return isSetWarehouse_id();
      }
      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 retireWarehouse_args)
        return this.equals((retireWarehouse_args)that);
      return false;
    }

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

      boolean this_present_warehouse_id = true;
      boolean that_present_warehouse_id = true;
      if (this_present_warehouse_id || that_present_warehouse_id) {
        if (!(this_present_warehouse_id && that_present_warehouse_id))
          return false;
        if (this.warehouse_id != that.warehouse_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
      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 WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouse_id = iprot.readI64();
                setWarehouse_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouse_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse_id:");
      sb.append(this.warehouse_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public retireWarehouse_result() {
    }

    public retireWarehouse_result(
      InventoryServiceException cex)
    {
      this();
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public retireWarehouse_result(retireWarehouse_result other) {
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public retireWarehouse_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CEX:
        return getCex();

      }
      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 CEX:
        return isSetCex();
      }
      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 retireWarehouse_result)
        return this.equals((retireWarehouse_result)that);
      return false;
    }

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

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);
    private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)2);

    private long item_id;
    private long timestamp;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id"),
      TIMESTAMP((short)2, "timestamp");

      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 __ITEM_ID_ISSET_ID = 0;
    private static final int __TIMESTAMP_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public startItemOn_args() {
    }

    public startItemOn_args(
      long item_id,
      long timestamp)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
      this.timestamp = timestamp;
      setTimestampIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public startItemOn_args(startItemOn_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
      this.timestamp = other.timestamp;
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public startItemOn_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

    public long getTimestamp() {
      return this.timestamp;
    }

    public startItemOn_args setTimestamp(long timestamp) {
      this.timestamp = timestamp;
      setTimestampIsSet(true);
      return this;
    }

    public void unsetTimestamp() {
      __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
    }

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

    public void setTimestampIsSet(boolean value) {
      __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
    }

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

      case TIMESTAMP:
        if (value == null) {
          unsetTimestamp();
        } else {
          setTimestamp((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      case TIMESTAMP:
        return new Long(getTimestamp());

      }
      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 ITEM_ID:
        return isSetItem_id();
      case TIMESTAMP:
        return isSetTimestamp();
      }
      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 startItemOn_args)
        return this.equals((startItemOn_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      boolean this_present_timestamp = true;
      boolean that_present_timestamp = true;
      if (this_present_timestamp || that_present_timestamp) {
        if (!(this_present_timestamp && that_present_timestamp))
          return false;
        if (this.timestamp != that.timestamp)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TIMESTAMP:
              if (field.type == TType.I64) {
                this.timestamp = iprot.readI64();
                setTimestampIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
      oprot.writeI64(this.timestamp);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("timestamp:");
      sb.append(this.timestamp);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public startItemOn_result() {
    }

    public startItemOn_result(
      InventoryServiceException cex)
    {
      this();
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public startItemOn_result(startItemOn_result other) {
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public startItemOn_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CEX:
        return getCex();

      }
      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 CEX:
        return isSetCex();
      }
      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 startItemOn_result)
        return this.equals((startItemOn_result)that);
      return false;
    }

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

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);
    private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)2);

    private long item_id;
    private long timestamp;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id"),
      TIMESTAMP((short)2, "timestamp");

      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 __ITEM_ID_ISSET_ID = 0;
    private static final int __TIMESTAMP_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public retireItemOn_args() {
    }

    public retireItemOn_args(
      long item_id,
      long timestamp)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
      this.timestamp = timestamp;
      setTimestampIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public retireItemOn_args(retireItemOn_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
      this.timestamp = other.timestamp;
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public retireItemOn_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

    public long getTimestamp() {
      return this.timestamp;
    }

    public retireItemOn_args setTimestamp(long timestamp) {
      this.timestamp = timestamp;
      setTimestampIsSet(true);
      return this;
    }

    public void unsetTimestamp() {
      __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
    }

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

    public void setTimestampIsSet(boolean value) {
      __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
    }

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

      case TIMESTAMP:
        if (value == null) {
          unsetTimestamp();
        } else {
          setTimestamp((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      case TIMESTAMP:
        return new Long(getTimestamp());

      }
      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 ITEM_ID:
        return isSetItem_id();
      case TIMESTAMP:
        return isSetTimestamp();
      }
      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 retireItemOn_args)
        return this.equals((retireItemOn_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      boolean this_present_timestamp = true;
      boolean that_present_timestamp = true;
      if (this_present_timestamp || that_present_timestamp) {
        if (!(this_present_timestamp && that_present_timestamp))
          return false;
        if (this.timestamp != that.timestamp)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TIMESTAMP:
              if (field.type == TType.I64) {
                this.timestamp = iprot.readI64();
                setTimestampIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
      oprot.writeI64(this.timestamp);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("timestamp:");
      sb.append(this.timestamp);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public retireItemOn_result() {
    }

    public retireItemOn_result(
      InventoryServiceException cex)
    {
      this();
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public retireItemOn_result(retireItemOn_result other) {
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public retireItemOn_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CEX:
        return getCex();

      }
      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 CEX:
        return isSetCex();
      }
      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 retireItemOn_result)
        return this.equals((retireItemOn_result)that);
      return false;
    }

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

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);
    private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)2);
    private static final TField NEWSTATUS_FIELD_DESC = new TField("newstatus", TType.I32, (short)3);

    private long item_id;
    private long timestamp;
    private status newstatus;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id"),
      TIMESTAMP((short)2, "timestamp"),
      /**
       * 
       * @see status
       */
      NEWSTATUS((short)3, "newstatus");

      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 __ITEM_ID_ISSET_ID = 0;
    private static final int __TIMESTAMP_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.NEWSTATUS, new FieldMetaData("newstatus", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, status.class)));
    }});

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

    public changeItemStatus_args() {
    }

    public changeItemStatus_args(
      long item_id,
      long timestamp,
      status newstatus)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
      this.timestamp = timestamp;
      setTimestampIsSet(true);
      this.newstatus = newstatus;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changeItemStatus_args(changeItemStatus_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
      this.timestamp = other.timestamp;
      if (other.isSetNewstatus()) {
        this.newstatus = other.newstatus;
      }
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public changeItemStatus_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

    public long getTimestamp() {
      return this.timestamp;
    }

    public changeItemStatus_args setTimestamp(long timestamp) {
      this.timestamp = timestamp;
      setTimestampIsSet(true);
      return this;
    }

    public void unsetTimestamp() {
      __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
    }

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

    public void setTimestampIsSet(boolean value) {
      __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
    }

    /**
     * 
     * @see status
     */
    public status getNewstatus() {
      return this.newstatus;
    }

    /**
     * 
     * @see status
     */
    public changeItemStatus_args setNewstatus(status newstatus) {
      this.newstatus = newstatus;
      return this;
    }

    public void unsetNewstatus() {
      this.newstatus = null;
    }

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

    public void setNewstatusIsSet(boolean value) {
      if (!value) {
        this.newstatus = null;
      }
    }

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

      case TIMESTAMP:
        if (value == null) {
          unsetTimestamp();
        } else {
          setTimestamp((Long)value);
        }
        break;

      case NEWSTATUS:
        if (value == null) {
          unsetNewstatus();
        } else {
          setNewstatus((status)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      case TIMESTAMP:
        return new Long(getTimestamp());

      case NEWSTATUS:
        return getNewstatus();

      }
      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 ITEM_ID:
        return isSetItem_id();
      case TIMESTAMP:
        return isSetTimestamp();
      case NEWSTATUS:
        return isSetNewstatus();
      }
      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 changeItemStatus_args)
        return this.equals((changeItemStatus_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      boolean this_present_timestamp = true;
      boolean that_present_timestamp = true;
      if (this_present_timestamp || that_present_timestamp) {
        if (!(this_present_timestamp && that_present_timestamp))
          return false;
        if (this.timestamp != that.timestamp)
          return false;
      }

      boolean this_present_newstatus = true && this.isSetNewstatus();
      boolean that_present_newstatus = true && that.isSetNewstatus();
      if (this_present_newstatus || that_present_newstatus) {
        if (!(this_present_newstatus && that_present_newstatus))
          return false;
        if (!this.newstatus.equals(that.newstatus))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetNewstatus()).compareTo(isSetNewstatus());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(newstatus, typedOther.newstatus);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TIMESTAMP:
              if (field.type == TType.I64) {
                this.timestamp = iprot.readI64();
                setTimestampIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case NEWSTATUS:
              if (field.type == TType.I32) {
                this.newstatus = status.findByValue(iprot.readI32());
              } 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(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
      oprot.writeI64(this.timestamp);
      oprot.writeFieldEnd();
      if (this.newstatus != null) {
        oprot.writeFieldBegin(NEWSTATUS_FIELD_DESC);
        oprot.writeI32(this.newstatus.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("timestamp:");
      sb.append(this.timestamp);
      first = false;
      if (!first) sb.append(", ");
      sb.append("newstatus:");
      if (this.newstatus == null) {
        sb.append("null");
      } else {
        String newstatus_name = newstatus.name();
        if (newstatus_name != null) {
          sb.append(newstatus_name);
          sb.append(" (");
        }
        sb.append(this.newstatus);
        if (newstatus_name != null) {
          sb.append(")");
        }
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public changeItemStatus_result() {
    }

    public changeItemStatus_result(
      InventoryServiceException cex)
    {
      this();
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changeItemStatus_result(changeItemStatus_result other) {
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public changeItemStatus_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CEX:
        return getCex();

      }
      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 CEX:
        return isSetCex();
      }
      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 changeItemStatus_result)
        return this.equals((changeItemStatus_result)that);
      return false;
    }

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

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);

    private long item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id");

      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 __ITEM_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getItem_args() {
    }

    public getItem_args(
      long item_id)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItem_args(getItem_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public getItem_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      }
      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 ITEM_ID:
        return isSetItem_id();
      }
      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 getItem_args)
        return this.equals((getItem_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private Item success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, Item.class)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getItem_result() {
    }

    public getItem_result(
      Item success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItem_result(getItem_result other) {
      if (other.isSetSuccess()) {
        this.success = new Item(other.success);
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public Item getSuccess() {
      return this.success;
    }

    public getItem_result setSuccess(Item success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getItem_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Item)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getItem_result)
        return this.equals((getItem_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.STRUCT) {
                this.success = new Item();
                this.success.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CATALOG_ITEM_ID_FIELD_DESC = new TField("catalog_item_id", TType.I64, (short)1);

    private long catalog_item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CATALOG_ITEM_ID((short)1, "catalog_item_id");

      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 __CATALOG_ITEM_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CATALOG_ITEM_ID, new FieldMetaData("catalog_item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getItemsByCatalogId_args() {
    }

    public getItemsByCatalogId_args(
      long catalog_item_id)
    {
      this();
      this.catalog_item_id = catalog_item_id;
      setCatalog_item_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemsByCatalogId_args(getItemsByCatalogId_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.catalog_item_id = other.catalog_item_id;
    }

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

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

    public long getCatalog_item_id() {
      return this.catalog_item_id;
    }

    public getItemsByCatalogId_args setCatalog_item_id(long catalog_item_id) {
      this.catalog_item_id = catalog_item_id;
      setCatalog_item_idIsSet(true);
      return this;
    }

    public void unsetCatalog_item_id() {
      __isset_bit_vector.clear(__CATALOG_ITEM_ID_ISSET_ID);
    }

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

    public void setCatalog_item_idIsSet(boolean value) {
      __isset_bit_vector.set(__CATALOG_ITEM_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CATALOG_ITEM_ID:
        if (value == null) {
          unsetCatalog_item_id();
        } else {
          setCatalog_item_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CATALOG_ITEM_ID:
        return new Long(getCatalog_item_id());

      }
      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 CATALOG_ITEM_ID:
        return isSetCatalog_item_id();
      }
      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 getItemsByCatalogId_args)
        return this.equals((getItemsByCatalogId_args)that);
      return false;
    }

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

      boolean this_present_catalog_item_id = true;
      boolean that_present_catalog_item_id = true;
      if (this_present_catalog_item_id || that_present_catalog_item_id) {
        if (!(this_present_catalog_item_id && that_present_catalog_item_id))
          return false;
        if (this.catalog_item_id != that.catalog_item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCatalog_item_id()).compareTo(isSetCatalog_item_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(catalog_item_id, typedOther.catalog_item_id);
      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 CATALOG_ITEM_ID:
              if (field.type == TType.I64) {
                this.catalog_item_id = iprot.readI64();
                setCatalog_item_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(CATALOG_ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.catalog_item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("catalog_item_id:");
      sb.append(this.catalog_item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getItemsByCatalogId_result() {
    }

    public getItemsByCatalogId_result(
      List<Item> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemsByCatalogId_result(getItemsByCatalogId_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getItemsByCatalogId_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getItemsByCatalogId_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getItemsByCatalogId_result)
        return this.equals((getItemsByCatalogId_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list15 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list15.size);
                  for (int _i16 = 0; _i16 < _list15.size; ++_i16)
                  {
                    Item _elem17;
                    _elem17 = new Item();
                    _elem17.read(iprot);
                    this.success.add(_elem17);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter18 : this.success)
          {
            _iter18.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField IS_ACTIVE_FIELD_DESC = new TField("isActive", TType.BOOL, (short)1);

    private boolean isActive;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      IS_ACTIVE((short)1, "isActive");

      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 __ISACTIVE_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.IS_ACTIVE, new FieldMetaData("isActive", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
    }});

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

    public getAllItems_args() {
    }

    public getAllItems_args(
      boolean isActive)
    {
      this();
      this.isActive = isActive;
      setIsActiveIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllItems_args(getAllItems_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.isActive = other.isActive;
    }

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

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

    public boolean isIsActive() {
      return this.isActive;
    }

    public getAllItems_args setIsActive(boolean isActive) {
      this.isActive = isActive;
      setIsActiveIsSet(true);
      return this;
    }

    public void unsetIsActive() {
      __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
    }

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

    public void setIsActiveIsSet(boolean value) {
      __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case IS_ACTIVE:
        if (value == null) {
          unsetIsActive();
        } else {
          setIsActive((Boolean)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case IS_ACTIVE:
        return new Boolean(isIsActive());

      }
      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 IS_ACTIVE:
        return isSetIsActive();
      }
      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 getAllItems_args)
        return this.equals((getAllItems_args)that);
      return false;
    }

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

      boolean this_present_isActive = true;
      boolean that_present_isActive = true;
      if (this_present_isActive || that_present_isActive) {
        if (!(this_present_isActive && that_present_isActive))
          return false;
        if (this.isActive != that.isActive)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(isSetIsActive());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(isActive, typedOther.isActive);
      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 IS_ACTIVE:
              if (field.type == TType.BOOL) {
                this.isActive = iprot.readBool();
                setIsActiveIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(IS_ACTIVE_FIELD_DESC);
      oprot.writeBool(this.isActive);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("isActive:");
      sb.append(this.isActive);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getAllItems_result() {
    }

    public getAllItems_result(
      List<Item> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllItems_result(getAllItems_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getAllItems_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getAllItems_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getAllItems_result)
        return this.equals((getAllItems_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list19 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list19.size);
                  for (int _i20 = 0; _i20 < _list19.size; ++_i20)
                  {
                    Item _elem21;
                    _elem21 = new Item();
                    _elem21.read(iprot);
                    this.success.add(_elem21);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter22 : this.success)
          {
            _iter22.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_STATUS_FIELD_DESC = new TField("itemStatus", TType.I32, (short)1);

    private status itemStatus;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      /**
       * 
       * @see status
       */
      ITEM_STATUS((short)1, "itemStatus");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_STATUS, new FieldMetaData("itemStatus", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, status.class)));
    }});

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

    public getAllItemsByStatus_args() {
    }

    public getAllItemsByStatus_args(
      status itemStatus)
    {
      this();
      this.itemStatus = itemStatus;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllItemsByStatus_args(getAllItemsByStatus_args other) {
      if (other.isSetItemStatus()) {
        this.itemStatus = other.itemStatus;
      }
    }

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

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

    /**
     * 
     * @see status
     */
    public status getItemStatus() {
      return this.itemStatus;
    }

    /**
     * 
     * @see status
     */
    public getAllItemsByStatus_args setItemStatus(status itemStatus) {
      this.itemStatus = itemStatus;
      return this;
    }

    public void unsetItemStatus() {
      this.itemStatus = null;
    }

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

    public void setItemStatusIsSet(boolean value) {
      if (!value) {
        this.itemStatus = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM_STATUS:
        if (value == null) {
          unsetItemStatus();
        } else {
          setItemStatus((status)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_STATUS:
        return getItemStatus();

      }
      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 ITEM_STATUS:
        return isSetItemStatus();
      }
      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 getAllItemsByStatus_args)
        return this.equals((getAllItemsByStatus_args)that);
      return false;
    }

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

      boolean this_present_itemStatus = true && this.isSetItemStatus();
      boolean that_present_itemStatus = true && that.isSetItemStatus();
      if (this_present_itemStatus || that_present_itemStatus) {
        if (!(this_present_itemStatus && that_present_itemStatus))
          return false;
        if (!this.itemStatus.equals(that.itemStatus))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItemStatus()).compareTo(isSetItemStatus());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(itemStatus, typedOther.itemStatus);
      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 ITEM_STATUS:
              if (field.type == TType.I32) {
                this.itemStatus = status.findByValue(iprot.readI32());
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (this.itemStatus != null) {
        oprot.writeFieldBegin(ITEM_STATUS_FIELD_DESC);
        oprot.writeI32(this.itemStatus.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("itemStatus:");
      if (this.itemStatus == null) {
        sb.append("null");
      } else {
        String itemStatus_name = itemStatus.name();
        if (itemStatus_name != null) {
          sb.append(itemStatus_name);
          sb.append(" (");
        }
        sb.append(this.itemStatus);
        if (itemStatus_name != null) {
          sb.append(")");
        }
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getAllItemsByStatus_result() {
    }

    public getAllItemsByStatus_result(
      List<Item> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllItemsByStatus_result(getAllItemsByStatus_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getAllItemsByStatus_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getAllItemsByStatus_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getAllItemsByStatus_result)
        return this.equals((getAllItemsByStatus_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list23 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list23.size);
                  for (int _i24 = 0; _i24 < _list23.size; ++_i24)
                  {
                    Item _elem25;
                    _elem25 = new Item();
                    _elem25.read(iprot);
                    this.success.add(_elem25);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter26 : this.success)
          {
            _iter26.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);

    private long item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id");

      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 __ITEM_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getItemInventory_args() {
    }

    public getItemInventory_args(
      long item_id)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemInventory_args(getItemInventory_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public getItemInventory_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      }
      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 ITEM_ID:
        return isSetItem_id();
      }
      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 getItemInventory_args)
        return this.equals((getItemInventory_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private ItemInventory success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, ItemInventory.class)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getItemInventory_result() {
    }

    public getItemInventory_result(
      ItemInventory success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemInventory_result(getItemInventory_result other) {
      if (other.isSetSuccess()) {
        this.success = new ItemInventory(other.success);
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public ItemInventory getSuccess() {
      return this.success;
    }

    public getItemInventory_result setSuccess(ItemInventory success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getItemInventory_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((ItemInventory)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getItemInventory_result)
        return this.equals((getItemInventory_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.STRUCT) {
                this.success = new ItemInventory();
                this.success.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);

    private long item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id");

      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 __ITEM_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getItemInventoryByItemId_args() {
    }

    public getItemInventoryByItemId_args(
      long item_id)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemInventoryByItemId_args(getItemInventoryByItemId_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public getItemInventoryByItemId_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      }
      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 ITEM_ID:
        return isSetItem_id();
      }
      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 getItemInventoryByItemId_args)
        return this.equals((getItemInventoryByItemId_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private ItemInventory success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, ItemInventory.class)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getItemInventoryByItemId_result() {
    }

    public getItemInventoryByItemId_result(
      ItemInventory success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemInventoryByItemId_result(getItemInventoryByItemId_result other) {
      if (other.isSetSuccess()) {
        this.success = new ItemInventory(other.success);
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public ItemInventory getSuccess() {
      return this.success;
    }

    public getItemInventoryByItemId_result setSuccess(ItemInventory success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getItemInventoryByItemId_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((ItemInventory)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getItemInventoryByItemId_result)
        return this.equals((getItemInventoryByItemId_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.STRUCT) {
                this.success = new ItemInventory();
                this.success.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);
    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)2);

    private long warehouse_id;
    private long item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE_ID((short)1, "warehouse_id"),
      ITEM_ID((short)2, "item_id");

      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 __WAREHOUSE_ID_ISSET_ID = 0;
    private static final int __ITEM_ID_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getItemAvailibilityAtWarehouse_args() {
    }

    public getItemAvailibilityAtWarehouse_args(
      long warehouse_id,
      long item_id)
    {
      this();
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      this.item_id = item_id;
      setItem_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemAvailibilityAtWarehouse_args(getItemAvailibilityAtWarehouse_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.warehouse_id = other.warehouse_id;
      this.item_id = other.item_id;
    }

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

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

    public long getWarehouse_id() {
      return this.warehouse_id;
    }

    public getItemAvailibilityAtWarehouse_args setWarehouse_id(long warehouse_id) {
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      return this;
    }

    public void unsetWarehouse_id() {
      __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
    }

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

    public void setWarehouse_idIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
    }

    public long getItem_id() {
      return this.item_id;
    }

    public getItemAvailibilityAtWarehouse_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouse_id();
        } else {
          setWarehouse_id((Long)value);
        }
        break;

      case ITEM_ID:
        if (value == null) {
          unsetItem_id();
        } else {
          setItem_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE_ID:
        return new Long(getWarehouse_id());

      case ITEM_ID:
        return new Long(getItem_id());

      }
      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 WAREHOUSE_ID:
        return isSetWarehouse_id();
      case ITEM_ID:
        return isSetItem_id();
      }
      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 getItemAvailibilityAtWarehouse_args)
        return this.equals((getItemAvailibilityAtWarehouse_args)that);
      return false;
    }

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

      boolean this_present_warehouse_id = true;
      boolean that_present_warehouse_id = true;
      if (this_present_warehouse_id || that_present_warehouse_id) {
        if (!(this_present_warehouse_id && that_present_warehouse_id))
          return false;
        if (this.warehouse_id != that.warehouse_id)
          return false;
      }

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      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 WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouse_id = iprot.readI64();
                setWarehouse_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouse_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse_id:");
      sb.append(this.warehouse_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getItemAvailibilityAtWarehouse_result() {
    }

    public getItemAvailibilityAtWarehouse_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemAvailibilityAtWarehouse_result(getItemAvailibilityAtWarehouse_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public long getSuccess() {
      return this.success;
    }

    public getItemAvailibilityAtWarehouse_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getItemAvailibilityAtWarehouse_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getItemAvailibilityAtWarehouse_result)
        return this.equals((getItemAvailibilityAtWarehouse_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ENTITY_ID_FIELD_DESC = new TField("entityId", TType.I64, (short)1);

    private long entityId;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ENTITY_ID((short)1, "entityId");

      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 __ENTITYID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ENTITY_ID, new FieldMetaData("entityId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public markItemAsContentComplete_args() {
    }

    public markItemAsContentComplete_args(
      long entityId)
    {
      this();
      this.entityId = entityId;
      setEntityIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public markItemAsContentComplete_args(markItemAsContentComplete_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.entityId = other.entityId;
    }

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

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

    public long getEntityId() {
      return this.entityId;
    }

    public markItemAsContentComplete_args setEntityId(long entityId) {
      this.entityId = entityId;
      setEntityIdIsSet(true);
      return this;
    }

    public void unsetEntityId() {
      __isset_bit_vector.clear(__ENTITYID_ISSET_ID);
    }

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

    public void setEntityIdIsSet(boolean value) {
      __isset_bit_vector.set(__ENTITYID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ENTITY_ID:
        if (value == null) {
          unsetEntityId();
        } else {
          setEntityId((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ENTITY_ID:
        return new Long(getEntityId());

      }
      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 ENTITY_ID:
        return isSetEntityId();
      }
      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 markItemAsContentComplete_args)
        return this.equals((markItemAsContentComplete_args)that);
      return false;
    }

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

      boolean this_present_entityId = true;
      boolean that_present_entityId = true;
      if (this_present_entityId || that_present_entityId) {
        if (!(this_present_entityId && that_present_entityId))
          return false;
        if (this.entityId != that.entityId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetEntityId()).compareTo(isSetEntityId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(entityId, typedOther.entityId);
      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 ENTITY_ID:
              if (field.type == TType.I64) {
                this.entityId = iprot.readI64();
                setEntityIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ENTITY_ID_FIELD_DESC);
      oprot.writeI64(this.entityId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("entityId:");
      sb.append(this.entityId);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private boolean success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public markItemAsContentComplete_result() {
    }

    public markItemAsContentComplete_result(
      boolean success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public markItemAsContentComplete_result(markItemAsContentComplete_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public boolean isSuccess() {
      return this.success;
    }

    public markItemAsContentComplete_result setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public markItemAsContentComplete_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Boolean(isSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 markItemAsContentComplete_result)
        return this.equals((markItemAsContentComplete_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.BOOL) {
                this.success = iprot.readBool();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_LOC_FIELD_DESC = new TField("warehouse_loc", TType.I64, (short)1);
    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)2);

    private long warehouse_loc;
    private long item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE_LOC((short)1, "warehouse_loc"),
      ITEM_ID((short)2, "item_id");

      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 __WAREHOUSE_LOC_ISSET_ID = 0;
    private static final int __ITEM_ID_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE_LOC, new FieldMetaData("warehouse_loc", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getItemAvailabilityAtLocation_args() {
    }

    public getItemAvailabilityAtLocation_args(
      long warehouse_loc,
      long item_id)
    {
      this();
      this.warehouse_loc = warehouse_loc;
      setWarehouse_locIsSet(true);
      this.item_id = item_id;
      setItem_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemAvailabilityAtLocation_args(getItemAvailabilityAtLocation_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.warehouse_loc = other.warehouse_loc;
      this.item_id = other.item_id;
    }

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

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

    public long getWarehouse_loc() {
      return this.warehouse_loc;
    }

    public getItemAvailabilityAtLocation_args setWarehouse_loc(long warehouse_loc) {
      this.warehouse_loc = warehouse_loc;
      setWarehouse_locIsSet(true);
      return this;
    }

    public void unsetWarehouse_loc() {
      __isset_bit_vector.clear(__WAREHOUSE_LOC_ISSET_ID);
    }

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

    public void setWarehouse_locIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSE_LOC_ISSET_ID, value);
    }

    public long getItem_id() {
      return this.item_id;
    }

    public getItemAvailabilityAtLocation_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE_LOC:
        if (value == null) {
          unsetWarehouse_loc();
        } else {
          setWarehouse_loc((Long)value);
        }
        break;

      case ITEM_ID:
        if (value == null) {
          unsetItem_id();
        } else {
          setItem_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE_LOC:
        return new Long(getWarehouse_loc());

      case ITEM_ID:
        return new Long(getItem_id());

      }
      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 WAREHOUSE_LOC:
        return isSetWarehouse_loc();
      case ITEM_ID:
        return isSetItem_id();
      }
      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 getItemAvailabilityAtLocation_args)
        return this.equals((getItemAvailabilityAtLocation_args)that);
      return false;
    }

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

      boolean this_present_warehouse_loc = true;
      boolean that_present_warehouse_loc = true;
      if (this_present_warehouse_loc || that_present_warehouse_loc) {
        if (!(this_present_warehouse_loc && that_present_warehouse_loc))
          return false;
        if (this.warehouse_loc != that.warehouse_loc)
          return false;
      }

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetWarehouse_loc()).compareTo(isSetWarehouse_loc());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouse_loc, typedOther.warehouse_loc);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      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 WAREHOUSE_LOC:
              if (field.type == TType.I64) {
                this.warehouse_loc = iprot.readI64();
                setWarehouse_locIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WAREHOUSE_LOC_FIELD_DESC);
      oprot.writeI64(this.warehouse_loc);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse_loc:");
      sb.append(this.warehouse_loc);
      first = false;
      if (!first) sb.append(", ");
      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField ISEX_FIELD_DESC = new TField("isex", TType.STRUCT, (short)1);

    private List<Long> success;
    private InventoryServiceException isex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ISEX((short)1, "isex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new FieldValueMetaData(TType.I64))));
      put(_Fields.ISEX, new FieldMetaData("isex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getItemAvailabilityAtLocation_result() {
    }

    public getItemAvailabilityAtLocation_result(
      List<Long> success,
      InventoryServiceException isex)
    {
      this();
      this.success = success;
      this.isex = isex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemAvailabilityAtLocation_result(getItemAvailabilityAtLocation_result other) {
      if (other.isSetSuccess()) {
        List<Long> __this__success = new ArrayList<Long>();
        for (Long other_element : other.success) {
          __this__success.add(other_element);
        }
        this.success = __this__success;
      }
      if (other.isSetIsex()) {
        this.isex = new InventoryServiceException(other.isex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Long> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(long elem) {
      if (this.success == null) {
        this.success = new ArrayList<Long>();
      }
      this.success.add(elem);
    }

    public List<Long> getSuccess() {
      return this.success;
    }

    public getItemAvailabilityAtLocation_result setSuccess(List<Long> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getIsex() {
      return this.isex;
    }

    public getItemAvailabilityAtLocation_result setIsex(InventoryServiceException isex) {
      this.isex = isex;
      return this;
    }

    public void unsetIsex() {
      this.isex = null;
    }

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

    public void setIsexIsSet(boolean value) {
      if (!value) {
        this.isex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Long>)value);
        }
        break;

      case ISEX:
        if (value == null) {
          unsetIsex();
        } else {
          setIsex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ISEX:
        return getIsex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case ISEX:
        return isSetIsex();
      }
      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 getItemAvailabilityAtLocation_result)
        return this.equals((getItemAvailabilityAtLocation_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_isex = true && this.isSetIsex();
      boolean that_present_isex = true && that.isSetIsex();
      if (this_present_isex || that_present_isex) {
        if (!(this_present_isex && that_present_isex))
          return false;
        if (!this.isex.equals(that.isex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetIsex()).compareTo(isSetIsex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(isex, typedOther.isex);
      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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list27 = iprot.readListBegin();
                  this.success = new ArrayList<Long>(_list27.size);
                  for (int _i28 = 0; _i28 < _list27.size; ++_i28)
                  {
                    long _elem29;
                    _elem29 = iprot.readI64();
                    this.success.add(_elem29);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ISEX:
              if (field.type == TType.STRUCT) {
                this.isex = new InventoryServiceException();
                this.isex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.I64, this.success.size()));
          for (long _iter30 : this.success)
          {
            oprot.writeI64(_iter30);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetIsex()) {
        oprot.writeFieldBegin(ISEX_FIELD_DESC);
        this.isex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("isex:");
      if (this.isex == null) {
        sb.append("null");
      } else {
        sb.append(this.isex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField IS_ACTIVE_FIELD_DESC = new TField("isActive", TType.BOOL, (short)1);

    private boolean isActive;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      IS_ACTIVE((short)1, "isActive");

      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 __ISACTIVE_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.IS_ACTIVE, new FieldMetaData("isActive", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
    }});

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

    public getAllWarehouses_args() {
    }

    public getAllWarehouses_args(
      boolean isActive)
    {
      this();
      this.isActive = isActive;
      setIsActiveIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllWarehouses_args(getAllWarehouses_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.isActive = other.isActive;
    }

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

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

    public boolean isIsActive() {
      return this.isActive;
    }

    public getAllWarehouses_args setIsActive(boolean isActive) {
      this.isActive = isActive;
      setIsActiveIsSet(true);
      return this;
    }

    public void unsetIsActive() {
      __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
    }

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

    public void setIsActiveIsSet(boolean value) {
      __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case IS_ACTIVE:
        if (value == null) {
          unsetIsActive();
        } else {
          setIsActive((Boolean)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case IS_ACTIVE:
        return new Boolean(isIsActive());

      }
      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 IS_ACTIVE:
        return isSetIsActive();
      }
      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 getAllWarehouses_args)
        return this.equals((getAllWarehouses_args)that);
      return false;
    }

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

      boolean this_present_isActive = true;
      boolean that_present_isActive = true;
      if (this_present_isActive || that_present_isActive) {
        if (!(this_present_isActive && that_present_isActive))
          return false;
        if (this.isActive != that.isActive)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(isSetIsActive());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(isActive, typedOther.isActive);
      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 IS_ACTIVE:
              if (field.type == TType.BOOL) {
                this.isActive = iprot.readBool();
                setIsActiveIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(IS_ACTIVE_FIELD_DESC);
      oprot.writeBool(this.isActive);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("isActive:");
      sb.append(this.isActive);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Warehouse> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Warehouse.class))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getAllWarehouses_result() {
    }

    public getAllWarehouses_result(
      List<Warehouse> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllWarehouses_result(getAllWarehouses_result other) {
      if (other.isSetSuccess()) {
        List<Warehouse> __this__success = new ArrayList<Warehouse>();
        for (Warehouse other_element : other.success) {
          __this__success.add(new Warehouse(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Warehouse> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Warehouse elem) {
      if (this.success == null) {
        this.success = new ArrayList<Warehouse>();
      }
      this.success.add(elem);
    }

    public List<Warehouse> getSuccess() {
      return this.success;
    }

    public getAllWarehouses_result setSuccess(List<Warehouse> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getAllWarehouses_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Warehouse>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getAllWarehouses_result)
        return this.equals((getAllWarehouses_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list31 = iprot.readListBegin();
                  this.success = new ArrayList<Warehouse>(_list31.size);
                  for (int _i32 = 0; _i32 < _list31.size; ++_i32)
                  {
                    Warehouse _elem33;
                    _elem33 = new Warehouse();
                    _elem33.read(iprot);
                    this.success.add(_elem33);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Warehouse _iter34 : this.success)
          {
            _iter34.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);

    private long warehouse_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE_ID((short)1, "warehouse_id");

      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 __WAREHOUSE_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getWarehouse_args() {
    }

    public getWarehouse_args(
      long warehouse_id)
    {
      this();
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getWarehouse_args(getWarehouse_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.warehouse_id = other.warehouse_id;
    }

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

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

    public long getWarehouse_id() {
      return this.warehouse_id;
    }

    public getWarehouse_args setWarehouse_id(long warehouse_id) {
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      return this;
    }

    public void unsetWarehouse_id() {
      __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
    }

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

    public void setWarehouse_idIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouse_id();
        } else {
          setWarehouse_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE_ID:
        return new Long(getWarehouse_id());

      }
      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 WAREHOUSE_ID:
        return isSetWarehouse_id();
      }
      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 getWarehouse_args)
        return this.equals((getWarehouse_args)that);
      return false;
    }

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

      boolean this_present_warehouse_id = true;
      boolean that_present_warehouse_id = true;
      if (this_present_warehouse_id || that_present_warehouse_id) {
        if (!(this_present_warehouse_id && that_present_warehouse_id))
          return false;
        if (this.warehouse_id != that.warehouse_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
      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 WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouse_id = iprot.readI64();
                setWarehouse_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouse_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse_id:");
      sb.append(this.warehouse_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private Warehouse success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, Warehouse.class)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getWarehouse_result() {
    }

    public getWarehouse_result(
      Warehouse success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getWarehouse_result(getWarehouse_result other) {
      if (other.isSetSuccess()) {
        this.success = new Warehouse(other.success);
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public Warehouse getSuccess() {
      return this.success;
    }

    public getWarehouse_result setSuccess(Warehouse success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getWarehouse_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Warehouse)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getWarehouse_result)
        return this.equals((getWarehouse_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.STRUCT) {
                this.success = new Warehouse();
                this.success.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)1);

    private long item_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "item_id");

      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 __ITEM_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getAllWarehousesForItem_args() {
    }

    public getAllWarehousesForItem_args(
      long item_id)
    {
      this();
      this.item_id = item_id;
      setItem_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllWarehousesForItem_args(getAllWarehousesForItem_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.item_id = other.item_id;
    }

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

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

    public long getItem_id() {
      return this.item_id;
    }

    public getAllWarehousesForItem_args setItem_id(long item_id) {
      this.item_id = item_id;
      setItem_idIsSet(true);
      return this;
    }

    public void unsetItem_id() {
      __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
    }

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

    public void setItem_idIsSet(boolean value) {
      __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
    }

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_ID:
        return new Long(getItem_id());

      }
      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 ITEM_ID:
        return isSetItem_id();
      }
      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 getAllWarehousesForItem_args)
        return this.equals((getAllWarehousesForItem_args)that);
      return false;
    }

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

      boolean this_present_item_id = true;
      boolean that_present_item_id = true;
      if (this_present_item_id || that_present_item_id) {
        if (!(this_present_item_id && that_present_item_id))
          return false;
        if (this.item_id != that.item_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.item_id = iprot.readI64();
                setItem_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.item_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("item_id:");
      sb.append(this.item_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Warehouse> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Warehouse.class))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getAllWarehousesForItem_result() {
    }

    public getAllWarehousesForItem_result(
      List<Warehouse> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllWarehousesForItem_result(getAllWarehousesForItem_result other) {
      if (other.isSetSuccess()) {
        List<Warehouse> __this__success = new ArrayList<Warehouse>();
        for (Warehouse other_element : other.success) {
          __this__success.add(new Warehouse(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Warehouse> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Warehouse elem) {
      if (this.success == null) {
        this.success = new ArrayList<Warehouse>();
      }
      this.success.add(elem);
    }

    public List<Warehouse> getSuccess() {
      return this.success;
    }

    public getAllWarehousesForItem_result setSuccess(List<Warehouse> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getAllWarehousesForItem_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Warehouse>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getAllWarehousesForItem_result)
        return this.equals((getAllWarehousesForItem_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list35 = iprot.readListBegin();
                  this.success = new ArrayList<Warehouse>(_list35.size);
                  for (int _i36 = 0; _i36 < _list35.size; ++_i36)
                  {
                    Warehouse _elem37;
                    _elem37 = new Warehouse();
                    _elem37.read(iprot);
                    this.success.add(_elem37);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Warehouse _iter38 : this.success)
          {
            _iter38.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);

    private long warehouse_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      WAREHOUSE_ID((short)1, "warehouse_id");

      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 __WAREHOUSE_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getAllItemsForWarehouse_args() {
    }

    public getAllItemsForWarehouse_args(
      long warehouse_id)
    {
      this();
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllItemsForWarehouse_args(getAllItemsForWarehouse_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.warehouse_id = other.warehouse_id;
    }

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

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

    public long getWarehouse_id() {
      return this.warehouse_id;
    }

    public getAllItemsForWarehouse_args setWarehouse_id(long warehouse_id) {
      this.warehouse_id = warehouse_id;
      setWarehouse_idIsSet(true);
      return this;
    }

    public void unsetWarehouse_id() {
      __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
    }

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

    public void setWarehouse_idIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouse_id();
        } else {
          setWarehouse_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case WAREHOUSE_ID:
        return new Long(getWarehouse_id());

      }
      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 WAREHOUSE_ID:
        return isSetWarehouse_id();
      }
      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 getAllItemsForWarehouse_args)
        return this.equals((getAllItemsForWarehouse_args)that);
      return false;
    }

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

      boolean this_present_warehouse_id = true;
      boolean that_present_warehouse_id = true;
      if (this_present_warehouse_id || that_present_warehouse_id) {
        if (!(this_present_warehouse_id && that_present_warehouse_id))
          return false;
        if (this.warehouse_id != that.warehouse_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
      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 WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouse_id = iprot.readI64();
                setWarehouse_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouse_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("warehouse_id:");
      sb.append(this.warehouse_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getAllItemsForWarehouse_result() {
    }

    public getAllItemsForWarehouse_result(
      List<Item> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllItemsForWarehouse_result(getAllItemsForWarehouse_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getAllItemsForWarehouse_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getAllItemsForWarehouse_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getAllItemsForWarehouse_result)
        return this.equals((getAllItemsForWarehouse_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list39 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list39.size);
                  for (int _i40 = 0; _i40 < _list39.size; ++_i40)
                  {
                    Item _elem41;
                    _elem41 = new Item();
                    _elem41.read(iprot);
                    this.success.add(_elem41);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter42 : this.success)
          {
            _iter42.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)1);
    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)2);
    private static final TField QUANTITY_FIELD_DESC = new TField("quantity", TType.DOUBLE, (short)3);

    private long itemId;
    private long warehouseId;
    private double quantity;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "itemId"),
      WAREHOUSE_ID((short)2, "warehouseId"),
      QUANTITY((short)3, "quantity");

      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 __ITEMID_ISSET_ID = 0;
    private static final int __WAREHOUSEID_ISSET_ID = 1;
    private static final int __QUANTITY_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.QUANTITY, new FieldMetaData("quantity", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.DOUBLE)));
    }});

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

    public reserveItemInWarehouse_args() {
    }

    public reserveItemInWarehouse_args(
      long itemId,
      long warehouseId,
      double quantity)
    {
      this();
      this.itemId = itemId;
      setItemIdIsSet(true);
      this.warehouseId = warehouseId;
      setWarehouseIdIsSet(true);
      this.quantity = quantity;
      setQuantityIsSet(true);
    }

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

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

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

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

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

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

    /** Returns true if field itemId is set (has been asigned 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 getWarehouseId() {
      return this.warehouseId;
    }

    public reserveItemInWarehouse_args setWarehouseId(long warehouseId) {
      this.warehouseId = warehouseId;
      setWarehouseIdIsSet(true);
      return this;
    }

    public void unsetWarehouseId() {
      __isset_bit_vector.clear(__WAREHOUSEID_ISSET_ID);
    }

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

    public void setWarehouseIdIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
    }

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

    public reserveItemInWarehouse_args setQuantity(double quantity) {
      this.quantity = quantity;
      setQuantityIsSet(true);
      return this;
    }

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

    /** Returns true if field quantity is set (has been asigned 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM_ID:
        if (value == null) {
          unsetItemId();
        } else {
          setItemId((Long)value);
        }
        break;

      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouseId();
        } else {
          setWarehouseId((Long)value);
        }
        break;

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

      }
    }

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

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

      case WAREHOUSE_ID:
        return new Long(getWarehouseId());

      case QUANTITY:
        return new Double(getQuantity());

      }
      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 ITEM_ID:
        return isSetItemId();
      case WAREHOUSE_ID:
        return isSetWarehouseId();
      case QUANTITY:
        return isSetQuantity();
      }
      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 reserveItemInWarehouse_args)
        return this.equals((reserveItemInWarehouse_args)that);
      return false;
    }

    public boolean equals(reserveItemInWarehouse_args 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_warehouseId = true;
      boolean that_present_warehouseId = true;
      if (this_present_warehouseId || that_present_warehouseId) {
        if (!(this_present_warehouseId && that_present_warehouseId))
          return false;
        if (this.warehouseId != that.warehouseId)
          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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetWarehouseId()).compareTo(isSetWarehouseId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(isSetQuantity());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(quantity, typedOther.quantity);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.itemId = iprot.readI64();
                setItemIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouseId = iprot.readI64();
                setWarehouseIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case QUANTITY:
              if (field.type == TType.DOUBLE) {
                this.quantity = iprot.readDouble();
                setQuantityIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.itemId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouseId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
      oprot.writeDouble(this.quantity);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("itemId:");
      sb.append(this.itemId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("warehouseId:");
      sb.append(this.warehouseId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("quantity:");
      sb.append(this.quantity);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private boolean success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public reserveItemInWarehouse_result() {
    }

    public reserveItemInWarehouse_result(
      boolean success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public reserveItemInWarehouse_result(reserveItemInWarehouse_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public boolean isSuccess() {
      return this.success;
    }

    public reserveItemInWarehouse_result setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public reserveItemInWarehouse_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Boolean(isSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 reserveItemInWarehouse_result)
        return this.equals((reserveItemInWarehouse_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.BOOL) {
                this.success = iprot.readBool();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)1);
    private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)2);
    private static final TField QUANTITY_FIELD_DESC = new TField("quantity", TType.DOUBLE, (short)3);

    private long itemId;
    private long warehouseId;
    private double quantity;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ITEM_ID((short)1, "itemId"),
      WAREHOUSE_ID((short)2, "warehouseId"),
      QUANTITY((short)3, "quantity");

      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 __ITEMID_ISSET_ID = 0;
    private static final int __WAREHOUSEID_ISSET_ID = 1;
    private static final int __QUANTITY_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.QUANTITY, new FieldMetaData("quantity", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.DOUBLE)));
    }});

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

    public reduceReservationCount_args() {
    }

    public reduceReservationCount_args(
      long itemId,
      long warehouseId,
      double quantity)
    {
      this();
      this.itemId = itemId;
      setItemIdIsSet(true);
      this.warehouseId = warehouseId;
      setWarehouseIdIsSet(true);
      this.quantity = quantity;
      setQuantityIsSet(true);
    }

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

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

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

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

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

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

    /** Returns true if field itemId is set (has been asigned 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 getWarehouseId() {
      return this.warehouseId;
    }

    public reduceReservationCount_args setWarehouseId(long warehouseId) {
      this.warehouseId = warehouseId;
      setWarehouseIdIsSet(true);
      return this;
    }

    public void unsetWarehouseId() {
      __isset_bit_vector.clear(__WAREHOUSEID_ISSET_ID);
    }

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

    public void setWarehouseIdIsSet(boolean value) {
      __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
    }

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

    public reduceReservationCount_args setQuantity(double quantity) {
      this.quantity = quantity;
      setQuantityIsSet(true);
      return this;
    }

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

    /** Returns true if field quantity is set (has been asigned 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM_ID:
        if (value == null) {
          unsetItemId();
        } else {
          setItemId((Long)value);
        }
        break;

      case WAREHOUSE_ID:
        if (value == null) {
          unsetWarehouseId();
        } else {
          setWarehouseId((Long)value);
        }
        break;

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

      }
    }

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

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

      case WAREHOUSE_ID:
        return new Long(getWarehouseId());

      case QUANTITY:
        return new Double(getQuantity());

      }
      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 ITEM_ID:
        return isSetItemId();
      case WAREHOUSE_ID:
        return isSetWarehouseId();
      case QUANTITY:
        return isSetQuantity();
      }
      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 reduceReservationCount_args)
        return this.equals((reduceReservationCount_args)that);
      return false;
    }

    public boolean equals(reduceReservationCount_args 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_warehouseId = true;
      boolean that_present_warehouseId = true;
      if (this_present_warehouseId || that_present_warehouseId) {
        if (!(this_present_warehouseId && that_present_warehouseId))
          return false;
        if (this.warehouseId != that.warehouseId)
          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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetWarehouseId()).compareTo(isSetWarehouseId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(isSetQuantity());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(quantity, typedOther.quantity);
      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 ITEM_ID:
              if (field.type == TType.I64) {
                this.itemId = iprot.readI64();
                setItemIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case WAREHOUSE_ID:
              if (field.type == TType.I64) {
                this.warehouseId = iprot.readI64();
                setWarehouseIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case QUANTITY:
              if (field.type == TType.DOUBLE) {
                this.quantity = iprot.readDouble();
                setQuantityIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
      oprot.writeI64(this.itemId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
      oprot.writeI64(this.warehouseId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
      oprot.writeDouble(this.quantity);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("itemId:");
      sb.append(this.itemId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("warehouseId:");
      sb.append(this.warehouseId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("quantity:");
      sb.append(this.quantity);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private boolean success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public reduceReservationCount_result() {
    }

    public reduceReservationCount_result(
      boolean success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public reduceReservationCount_result(reduceReservationCount_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public boolean isSuccess() {
      return this.success;
    }

    public reduceReservationCount_result setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public reduceReservationCount_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Boolean(isSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 reduceReservationCount_result)
        return this.equals((reduceReservationCount_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.BOOL) {
                this.success = iprot.readBool();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

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

    public getBestSellers_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestSellers_args(getBestSellers_args other) {
    }

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getBestSellers_args)
        return this.equals((getBestSellers_args)that);
      return false;
    }

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

      return true;
    }

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

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

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

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField ISEX_FIELD_DESC = new TField("isex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException isex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ISEX((short)1, "isex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.ISEX, new FieldMetaData("isex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getBestSellers_result() {
    }

    public getBestSellers_result(
      List<Item> success,
      InventoryServiceException isex)
    {
      this();
      this.success = success;
      this.isex = isex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestSellers_result(getBestSellers_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetIsex()) {
        this.isex = new InventoryServiceException(other.isex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getBestSellers_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getIsex() {
      return this.isex;
    }

    public getBestSellers_result setIsex(InventoryServiceException isex) {
      this.isex = isex;
      return this;
    }

    public void unsetIsex() {
      this.isex = null;
    }

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

    public void setIsexIsSet(boolean value) {
      if (!value) {
        this.isex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case ISEX:
        if (value == null) {
          unsetIsex();
        } else {
          setIsex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ISEX:
        return getIsex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case ISEX:
        return isSetIsex();
      }
      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 getBestSellers_result)
        return this.equals((getBestSellers_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_isex = true && this.isSetIsex();
      boolean that_present_isex = true && that.isSetIsex();
      if (this_present_isex || that_present_isex) {
        if (!(this_present_isex && that_present_isex))
          return false;
        if (!this.isex.equals(that.isex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list43 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list43.size);
                  for (int _i44 = 0; _i44 < _list43.size; ++_i44)
                  {
                    Item _elem45;
                    _elem45 = new Item();
                    _elem45.read(iprot);
                    this.success.add(_elem45);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ISEX:
              if (field.type == TType.STRUCT) {
                this.isex = new InventoryServiceException();
                this.isex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter46 : this.success)
          {
            _iter46.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetIsex()) {
        oprot.writeFieldBegin(ISEX_FIELD_DESC);
        this.isex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("isex:");
      if (this.isex == null) {
        sb.append("null");
      } else {
        sb.append(this.isex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField BEGIN_INDEX_FIELD_DESC = new TField("beginIndex", TType.I64, (short)1);
    private static final TField TOTAL_ITEMS_FIELD_DESC = new TField("totalItems", TType.I64, (short)2);
    private static final TField CATEGORY_FIELD_DESC = new TField("category", TType.I64, (short)3);

    private long beginIndex;
    private long totalItems;
    private long category;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      BEGIN_INDEX((short)1, "beginIndex"),
      TOTAL_ITEMS((short)2, "totalItems"),
      CATEGORY((short)3, "category");

      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 __BEGININDEX_ISSET_ID = 0;
    private static final int __TOTALITEMS_ISSET_ID = 1;
    private static final int __CATEGORY_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.BEGIN_INDEX, new FieldMetaData("beginIndex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TOTAL_ITEMS, new FieldMetaData("totalItems", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CATEGORY, new FieldMetaData("category", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getBestSellersCatalogIds_args() {
    }

    public getBestSellersCatalogIds_args(
      long beginIndex,
      long totalItems,
      long category)
    {
      this();
      this.beginIndex = beginIndex;
      setBeginIndexIsSet(true);
      this.totalItems = totalItems;
      setTotalItemsIsSet(true);
      this.category = category;
      setCategoryIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestSellersCatalogIds_args(getBestSellersCatalogIds_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.beginIndex = other.beginIndex;
      this.totalItems = other.totalItems;
      this.category = other.category;
    }

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

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

    public long getBeginIndex() {
      return this.beginIndex;
    }

    public getBestSellersCatalogIds_args setBeginIndex(long beginIndex) {
      this.beginIndex = beginIndex;
      setBeginIndexIsSet(true);
      return this;
    }

    public void unsetBeginIndex() {
      __isset_bit_vector.clear(__BEGININDEX_ISSET_ID);
    }

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

    public void setBeginIndexIsSet(boolean value) {
      __isset_bit_vector.set(__BEGININDEX_ISSET_ID, value);
    }

    public long getTotalItems() {
      return this.totalItems;
    }

    public getBestSellersCatalogIds_args setTotalItems(long totalItems) {
      this.totalItems = totalItems;
      setTotalItemsIsSet(true);
      return this;
    }

    public void unsetTotalItems() {
      __isset_bit_vector.clear(__TOTALITEMS_ISSET_ID);
    }

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

    public void setTotalItemsIsSet(boolean value) {
      __isset_bit_vector.set(__TOTALITEMS_ISSET_ID, value);
    }

    public long getCategory() {
      return this.category;
    }

    public getBestSellersCatalogIds_args setCategory(long category) {
      this.category = category;
      setCategoryIsSet(true);
      return this;
    }

    public void unsetCategory() {
      __isset_bit_vector.clear(__CATEGORY_ISSET_ID);
    }

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

    public void setCategoryIsSet(boolean value) {
      __isset_bit_vector.set(__CATEGORY_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case BEGIN_INDEX:
        if (value == null) {
          unsetBeginIndex();
        } else {
          setBeginIndex((Long)value);
        }
        break;

      case TOTAL_ITEMS:
        if (value == null) {
          unsetTotalItems();
        } else {
          setTotalItems((Long)value);
        }
        break;

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case BEGIN_INDEX:
        return new Long(getBeginIndex());

      case TOTAL_ITEMS:
        return new Long(getTotalItems());

      case CATEGORY:
        return new Long(getCategory());

      }
      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 BEGIN_INDEX:
        return isSetBeginIndex();
      case TOTAL_ITEMS:
        return isSetTotalItems();
      case CATEGORY:
        return isSetCategory();
      }
      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 getBestSellersCatalogIds_args)
        return this.equals((getBestSellersCatalogIds_args)that);
      return false;
    }

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

      boolean this_present_beginIndex = true;
      boolean that_present_beginIndex = true;
      if (this_present_beginIndex || that_present_beginIndex) {
        if (!(this_present_beginIndex && that_present_beginIndex))
          return false;
        if (this.beginIndex != that.beginIndex)
          return false;
      }

      boolean this_present_totalItems = true;
      boolean that_present_totalItems = true;
      if (this_present_totalItems || that_present_totalItems) {
        if (!(this_present_totalItems && that_present_totalItems))
          return false;
        if (this.totalItems != that.totalItems)
          return false;
      }

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

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetBeginIndex()).compareTo(isSetBeginIndex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(beginIndex, typedOther.beginIndex);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTotalItems()).compareTo(isSetTotalItems());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(totalItems, typedOther.totalItems);
      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;
      }
      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 BEGIN_INDEX:
              if (field.type == TType.I64) {
                this.beginIndex = iprot.readI64();
                setBeginIndexIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TOTAL_ITEMS:
              if (field.type == TType.I64) {
                this.totalItems = iprot.readI64();
                setTotalItemsIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CATEGORY:
              if (field.type == TType.I64) {
                this.category = iprot.readI64();
                setCategoryIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BEGIN_INDEX_FIELD_DESC);
      oprot.writeI64(this.beginIndex);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TOTAL_ITEMS_FIELD_DESC);
      oprot.writeI64(this.totalItems);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
      oprot.writeI64(this.category);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("beginIndex:");
      sb.append(this.beginIndex);
      first = false;
      if (!first) sb.append(", ");
      sb.append("totalItems:");
      sb.append(this.totalItems);
      first = false;
      if (!first) sb.append(", ");
      sb.append("category:");
      sb.append(this.category);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Long> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new FieldValueMetaData(TType.I64))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getBestSellersCatalogIds_result() {
    }

    public getBestSellersCatalogIds_result(
      List<Long> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestSellersCatalogIds_result(getBestSellersCatalogIds_result other) {
      if (other.isSetSuccess()) {
        List<Long> __this__success = new ArrayList<Long>();
        for (Long other_element : other.success) {
          __this__success.add(other_element);
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Long> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(long elem) {
      if (this.success == null) {
        this.success = new ArrayList<Long>();
      }
      this.success.add(elem);
    }

    public List<Long> getSuccess() {
      return this.success;
    }

    public getBestSellersCatalogIds_result setSuccess(List<Long> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getBestSellersCatalogIds_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Long>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getBestSellersCatalogIds_result)
        return this.equals((getBestSellersCatalogIds_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list47 = iprot.readListBegin();
                  this.success = new ArrayList<Long>(_list47.size);
                  for (int _i48 = 0; _i48 < _list47.size; ++_i48)
                  {
                    long _elem49;
                    _elem49 = iprot.readI64();
                    this.success.add(_elem49);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.I64, this.success.size()));
          for (long _iter50 : this.success)
          {
            oprot.writeI64(_iter50);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

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

    public getBestSellersCount_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestSellersCount_args(getBestSellersCount_args other) {
    }

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getBestSellersCount_args)
        return this.equals((getBestSellersCount_args)that);
      return false;
    }

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

      return true;
    }

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

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

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

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getBestSellersCount_result() {
    }

    public getBestSellersCount_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestSellersCount_result(getBestSellersCount_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public long getSuccess() {
      return this.success;
    }

    public getBestSellersCount_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getBestSellersCount_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getBestSellersCount_result)
        return this.equals((getBestSellersCount_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

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

    public getBestDeals_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestDeals_args(getBestDeals_args other) {
    }

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getBestDeals_args)
        return this.equals((getBestDeals_args)that);
      return false;
    }

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

      return true;
    }

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

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

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

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField ISEX_FIELD_DESC = new TField("isex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException isex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ISEX((short)1, "isex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.ISEX, new FieldMetaData("isex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getBestDeals_result() {
    }

    public getBestDeals_result(
      List<Item> success,
      InventoryServiceException isex)
    {
      this();
      this.success = success;
      this.isex = isex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestDeals_result(getBestDeals_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetIsex()) {
        this.isex = new InventoryServiceException(other.isex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getBestDeals_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getIsex() {
      return this.isex;
    }

    public getBestDeals_result setIsex(InventoryServiceException isex) {
      this.isex = isex;
      return this;
    }

    public void unsetIsex() {
      this.isex = null;
    }

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

    public void setIsexIsSet(boolean value) {
      if (!value) {
        this.isex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case ISEX:
        if (value == null) {
          unsetIsex();
        } else {
          setIsex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ISEX:
        return getIsex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case ISEX:
        return isSetIsex();
      }
      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 getBestDeals_result)
        return this.equals((getBestDeals_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_isex = true && this.isSetIsex();
      boolean that_present_isex = true && that.isSetIsex();
      if (this_present_isex || that_present_isex) {
        if (!(this_present_isex && that_present_isex))
          return false;
        if (!this.isex.equals(that.isex))
          return false;
      }

      return true;
    }

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

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list51 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list51.size);
                  for (int _i52 = 0; _i52 < _list51.size; ++_i52)
                  {
                    Item _elem53;
                    _elem53 = new Item();
                    _elem53.read(iprot);
                    this.success.add(_elem53);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ISEX:
              if (field.type == TType.STRUCT) {
                this.isex = new InventoryServiceException();
                this.isex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter54 : this.success)
          {
            _iter54.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetIsex()) {
        oprot.writeFieldBegin(ISEX_FIELD_DESC);
        this.isex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("isex:");
      if (this.isex == null) {
        sb.append("null");
      } else {
        sb.append(this.isex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField BEGIN_INDEX_FIELD_DESC = new TField("beginIndex", TType.I64, (short)1);
    private static final TField TOTAL_ITEMS_FIELD_DESC = new TField("totalItems", TType.I64, (short)2);
    private static final TField CATEGORY_FIELD_DESC = new TField("category", TType.I64, (short)3);

    private long beginIndex;
    private long totalItems;
    private long category;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      BEGIN_INDEX((short)1, "beginIndex"),
      TOTAL_ITEMS((short)2, "totalItems"),
      CATEGORY((short)3, "category");

      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 __BEGININDEX_ISSET_ID = 0;
    private static final int __TOTALITEMS_ISSET_ID = 1;
    private static final int __CATEGORY_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.BEGIN_INDEX, new FieldMetaData("beginIndex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TOTAL_ITEMS, new FieldMetaData("totalItems", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CATEGORY, new FieldMetaData("category", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getBestDealsCatalogIds_args() {
    }

    public getBestDealsCatalogIds_args(
      long beginIndex,
      long totalItems,
      long category)
    {
      this();
      this.beginIndex = beginIndex;
      setBeginIndexIsSet(true);
      this.totalItems = totalItems;
      setTotalItemsIsSet(true);
      this.category = category;
      setCategoryIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestDealsCatalogIds_args(getBestDealsCatalogIds_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.beginIndex = other.beginIndex;
      this.totalItems = other.totalItems;
      this.category = other.category;
    }

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

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

    public long getBeginIndex() {
      return this.beginIndex;
    }

    public getBestDealsCatalogIds_args setBeginIndex(long beginIndex) {
      this.beginIndex = beginIndex;
      setBeginIndexIsSet(true);
      return this;
    }

    public void unsetBeginIndex() {
      __isset_bit_vector.clear(__BEGININDEX_ISSET_ID);
    }

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

    public void setBeginIndexIsSet(boolean value) {
      __isset_bit_vector.set(__BEGININDEX_ISSET_ID, value);
    }

    public long getTotalItems() {
      return this.totalItems;
    }

    public getBestDealsCatalogIds_args setTotalItems(long totalItems) {
      this.totalItems = totalItems;
      setTotalItemsIsSet(true);
      return this;
    }

    public void unsetTotalItems() {
      __isset_bit_vector.clear(__TOTALITEMS_ISSET_ID);
    }

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

    public void setTotalItemsIsSet(boolean value) {
      __isset_bit_vector.set(__TOTALITEMS_ISSET_ID, value);
    }

    public long getCategory() {
      return this.category;
    }

    public getBestDealsCatalogIds_args setCategory(long category) {
      this.category = category;
      setCategoryIsSet(true);
      return this;
    }

    public void unsetCategory() {
      __isset_bit_vector.clear(__CATEGORY_ISSET_ID);
    }

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

    public void setCategoryIsSet(boolean value) {
      __isset_bit_vector.set(__CATEGORY_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case BEGIN_INDEX:
        if (value == null) {
          unsetBeginIndex();
        } else {
          setBeginIndex((Long)value);
        }
        break;

      case TOTAL_ITEMS:
        if (value == null) {
          unsetTotalItems();
        } else {
          setTotalItems((Long)value);
        }
        break;

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case BEGIN_INDEX:
        return new Long(getBeginIndex());

      case TOTAL_ITEMS:
        return new Long(getTotalItems());

      case CATEGORY:
        return new Long(getCategory());

      }
      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 BEGIN_INDEX:
        return isSetBeginIndex();
      case TOTAL_ITEMS:
        return isSetTotalItems();
      case CATEGORY:
        return isSetCategory();
      }
      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 getBestDealsCatalogIds_args)
        return this.equals((getBestDealsCatalogIds_args)that);
      return false;
    }

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

      boolean this_present_beginIndex = true;
      boolean that_present_beginIndex = true;
      if (this_present_beginIndex || that_present_beginIndex) {
        if (!(this_present_beginIndex && that_present_beginIndex))
          return false;
        if (this.beginIndex != that.beginIndex)
          return false;
      }

      boolean this_present_totalItems = true;
      boolean that_present_totalItems = true;
      if (this_present_totalItems || that_present_totalItems) {
        if (!(this_present_totalItems && that_present_totalItems))
          return false;
        if (this.totalItems != that.totalItems)
          return false;
      }

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

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetBeginIndex()).compareTo(isSetBeginIndex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(beginIndex, typedOther.beginIndex);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTotalItems()).compareTo(isSetTotalItems());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(totalItems, typedOther.totalItems);
      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;
      }
      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 BEGIN_INDEX:
              if (field.type == TType.I64) {
                this.beginIndex = iprot.readI64();
                setBeginIndexIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TOTAL_ITEMS:
              if (field.type == TType.I64) {
                this.totalItems = iprot.readI64();
                setTotalItemsIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CATEGORY:
              if (field.type == TType.I64) {
                this.category = iprot.readI64();
                setCategoryIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BEGIN_INDEX_FIELD_DESC);
      oprot.writeI64(this.beginIndex);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TOTAL_ITEMS_FIELD_DESC);
      oprot.writeI64(this.totalItems);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
      oprot.writeI64(this.category);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("beginIndex:");
      sb.append(this.beginIndex);
      first = false;
      if (!first) sb.append(", ");
      sb.append("totalItems:");
      sb.append(this.totalItems);
      first = false;
      if (!first) sb.append(", ");
      sb.append("category:");
      sb.append(this.category);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Long> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new FieldValueMetaData(TType.I64))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getBestDealsCatalogIds_result() {
    }

    public getBestDealsCatalogIds_result(
      List<Long> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestDealsCatalogIds_result(getBestDealsCatalogIds_result other) {
      if (other.isSetSuccess()) {
        List<Long> __this__success = new ArrayList<Long>();
        for (Long other_element : other.success) {
          __this__success.add(other_element);
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

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

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Long> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(long elem) {
      if (this.success == null) {
        this.success = new ArrayList<Long>();
      }
      this.success.add(elem);
    }

    public List<Long> getSuccess() {
      return this.success;
    }

    public getBestDealsCatalogIds_result setSuccess(List<Long> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getBestDealsCatalogIds_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

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

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Long>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getBestDealsCatalogIds_result)
        return this.equals((getBestDealsCatalogIds_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list55 = iprot.readListBegin();
                  this.success = new ArrayList<Long>(_list55.size);
                  for (int _i56 = 0; _i56 < _list55.size; ++_i56)
                  {
                    long _elem57;
                    _elem57 = iprot.readI64();
                    this.success.add(_elem57);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.I64, this.success.size()));
          for (long _iter58 : this.success)
          {
            oprot.writeI64(_iter58);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

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

    public getBestDealsCount_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestDealsCount_args(getBestDealsCount_args other) {
    }

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getBestDealsCount_args)
        return this.equals((getBestDealsCount_args)that);
      return false;
    }

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

      return true;
    }

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

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

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

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getBestDealsCount_result() {
    }

    public getBestDealsCount_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getBestDealsCount_result(getBestDealsCount_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

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

    @Deprecated
    public getBestDealsCount_result clone() {
      return new getBestDealsCount_result(this);
    }

    public long getSuccess() {
      return this.success;
    }

    public getBestDealsCount_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

    /** Returns true if field success is set (has been asigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
    }

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getBestDealsCount_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

    /** Returns true if field cex is set (has been asigned a value) and false otherwise */
    public boolean isSetCex() {
      return this.cex != null;
    }

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getBestDealsCount_result)
        return this.equals((getBestDealsCount_result)that);
      return false;
    }

    public boolean equals(getBestDealsCount_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getBestDealsCount_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getBestDealsCount_result typedOther = (getBestDealsCount_result)other;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getBestDealsCount_result(");
      boolean first = true;

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getLatestArrivals_args implements TBase<getLatestArrivals_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLatestArrivals_args>   {
    private static final TStruct STRUCT_DESC = new TStruct("getLatestArrivals_args");



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getLatestArrivals_args.class, metaDataMap);
    }

    public getLatestArrivals_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getLatestArrivals_args(getLatestArrivals_args other) {
    }

    public getLatestArrivals_args deepCopy() {
      return new getLatestArrivals_args(this);
    }

    @Deprecated
    public getLatestArrivals_args clone() {
      return new getLatestArrivals_args(this);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getLatestArrivals_args)
        return this.equals((getLatestArrivals_args)that);
      return false;
    }

    public boolean equals(getLatestArrivals_args that) {
      if (that == null)
        return false;

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getLatestArrivals_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getLatestArrivals_args typedOther = (getLatestArrivals_args)other;

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getLatestArrivals_args(");
      boolean first = true;

      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getLatestArrivals_result implements TBase<getLatestArrivals_result._Fields>, java.io.Serializable, Cloneable   {
    private static final TStruct STRUCT_DESC = new TStruct("getLatestArrivals_result");

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField ISEX_FIELD_DESC = new TField("isex", TType.STRUCT, (short)1);

    private List<Item> success;
    private InventoryServiceException isex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ISEX((short)1, "isex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Item.class))));
      put(_Fields.ISEX, new FieldMetaData("isex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getLatestArrivals_result.class, metaDataMap);
    }

    public getLatestArrivals_result() {
    }

    public getLatestArrivals_result(
      List<Item> success,
      InventoryServiceException isex)
    {
      this();
      this.success = success;
      this.isex = isex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getLatestArrivals_result(getLatestArrivals_result other) {
      if (other.isSetSuccess()) {
        List<Item> __this__success = new ArrayList<Item>();
        for (Item other_element : other.success) {
          __this__success.add(new Item(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetIsex()) {
        this.isex = new InventoryServiceException(other.isex);
      }
    }

    public getLatestArrivals_result deepCopy() {
      return new getLatestArrivals_result(this);
    }

    @Deprecated
    public getLatestArrivals_result clone() {
      return new getLatestArrivals_result(this);
    }

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Item> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Item elem) {
      if (this.success == null) {
        this.success = new ArrayList<Item>();
      }
      this.success.add(elem);
    }

    public List<Item> getSuccess() {
      return this.success;
    }

    public getLatestArrivals_result setSuccess(List<Item> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been asigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getIsex() {
      return this.isex;
    }

    public getLatestArrivals_result setIsex(InventoryServiceException isex) {
      this.isex = isex;
      return this;
    }

    public void unsetIsex() {
      this.isex = null;
    }

    /** Returns true if field isex is set (has been asigned a value) and false otherwise */
    public boolean isSetIsex() {
      return this.isex != null;
    }

    public void setIsexIsSet(boolean value) {
      if (!value) {
        this.isex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Item>)value);
        }
        break;

      case ISEX:
        if (value == null) {
          unsetIsex();
        } else {
          setIsex((InventoryServiceException)value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ISEX:
        return getIsex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case ISEX:
        return isSetIsex();
      }
      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 getLatestArrivals_result)
        return this.equals((getLatestArrivals_result)that);
      return false;
    }

    public boolean equals(getLatestArrivals_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_isex = true && this.isSetIsex();
      boolean that_present_isex = true && that.isSetIsex();
      if (this_present_isex || that_present_isex) {
        if (!(this_present_isex && that_present_isex))
          return false;
        if (!this.isex.equals(that.isex))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public void read(TProtocol iprot) throws TException {
      TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) { 
          break;
        }
        _Fields fieldId = _Fields.findByThriftId(field.id);
        if (fieldId == null) {
          TProtocolUtil.skip(iprot, field.type);
        } else {
          switch (fieldId) {
            case SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list59 = iprot.readListBegin();
                  this.success = new ArrayList<Item>(_list59.size);
                  for (int _i60 = 0; _i60 < _list59.size; ++_i60)
                  {
                    Item _elem61;
                    _elem61 = new Item();
                    _elem61.read(iprot);
                    this.success.add(_elem61);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case ISEX:
              if (field.type == TType.STRUCT) {
                this.isex = new InventoryServiceException();
                this.isex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Item _iter62 : this.success)
          {
            _iter62.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetIsex()) {
        oprot.writeFieldBegin(ISEX_FIELD_DESC);
        this.isex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getLatestArrivals_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("isex:");
      if (this.isex == null) {
        sb.append("null");
      } else {
        sb.append(this.isex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getLatestArrivalsCatalogIds_args implements TBase<getLatestArrivalsCatalogIds_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLatestArrivalsCatalogIds_args>   {
    private static final TStruct STRUCT_DESC = new TStruct("getLatestArrivalsCatalogIds_args");

    private static final TField BEGIN_INDEX_FIELD_DESC = new TField("beginIndex", TType.I64, (short)1);
    private static final TField TOTAL_ITEMS_FIELD_DESC = new TField("totalItems", TType.I64, (short)2);
    private static final TField CATEGORY_FIELD_DESC = new TField("category", TType.I64, (short)3);

    private long beginIndex;
    private long totalItems;
    private long category;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      BEGIN_INDEX((short)1, "beginIndex"),
      TOTAL_ITEMS((short)2, "totalItems"),
      CATEGORY((short)3, "category");

      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 __BEGININDEX_ISSET_ID = 0;
    private static final int __TOTALITEMS_ISSET_ID = 1;
    private static final int __CATEGORY_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.BEGIN_INDEX, new FieldMetaData("beginIndex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TOTAL_ITEMS, new FieldMetaData("totalItems", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CATEGORY, new FieldMetaData("category", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getLatestArrivalsCatalogIds_args.class, metaDataMap);
    }

    public getLatestArrivalsCatalogIds_args() {
    }

    public getLatestArrivalsCatalogIds_args(
      long beginIndex,
      long totalItems,
      long category)
    {
      this();
      this.beginIndex = beginIndex;
      setBeginIndexIsSet(true);
      this.totalItems = totalItems;
      setTotalItemsIsSet(true);
      this.category = category;
      setCategoryIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getLatestArrivalsCatalogIds_args(getLatestArrivalsCatalogIds_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.beginIndex = other.beginIndex;
      this.totalItems = other.totalItems;
      this.category = other.category;
    }

    public getLatestArrivalsCatalogIds_args deepCopy() {
      return new getLatestArrivalsCatalogIds_args(this);
    }

    @Deprecated
    public getLatestArrivalsCatalogIds_args clone() {
      return new getLatestArrivalsCatalogIds_args(this);
    }

    public long getBeginIndex() {
      return this.beginIndex;
    }

    public getLatestArrivalsCatalogIds_args setBeginIndex(long beginIndex) {
      this.beginIndex = beginIndex;
      setBeginIndexIsSet(true);
      return this;
    }

    public void unsetBeginIndex() {
      __isset_bit_vector.clear(__BEGININDEX_ISSET_ID);
    }

    /** Returns true if field beginIndex is set (has been asigned a value) and false otherwise */
    public boolean isSetBeginIndex() {
      return __isset_bit_vector.get(__BEGININDEX_ISSET_ID);
    }

    public void setBeginIndexIsSet(boolean value) {
      __isset_bit_vector.set(__BEGININDEX_ISSET_ID, value);
    }

    public long getTotalItems() {
      return this.totalItems;
    }

    public getLatestArrivalsCatalogIds_args setTotalItems(long totalItems) {
      this.totalItems = totalItems;
      setTotalItemsIsSet(true);
      return this;
    }

    public void unsetTotalItems() {
      __isset_bit_vector.clear(__TOTALITEMS_ISSET_ID);
    }

    /** Returns true if field totalItems is set (has been asigned a value) and false otherwise */
    public boolean isSetTotalItems() {
      return __isset_bit_vector.get(__TOTALITEMS_ISSET_ID);
    }

    public void setTotalItemsIsSet(boolean value) {
      __isset_bit_vector.set(__TOTALITEMS_ISSET_ID, value);
    }

    public long getCategory() {
      return this.category;
    }

    public getLatestArrivalsCatalogIds_args setCategory(long category) {
      this.category = category;
      setCategoryIsSet(true);
      return this;
    }

    public void unsetCategory() {
      __isset_bit_vector.clear(__CATEGORY_ISSET_ID);
    }

    /** Returns true if field category is set (has been asigned a value) and false otherwise */
    public boolean isSetCategory() {
      return __isset_bit_vector.get(__CATEGORY_ISSET_ID);
    }

    public void setCategoryIsSet(boolean value) {
      __isset_bit_vector.set(__CATEGORY_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case BEGIN_INDEX:
        if (value == null) {
          unsetBeginIndex();
        } else {
          setBeginIndex((Long)value);
        }
        break;

      case TOTAL_ITEMS:
        if (value == null) {
          unsetTotalItems();
        } else {
          setTotalItems((Long)value);
        }
        break;

      case CATEGORY:
        if (value == null) {
          unsetCategory();
        } else {
          setCategory((Long)value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case BEGIN_INDEX:
        return new Long(getBeginIndex());

      case TOTAL_ITEMS:
        return new Long(getTotalItems());

      case CATEGORY:
        return new Long(getCategory());

      }
      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 BEGIN_INDEX:
        return isSetBeginIndex();
      case TOTAL_ITEMS:
        return isSetTotalItems();
      case CATEGORY:
        return isSetCategory();
      }
      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 getLatestArrivalsCatalogIds_args)
        return this.equals((getLatestArrivalsCatalogIds_args)that);
      return false;
    }

    public boolean equals(getLatestArrivalsCatalogIds_args that) {
      if (that == null)
        return false;

      boolean this_present_beginIndex = true;
      boolean that_present_beginIndex = true;
      if (this_present_beginIndex || that_present_beginIndex) {
        if (!(this_present_beginIndex && that_present_beginIndex))
          return false;
        if (this.beginIndex != that.beginIndex)
          return false;
      }

      boolean this_present_totalItems = true;
      boolean that_present_totalItems = true;
      if (this_present_totalItems || that_present_totalItems) {
        if (!(this_present_totalItems && that_present_totalItems))
          return false;
        if (this.totalItems != that.totalItems)
          return false;
      }

      boolean this_present_category = true;
      boolean that_present_category = true;
      if (this_present_category || that_present_category) {
        if (!(this_present_category && that_present_category))
          return false;
        if (this.category != that.category)
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getLatestArrivalsCatalogIds_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getLatestArrivalsCatalogIds_args typedOther = (getLatestArrivalsCatalogIds_args)other;

      lastComparison = Boolean.valueOf(isSetBeginIndex()).compareTo(isSetBeginIndex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(beginIndex, typedOther.beginIndex);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTotalItems()).compareTo(isSetTotalItems());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(totalItems, typedOther.totalItems);
      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;
      }
      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 BEGIN_INDEX:
              if (field.type == TType.I64) {
                this.beginIndex = iprot.readI64();
                setBeginIndexIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TOTAL_ITEMS:
              if (field.type == TType.I64) {
                this.totalItems = iprot.readI64();
                setTotalItemsIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CATEGORY:
              if (field.type == TType.I64) {
                this.category = iprot.readI64();
                setCategoryIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BEGIN_INDEX_FIELD_DESC);
      oprot.writeI64(this.beginIndex);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TOTAL_ITEMS_FIELD_DESC);
      oprot.writeI64(this.totalItems);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
      oprot.writeI64(this.category);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getLatestArrivalsCatalogIds_args(");
      boolean first = true;

      sb.append("beginIndex:");
      sb.append(this.beginIndex);
      first = false;
      if (!first) sb.append(", ");
      sb.append("totalItems:");
      sb.append(this.totalItems);
      first = false;
      if (!first) sb.append(", ");
      sb.append("category:");
      sb.append(this.category);
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getLatestArrivalsCatalogIds_result implements TBase<getLatestArrivalsCatalogIds_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLatestArrivalsCatalogIds_result>   {
    private static final TStruct STRUCT_DESC = new TStruct("getLatestArrivalsCatalogIds_result");

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private List<Long> success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new FieldValueMetaData(TType.I64))));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getLatestArrivalsCatalogIds_result.class, metaDataMap);
    }

    public getLatestArrivalsCatalogIds_result() {
    }

    public getLatestArrivalsCatalogIds_result(
      List<Long> success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getLatestArrivalsCatalogIds_result(getLatestArrivalsCatalogIds_result other) {
      if (other.isSetSuccess()) {
        List<Long> __this__success = new ArrayList<Long>();
        for (Long other_element : other.success) {
          __this__success.add(other_element);
        }
        this.success = __this__success;
      }
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

    public getLatestArrivalsCatalogIds_result deepCopy() {
      return new getLatestArrivalsCatalogIds_result(this);
    }

    @Deprecated
    public getLatestArrivalsCatalogIds_result clone() {
      return new getLatestArrivalsCatalogIds_result(this);
    }

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Long> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(long elem) {
      if (this.success == null) {
        this.success = new ArrayList<Long>();
      }
      this.success.add(elem);
    }

    public List<Long> getSuccess() {
      return this.success;
    }

    public getLatestArrivalsCatalogIds_result setSuccess(List<Long> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been asigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getLatestArrivalsCatalogIds_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

    /** Returns true if field cex is set (has been asigned a value) and false otherwise */
    public boolean isSetCex() {
      return this.cex != null;
    }

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Long>)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getLatestArrivalsCatalogIds_result)
        return this.equals((getLatestArrivalsCatalogIds_result)that);
      return false;
    }

    public boolean equals(getLatestArrivalsCatalogIds_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getLatestArrivalsCatalogIds_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getLatestArrivalsCatalogIds_result typedOther = (getLatestArrivalsCatalogIds_result)other;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list63 = iprot.readListBegin();
                  this.success = new ArrayList<Long>(_list63.size);
                  for (int _i64 = 0; _i64 < _list63.size; ++_i64)
                  {
                    long _elem65;
                    _elem65 = iprot.readI64();
                    this.success.add(_elem65);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.I64, this.success.size()));
          for (long _iter66 : this.success)
          {
            oprot.writeI64(_iter66);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getLatestArrivalsCatalogIds_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getLatestArrivalsCount_args implements TBase<getLatestArrivalsCount_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLatestArrivalsCount_args>   {
    private static final TStruct STRUCT_DESC = new TStruct("getLatestArrivalsCount_args");



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getLatestArrivalsCount_args.class, metaDataMap);
    }

    public getLatestArrivalsCount_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getLatestArrivalsCount_args(getLatestArrivalsCount_args other) {
    }

    public getLatestArrivalsCount_args deepCopy() {
      return new getLatestArrivalsCount_args(this);
    }

    @Deprecated
    public getLatestArrivalsCount_args clone() {
      return new getLatestArrivalsCount_args(this);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getLatestArrivalsCount_args)
        return this.equals((getLatestArrivalsCount_args)that);
      return false;
    }

    public boolean equals(getLatestArrivalsCount_args that) {
      if (that == null)
        return false;

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getLatestArrivalsCount_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getLatestArrivalsCount_args typedOther = (getLatestArrivalsCount_args)other;

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getLatestArrivalsCount_args(");
      boolean first = true;

      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getLatestArrivalsCount_result implements TBase<getLatestArrivalsCount_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLatestArrivalsCount_result>   {
    private static final TStruct STRUCT_DESC = new TStruct("getLatestArrivalsCount_result");

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField CEX_FIELD_DESC = new TField("cex", TType.STRUCT, (short)1);

    private long success;
    private InventoryServiceException cex;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      CEX((short)1, "cex");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CEX, new FieldMetaData("cex", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getLatestArrivalsCount_result.class, metaDataMap);
    }

    public getLatestArrivalsCount_result() {
    }

    public getLatestArrivalsCount_result(
      long success,
      InventoryServiceException cex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.cex = cex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getLatestArrivalsCount_result(getLatestArrivalsCount_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetCex()) {
        this.cex = new InventoryServiceException(other.cex);
      }
    }

    public getLatestArrivalsCount_result deepCopy() {
      return new getLatestArrivalsCount_result(this);
    }

    @Deprecated
    public getLatestArrivalsCount_result clone() {
      return new getLatestArrivalsCount_result(this);
    }

    public long getSuccess() {
      return this.success;
    }

    public getLatestArrivalsCount_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

    /** Returns true if field success is set (has been asigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
    }

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public InventoryServiceException getCex() {
      return this.cex;
    }

    public getLatestArrivalsCount_result setCex(InventoryServiceException cex) {
      this.cex = cex;
      return this;
    }

    public void unsetCex() {
      this.cex = null;
    }

    /** Returns true if field cex is set (has been asigned a value) and false otherwise */
    public boolean isSetCex() {
      return this.cex != null;
    }

    public void setCexIsSet(boolean value) {
      if (!value) {
        this.cex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case CEX:
        if (value == null) {
          unsetCex();
        } else {
          setCex((InventoryServiceException)value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case CEX:
        return getCex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case CEX:
        return isSetCex();
      }
      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 getLatestArrivalsCount_result)
        return this.equals((getLatestArrivalsCount_result)that);
      return false;
    }

    public boolean equals(getLatestArrivalsCount_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_cex = true && this.isSetCex();
      boolean that_present_cex = true && that.isSetCex();
      if (this_present_cex || that_present_cex) {
        if (!(this_present_cex && that_present_cex))
          return false;
        if (!this.cex.equals(that.cex))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getLatestArrivalsCount_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getLatestArrivalsCount_result typedOther = (getLatestArrivalsCount_result)other;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCex()).compareTo(isSetCex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cex, typedOther.cex);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CEX:
              if (field.type == TType.STRUCT) {
                this.cex = new InventoryServiceException();
                this.cex.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetCex()) {
        oprot.writeFieldBegin(CEX_FIELD_DESC);
        this.cex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getLatestArrivalsCount_result(");
      boolean first = true;

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("cex:");
      if (this.cex == null) {
        sb.append("null");
      } else {
        sb.append(this.cex);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class putCategoryObject_args implements TBase<putCategoryObject_args._Fields>, java.io.Serializable, Cloneable, Comparable<putCategoryObject_args>   {
    private static final TStruct STRUCT_DESC = new TStruct("putCategoryObject_args");

    private static final TField OBJECT_FIELD_DESC = new TField("object", TType.STRING, (short)1);

    private byte[] object;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      OBJECT((short)1, "object");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.OBJECT, new FieldMetaData("object", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(putCategoryObject_args.class, metaDataMap);
    }

    public putCategoryObject_args() {
    }

    public putCategoryObject_args(
      byte[] object)
    {
      this();
      this.object = object;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public putCategoryObject_args(putCategoryObject_args other) {
      if (other.isSetObject()) {
        this.object = new byte[other.object.length];
        System.arraycopy(other.object, 0, object, 0, other.object.length);
      }
    }

    public putCategoryObject_args deepCopy() {
      return new putCategoryObject_args(this);
    }

    @Deprecated
    public putCategoryObject_args clone() {
      return new putCategoryObject_args(this);
    }

    public byte[] getObject() {
      return this.object;
    }

    public putCategoryObject_args setObject(byte[] object) {
      this.object = object;
      return this;
    }

    public void unsetObject() {
      this.object = null;
    }

    /** Returns true if field object is set (has been asigned a value) and false otherwise */
    public boolean isSetObject() {
      return this.object != null;
    }

    public void setObjectIsSet(boolean value) {
      if (!value) {
        this.object = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case OBJECT:
        if (value == null) {
          unsetObject();
        } else {
          setObject((byte[])value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case OBJECT:
        return getObject();

      }
      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 OBJECT:
        return isSetObject();
      }
      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 putCategoryObject_args)
        return this.equals((putCategoryObject_args)that);
      return false;
    }

    public boolean equals(putCategoryObject_args that) {
      if (that == null)
        return false;

      boolean this_present_object = true && this.isSetObject();
      boolean that_present_object = true && that.isSetObject();
      if (this_present_object || that_present_object) {
        if (!(this_present_object && that_present_object))
          return false;
        if (!java.util.Arrays.equals(this.object, that.object))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(putCategoryObject_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      putCategoryObject_args typedOther = (putCategoryObject_args)other;

      lastComparison = Boolean.valueOf(isSetObject()).compareTo(isSetObject());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(object, typedOther.object);
      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 OBJECT:
              if (field.type == TType.STRING) {
                this.object = iprot.readBinary();
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (this.object != null) {
        oprot.writeFieldBegin(OBJECT_FIELD_DESC);
        oprot.writeBinary(this.object);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("putCategoryObject_args(");
      boolean first = true;

      sb.append("object:");
      if (this.object == null) {
        sb.append("null");
      } else {
          int __object_size = Math.min(this.object.length, 128);
          for (int i = 0; i < __object_size; i++) {
            if (i != 0) sb.append(" ");
            sb.append(Integer.toHexString(this.object[i]).length() > 1 ? Integer.toHexString(this.object[i]).substring(Integer.toHexString(this.object[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.object[i]).toUpperCase());
          }
          if (this.object.length > 128) sb.append(" ...");
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class putCategoryObject_result implements TBase<putCategoryObject_result._Fields>, java.io.Serializable, Cloneable, Comparable<putCategoryObject_result>   {
    private static final TStruct STRUCT_DESC = new TStruct("putCategoryObject_result");

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);

    private boolean success;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(putCategoryObject_result.class, metaDataMap);
    }

    public putCategoryObject_result() {
    }

    public putCategoryObject_result(
      boolean success)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public putCategoryObject_result(putCategoryObject_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
    }

    public putCategoryObject_result deepCopy() {
      return new putCategoryObject_result(this);
    }

    @Deprecated
    public putCategoryObject_result clone() {
      return new putCategoryObject_result(this);
    }

    public boolean isSuccess() {
      return this.success;
    }

    public putCategoryObject_result setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

    /** Returns true if field success is set (has been asigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
    }

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Boolean(isSuccess());

      }
      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 SUCCESS:
        return isSetSuccess();
      }
      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 putCategoryObject_result)
        return this.equals((putCategoryObject_result)that);
      return false;
    }

    public boolean equals(putCategoryObject_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(putCategoryObject_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      putCategoryObject_result typedOther = (putCategoryObject_result)other;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      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 SUCCESS:
              if (field.type == TType.BOOL) {
                this.success = iprot.readBool();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("putCategoryObject_result(");
      boolean first = true;

      sb.append("success:");
      sb.append(this.success);
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getCategoryObject_args implements TBase<getCategoryObject_args._Fields>, java.io.Serializable, Cloneable, Comparable<getCategoryObject_args>   {
    private static final TStruct STRUCT_DESC = new TStruct("getCategoryObject_args");



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
;

      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;
      }
    }
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getCategoryObject_args.class, metaDataMap);
    }

    public getCategoryObject_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCategoryObject_args(getCategoryObject_args other) {
    }

    public getCategoryObject_args deepCopy() {
      return new getCategoryObject_args(this);
    }

    @Deprecated
    public getCategoryObject_args clone() {
      return new getCategoryObject_args(this);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      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 getCategoryObject_args)
        return this.equals((getCategoryObject_args)that);
      return false;
    }

    public boolean equals(getCategoryObject_args that) {
      if (that == null)
        return false;

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getCategoryObject_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getCategoryObject_args typedOther = (getCategoryObject_args)other;

      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) {
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getCategoryObject_args(");
      boolean first = true;

      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

  public static class getCategoryObject_result implements TBase<getCategoryObject_result._Fields>, java.io.Serializable, Cloneable, Comparable<getCategoryObject_result>   {
    private static final TStruct STRUCT_DESC = new TStruct("getCategoryObject_result");

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRING, (short)0);

    private byte[] success;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
    }});

    static {
      FieldMetaData.addStructMetaDataMap(getCategoryObject_result.class, metaDataMap);
    }

    public getCategoryObject_result() {
    }

    public getCategoryObject_result(
      byte[] success)
    {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCategoryObject_result(getCategoryObject_result other) {
      if (other.isSetSuccess()) {
        this.success = new byte[other.success.length];
        System.arraycopy(other.success, 0, success, 0, other.success.length);
      }
    }

    public getCategoryObject_result deepCopy() {
      return new getCategoryObject_result(this);
    }

    @Deprecated
    public getCategoryObject_result clone() {
      return new getCategoryObject_result(this);
    }

    public byte[] getSuccess() {
      return this.success;
    }

    public getCategoryObject_result setSuccess(byte[] success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been asigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((byte[])value);
        }
        break;

      }
    }

    public void setFieldValue(int fieldID, Object value) {
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      }
      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 SUCCESS:
        return isSetSuccess();
      }
      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 getCategoryObject_result)
        return this.equals((getCategoryObject_result)that);
      return false;
    }

    public boolean equals(getCategoryObject_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!java.util.Arrays.equals(this.success, that.success))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    public int compareTo(getCategoryObject_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;
      getCategoryObject_result typedOther = (getCategoryObject_result)other;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      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 SUCCESS:
              if (field.type == TType.STRING) {
                this.success = iprot.readBinary();
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBinary(this.success);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getCategoryObject_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
          int __success_size = Math.min(this.success.length, 128);
          for (int i = 0; i < __success_size; i++) {
            if (i != 0) sb.append(" ");
            sb.append(Integer.toHexString(this.success[i]).length() > 1 ? Integer.toHexString(this.success[i]).substring(Integer.toHexString(this.success[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.success[i]).toUpperCase());
          }
          if (this.success.length > 128) sb.append(" ...");
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws TException {
      // check for required fields
    }

  }

}