All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rbkmoney.bender.BenderSrv Maven / Gradle / Ivy

Go to download

Generates jar artifact containing compiled thrift classes based on generated thrift IDL files

There is a newer version: 1.17-75be941
Show newest version
/**
 * Autogenerated by Thrift Compiler (1.0.0-dev)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.rbkmoney.bender;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-08-05")
public class BenderSrv {

  public interface Iface {

    public GenerationResult generateID(String external_id, GenerationSchema schema, com.rbkmoney.msgpack.Value context) throws org.apache.thrift.TException;

    public GetInternalIDResult getInternalID(String external_id) throws InternalIDNotFound, org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void generateID(String external_id, GenerationSchema schema, com.rbkmoney.msgpack.Value context, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void getInternalID(String external_id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public GenerationResult generateID(String external_id, GenerationSchema schema, com.rbkmoney.msgpack.Value context) throws org.apache.thrift.TException
    {
      sendGenerateID(external_id, schema, context);
      return recvGenerateID();
    }

    public void sendGenerateID(String external_id, GenerationSchema schema, com.rbkmoney.msgpack.Value context) throws org.apache.thrift.TException
    {
      GenerateID_args args = new GenerateID_args();
      args.setExternalId(external_id);
      args.setSchema(schema);
      args.setContext(context);
      sendBase("GenerateID", args);
    }

    public GenerationResult recvGenerateID() throws org.apache.thrift.TException
    {
      GenerateID_result result = new GenerateID_result();
      receiveBase(result, "GenerateID");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GenerateID failed: unknown result");
    }

    public GetInternalIDResult getInternalID(String external_id) throws InternalIDNotFound, org.apache.thrift.TException
    {
      sendGetInternalID(external_id);
      return recvGetInternalID();
    }

    public void sendGetInternalID(String external_id) throws org.apache.thrift.TException
    {
      GetInternalID_args args = new GetInternalID_args();
      args.setExternalId(external_id);
      sendBase("GetInternalID", args);
    }

    public GetInternalIDResult recvGetInternalID() throws InternalIDNotFound, org.apache.thrift.TException
    {
      GetInternalID_result result = new GetInternalID_result();
      receiveBase(result, "GetInternalID");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GetInternalID failed: unknown result");
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void generateID(String external_id, GenerationSchema schema, com.rbkmoney.msgpack.Value context, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      GenerateID_call method_call = new GenerateID_call(external_id, schema, context, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class GenerateID_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String external_id;
      private GenerationSchema schema;
      private com.rbkmoney.msgpack.Value context;
      public GenerateID_call(String external_id, GenerationSchema schema, com.rbkmoney.msgpack.Value context, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.external_id = external_id;
        this.schema = schema;
        this.context = context;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("GenerateID", org.apache.thrift.protocol.TMessageType.CALL, 0));
        GenerateID_args args = new GenerateID_args();
        args.setExternalId(external_id);
        args.setSchema(schema);
        args.setContext(context);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public GenerationResult getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recvGenerateID();
      }
    }

    public void getInternalID(String external_id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      GetInternalID_call method_call = new GetInternalID_call(external_id, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class GetInternalID_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String external_id;
      public GetInternalID_call(String external_id, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.external_id = external_id;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("GetInternalID", org.apache.thrift.protocol.TMessageType.CALL, 0));
        GetInternalID_args args = new GetInternalID_args();
        args.setExternalId(external_id);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public GetInternalIDResult getResult() throws InternalIDNotFound, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recvGetInternalID();
      }
    }

  }

  public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap>()));
    }

    protected Processor(I iface, Map> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static  Map> getProcessMap(Map> processMap) {
      processMap.put("GenerateID", new GenerateID());
      processMap.put("GetInternalID", new GetInternalID());
      return processMap;
    }

    public static class GenerateID extends org.apache.thrift.ProcessFunction {
      public GenerateID() {
        super("GenerateID");
      }

      public GenerateID_args getEmptyArgsInstance() {
        return new GenerateID_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public GenerateID_result getResult(I iface, GenerateID_args args) throws org.apache.thrift.TException {
        GenerateID_result result = new GenerateID_result();
        result.success = iface.generateID(args.external_id, args.schema, args.context);
        return result;
      }
    }

    public static class GetInternalID extends org.apache.thrift.ProcessFunction {
      public GetInternalID() {
        super("GetInternalID");
      }

      public GetInternalID_args getEmptyArgsInstance() {
        return new GetInternalID_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public GetInternalID_result getResult(I iface, GetInternalID_args args) throws org.apache.thrift.TException {
        GetInternalID_result result = new GetInternalID_result();
        try {
          result.success = iface.getInternalID(args.external_id);
        } catch (InternalIDNotFound ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

  }

  public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new HashMap>()));
    }

    protected AsyncProcessor(I iface, Map> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static  Map> getProcessMap(Map> processMap) {
      processMap.put("GenerateID", new GenerateID());
      processMap.put("GetInternalID", new GetInternalID());
      return processMap;
    }

    public static class GenerateID extends org.apache.thrift.AsyncProcessFunction {
      public GenerateID() {
        super("GenerateID");
      }

      public GenerateID_args getEmptyArgsInstance() {
        return new GenerateID_args();
      }

      public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback() { 
          public void onComplete(com.rbkmoney.bender.GenerationResult o) {
            GenerateID_result result = new GenerateID_result();
            result.success = o;
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
            } catch (org.apache.thrift.transport.TTransportException e) {
              LOGGER.error("TTransportException writing to internal frame buffer", e);
              fb.close();
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
              onError(e);
            }
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TSerializable msg;
            GenerateID_result result = new GenerateID_result();
            if (e instanceof org.apache.thrift.transport.TTransportException) {
              LOGGER.error("TTransportException inside handler", e);
              fb.close();
              return;
            } else if (e instanceof org.apache.thrift.TApplicationException) {
              LOGGER.error("TApplicationException inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TApplicationException)e;
            } else {
              LOGGER.error("Exception inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
              fb.close();
            }
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, GenerateID_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
        iface.generateID(args.external_id, args.schema, args.context,resultHandler);
      }
    }

    public static class GetInternalID extends org.apache.thrift.AsyncProcessFunction {
      public GetInternalID() {
        super("GetInternalID");
      }

      public GetInternalID_args getEmptyArgsInstance() {
        return new GetInternalID_args();
      }

      public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback() { 
          public void onComplete(com.rbkmoney.bender.GetInternalIDResult o) {
            GetInternalID_result result = new GetInternalID_result();
            result.success = o;
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
            } catch (org.apache.thrift.transport.TTransportException e) {
              LOGGER.error("TTransportException writing to internal frame buffer", e);
              fb.close();
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
              onError(e);
            }
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TSerializable msg;
            GetInternalID_result result = new GetInternalID_result();
            if (e instanceof InternalIDNotFound) {
              result.ex1 = (InternalIDNotFound) e;
              result.setEx1IsSet(true);
              msg = result;
            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
              LOGGER.error("TTransportException inside handler", e);
              fb.close();
              return;
            } else if (e instanceof org.apache.thrift.TApplicationException) {
              LOGGER.error("TApplicationException inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TApplicationException)e;
            } else {
              LOGGER.error("Exception inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
              fb.close();
            }
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, GetInternalID_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
        iface.getInternalID(args.external_id,resultHandler);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField EXTERNAL_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("external_id", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("schema", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField CONTEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("context", org.apache.thrift.protocol.TType.STRUCT, (short)3);

    private static final SchemeFactory STANDARD_SCHEME_FACTORY = new GenerateID_argsStandardSchemeFactory();
    private static final SchemeFactory TUPLE_SCHEME_FACTORY = new GenerateID_argsTupleSchemeFactory();

    public String external_id; // required
    public GenerationSchema schema; // required
    public com.rbkmoney.msgpack.Value context; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      EXTERNAL_ID((short)1, "external_id"),
      SCHEMA((short)2, "schema"),
      CONTEXT((short)3, "context");

      private static final Map byName = new HashMap();

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

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // EXTERNAL_ID
            return EXTERNAL_ID;
          case 2: // SCHEMA
            return SCHEMA;
          case 3: // CONTEXT
            return CONTEXT;
          default:
            return null;
        }
      }

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

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

      private final short _thriftId;
      private final String _fieldName;

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

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.EXTERNAL_ID, new org.apache.thrift.meta_data.FieldMetaData("external_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.SCHEMA, new org.apache.thrift.meta_data.FieldMetaData("schema", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GenerationSchema.class)));
      tmpMap.put(_Fields.CONTEXT, new org.apache.thrift.meta_data.FieldMetaData("context", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.rbkmoney.msgpack.Value.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GenerateID_args.class, metaDataMap);
    }

    public GenerateID_args() {
    }

    public GenerateID_args(
      String external_id,
      GenerationSchema schema,
      com.rbkmoney.msgpack.Value context)
    {
      this();
      this.external_id = external_id;
      this.schema = schema;
      this.context = context;
    }

    /**
     * Performs a deep copy on other.
     */
    public GenerateID_args(GenerateID_args other) {
      if (other.isSetExternalId()) {
        this.external_id = other.external_id;
      }
      if (other.isSetSchema()) {
        this.schema = new GenerationSchema(other.schema);
      }
      if (other.isSetContext()) {
        this.context = new com.rbkmoney.msgpack.Value(other.context);
      }
    }

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

    @Override
    public void clear() {
      this.external_id = null;
      this.schema = null;
      this.context = null;
    }

    public String getExternalId() {
      return this.external_id;
    }

    public GenerateID_args setExternalId(String external_id) {
      this.external_id = external_id;
      return this;
    }

    public void unsetExternalId() {
      this.external_id = null;
    }

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

    public void setExternalIdIsSet(boolean value) {
      if (!value) {
        this.external_id = null;
      }
    }

    public GenerationSchema getSchema() {
      return this.schema;
    }

    public GenerateID_args setSchema(GenerationSchema schema) {
      this.schema = schema;
      return this;
    }

    public void unsetSchema() {
      this.schema = null;
    }

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

    public void setSchemaIsSet(boolean value) {
      if (!value) {
        this.schema = null;
      }
    }

    public com.rbkmoney.msgpack.Value getContext() {
      return this.context;
    }

    public GenerateID_args setContext(com.rbkmoney.msgpack.Value context) {
      this.context = context;
      return this;
    }

    public void unsetContext() {
      this.context = null;
    }

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

    public void setContextIsSet(boolean value) {
      if (!value) {
        this.context = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case EXTERNAL_ID:
        if (value == null) {
          unsetExternalId();
        } else {
          setExternalId((String)value);
        }
        break;

      case SCHEMA:
        if (value == null) {
          unsetSchema();
        } else {
          setSchema((GenerationSchema)value);
        }
        break;

      case CONTEXT:
        if (value == null) {
          unsetContext();
        } else {
          setContext((com.rbkmoney.msgpack.Value)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case EXTERNAL_ID:
        return getExternalId();

      case SCHEMA:
        return getSchema();

      case CONTEXT:
        return getContext();

      }
      throw new IllegalStateException();
    }

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

      switch (field) {
      case EXTERNAL_ID:
        return isSetExternalId();
      case SCHEMA:
        return isSetSchema();
      case CONTEXT:
        return isSetContext();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_external_id = true && this.isSetExternalId();
      boolean that_present_external_id = true && that.isSetExternalId();
      if (this_present_external_id || that_present_external_id) {
        if (!(this_present_external_id && that_present_external_id))
          return false;
        if (!this.external_id.equals(that.external_id))
          return false;
      }

      boolean this_present_schema = true && this.isSetSchema();
      boolean that_present_schema = true && that.isSetSchema();
      if (this_present_schema || that_present_schema) {
        if (!(this_present_schema && that_present_schema))
          return false;
        if (!this.schema.equals(that.schema))
          return false;
      }

      boolean this_present_context = true && this.isSetContext();
      boolean that_present_context = true && that.isSetContext();
      if (this_present_context || that_present_context) {
        if (!(this_present_context && that_present_context))
          return false;
        if (!this.context.equals(that.context))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      int hashCode = 1;

      hashCode = hashCode * 8191 + ((isSetExternalId()) ? 131071 : 524287);
      if (isSetExternalId())
        hashCode = hashCode * 8191 + external_id.hashCode();

      hashCode = hashCode * 8191 + ((isSetSchema()) ? 131071 : 524287);
      if (isSetSchema())
        hashCode = hashCode * 8191 + schema.hashCode();

      hashCode = hashCode * 8191 + ((isSetContext()) ? 131071 : 524287);
      if (isSetContext())
        hashCode = hashCode * 8191 + context.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetExternalId()).compareTo(other.isSetExternalId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetExternalId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.external_id, other.external_id);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetSchema()).compareTo(other.isSetSchema());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSchema()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schema, other.schema);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetContext()).compareTo(other.isSetContext());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetContext()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.context, other.context);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

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

    public _Fields[] getFields() {
      return _Fields.values();
    }

    public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
      return metaDataMap;
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      scheme(iprot).read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      scheme(oprot).write(oprot, this);
    }

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

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

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

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

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class GenerateID_argsStandardSchemeFactory implements SchemeFactory {
      public GenerateID_argsStandardScheme getScheme() {
        return new GenerateID_argsStandardScheme();
      }
    }

    private static class GenerateID_argsStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, GenerateID_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // EXTERNAL_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.external_id = iprot.readString();
                struct.setExternalIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // SCHEMA
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.schema = new GenerationSchema();
                struct.schema.read(iprot);
                struct.setSchemaIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // CONTEXT
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.context = new com.rbkmoney.msgpack.Value();
                struct.context.read(iprot);
                struct.setContextIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.external_id != null) {
          oprot.writeFieldBegin(EXTERNAL_ID_FIELD_DESC);
          oprot.writeString(struct.external_id);
          oprot.writeFieldEnd();
        }
        if (struct.schema != null) {
          oprot.writeFieldBegin(SCHEMA_FIELD_DESC);
          struct.schema.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.context != null) {
          oprot.writeFieldBegin(CONTEXT_FIELD_DESC);
          struct.context.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class GenerateID_argsTupleSchemeFactory implements SchemeFactory {
      public GenerateID_argsTupleScheme getScheme() {
        return new GenerateID_argsTupleScheme();
      }
    }

    private static class GenerateID_argsTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, GenerateID_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetExternalId()) {
          optionals.set(0);
        }
        if (struct.isSetSchema()) {
          optionals.set(1);
        }
        if (struct.isSetContext()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetExternalId()) {
          oprot.writeString(struct.external_id);
        }
        if (struct.isSetSchema()) {
          struct.schema.write(oprot);
        }
        if (struct.isSetContext()) {
          struct.context.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, GenerateID_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.external_id = iprot.readString();
          struct.setExternalIdIsSet(true);
        }
        if (incoming.get(1)) {
          struct.schema = new GenerationSchema();
          struct.schema.read(iprot);
          struct.setSchemaIsSet(true);
        }
        if (incoming.get(2)) {
          struct.context = new com.rbkmoney.msgpack.Value();
          struct.context.read(iprot);
          struct.setContextIsSet(true);
        }
      }
    }

    private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
      return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
    }
  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);

    private static final SchemeFactory STANDARD_SCHEME_FACTORY = new GenerateID_resultStandardSchemeFactory();
    private static final SchemeFactory TUPLE_SCHEME_FACTORY = new GenerateID_resultTupleSchemeFactory();

    public GenerationResult success; // required

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

      private static final Map byName = new HashMap();

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

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

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

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

      private final short _thriftId;
      private final String _fieldName;

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

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GenerationResult.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GenerateID_result.class, metaDataMap);
    }

    public GenerateID_result() {
    }

    public GenerateID_result(
      GenerationResult success)
    {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on other.
     */
    public GenerateID_result(GenerateID_result other) {
      if (other.isSetSuccess()) {
        this.success = new GenerationResult(other.success);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
    }

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

    public GenerateID_result setSuccess(GenerationResult success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned 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((GenerationResult)value);
        }
        break;

      }
    }

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

      }
      throw new IllegalStateException();
    }

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

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      }
      throw new IllegalStateException();
    }

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

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

      return true;
    }

    @Override
    public int hashCode() {
      int hashCode = 1;

      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
      if (isSetSuccess())
        hashCode = hashCode * 8191 + success.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

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

    public _Fields[] getFields() {
      return _Fields.values();
    }

    public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
      return metaDataMap;
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      scheme(iprot).read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      scheme(oprot).write(oprot, this);
      }

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

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

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (success != null) {
        success.validate();
      }
    }

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

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class GenerateID_resultStandardSchemeFactory implements SchemeFactory {
      public GenerateID_resultStandardScheme getScheme() {
        return new GenerateID_resultStandardScheme();
      }
    }

    private static class GenerateID_resultStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, GenerateID_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.success = new GenerationResult();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class GenerateID_resultTupleSchemeFactory implements SchemeFactory {
      public GenerateID_resultTupleScheme getScheme() {
        return new GenerateID_resultTupleScheme();
      }
    }

    private static class GenerateID_resultTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, GenerateID_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, GenerateID_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = new GenerationResult();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
      }
    }

    private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
      return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
    }
  }

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

    private static final org.apache.thrift.protocol.TField EXTERNAL_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("external_id", org.apache.thrift.protocol.TType.STRING, (short)1);

    private static final SchemeFactory STANDARD_SCHEME_FACTORY = new GetInternalID_argsStandardSchemeFactory();
    private static final SchemeFactory TUPLE_SCHEME_FACTORY = new GetInternalID_argsTupleSchemeFactory();

    public String external_id; // required

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

      private static final Map byName = new HashMap();

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

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // EXTERNAL_ID
            return EXTERNAL_ID;
          default:
            return null;
        }
      }

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

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

      private final short _thriftId;
      private final String _fieldName;

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

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.EXTERNAL_ID, new org.apache.thrift.meta_data.FieldMetaData("external_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetInternalID_args.class, metaDataMap);
    }

    public GetInternalID_args() {
    }

    public GetInternalID_args(
      String external_id)
    {
      this();
      this.external_id = external_id;
    }

    /**
     * Performs a deep copy on other.
     */
    public GetInternalID_args(GetInternalID_args other) {
      if (other.isSetExternalId()) {
        this.external_id = other.external_id;
      }
    }

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

    @Override
    public void clear() {
      this.external_id = null;
    }

    public String getExternalId() {
      return this.external_id;
    }

    public GetInternalID_args setExternalId(String external_id) {
      this.external_id = external_id;
      return this;
    }

    public void unsetExternalId() {
      this.external_id = null;
    }

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

    public void setExternalIdIsSet(boolean value) {
      if (!value) {
        this.external_id = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case EXTERNAL_ID:
        if (value == null) {
          unsetExternalId();
        } else {
          setExternalId((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case EXTERNAL_ID:
        return getExternalId();

      }
      throw new IllegalStateException();
    }

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

      switch (field) {
      case EXTERNAL_ID:
        return isSetExternalId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_external_id = true && this.isSetExternalId();
      boolean that_present_external_id = true && that.isSetExternalId();
      if (this_present_external_id || that_present_external_id) {
        if (!(this_present_external_id && that_present_external_id))
          return false;
        if (!this.external_id.equals(that.external_id))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      int hashCode = 1;

      hashCode = hashCode * 8191 + ((isSetExternalId()) ? 131071 : 524287);
      if (isSetExternalId())
        hashCode = hashCode * 8191 + external_id.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetExternalId()).compareTo(other.isSetExternalId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetExternalId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.external_id, other.external_id);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

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

    public _Fields[] getFields() {
      return _Fields.values();
    }

    public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
      return metaDataMap;
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      scheme(iprot).read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      scheme(oprot).write(oprot, this);
    }

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

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

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

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

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class GetInternalID_argsStandardSchemeFactory implements SchemeFactory {
      public GetInternalID_argsStandardScheme getScheme() {
        return new GetInternalID_argsStandardScheme();
      }
    }

    private static class GetInternalID_argsStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, GetInternalID_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // EXTERNAL_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.external_id = iprot.readString();
                struct.setExternalIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.external_id != null) {
          oprot.writeFieldBegin(EXTERNAL_ID_FIELD_DESC);
          oprot.writeString(struct.external_id);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class GetInternalID_argsTupleSchemeFactory implements SchemeFactory {
      public GetInternalID_argsTupleScheme getScheme() {
        return new GetInternalID_argsTupleScheme();
      }
    }

    private static class GetInternalID_argsTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, GetInternalID_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetExternalId()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetExternalId()) {
          oprot.writeString(struct.external_id);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, GetInternalID_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.external_id = iprot.readString();
          struct.setExternalIdIsSet(true);
        }
      }
    }

    private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
      return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
    }
  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final SchemeFactory STANDARD_SCHEME_FACTORY = new GetInternalID_resultStandardSchemeFactory();
    private static final SchemeFactory TUPLE_SCHEME_FACTORY = new GetInternalID_resultTupleSchemeFactory();

    public GetInternalIDResult success; // required
    public InternalIDNotFound ex1; // required

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

      private static final Map byName = new HashMap();

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

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          case 1: // EX1
            return EX1;
          default:
            return null;
        }
      }

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

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

      private final short _thriftId;
      private final String _fieldName;

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

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GetInternalIDResult.class)));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InternalIDNotFound.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetInternalID_result.class, metaDataMap);
    }

    public GetInternalID_result() {
    }

    public GetInternalID_result(
      GetInternalIDResult success,
      InternalIDNotFound ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on other.
     */
    public GetInternalID_result(GetInternalID_result other) {
      if (other.isSetSuccess()) {
        this.success = new GetInternalIDResult(other.success);
      }
      if (other.isSetEx1()) {
        this.ex1 = new InternalIDNotFound(other.ex1);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.ex1 = null;
    }

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

    public GetInternalID_result setSuccess(GetInternalIDResult success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public InternalIDNotFound getEx1() {
      return this.ex1;
    }

    public GetInternalID_result setEx1(InternalIDNotFound ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

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

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((InternalIDNotFound)value);
        }
        break;

      }
    }

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

      case EX1:
        return getEx1();

      }
      throw new IllegalStateException();
    }

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

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      case EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(GetInternalID_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      int hashCode = 1;

      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
      if (isSetSuccess())
        hashCode = hashCode * 8191 + success.hashCode();

      hashCode = hashCode * 8191 + ((isSetEx1()) ? 131071 : 524287);
      if (isSetEx1())
        hashCode = hashCode * 8191 + ex1.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

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

    public _Fields[] getFields() {
      return _Fields.values();
    }

    public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
      return metaDataMap;
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      scheme(iprot).read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      scheme(oprot).write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("GetInternalID_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (success != null) {
        success.validate();
      }
    }

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

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class GetInternalID_resultStandardSchemeFactory implements SchemeFactory {
      public GetInternalID_resultStandardScheme getScheme() {
        return new GetInternalID_resultStandardScheme();
      }
    }

    private static class GetInternalID_resultStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, GetInternalID_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.success = new GetInternalIDResult();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new InternalIDNotFound();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class GetInternalID_resultTupleSchemeFactory implements SchemeFactory {
      public GetInternalID_resultTupleScheme getScheme() {
        return new GetInternalID_resultTupleScheme();
      }
    }

    private static class GetInternalID_resultTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, GetInternalID_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetEx1()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, GetInternalID_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new GetInternalIDResult();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new InternalIDNotFound();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

    private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
      return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
    }
  }

}