/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package com.flaptor.indextank.rpc; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.thrift.*; import org.apache.thrift.async.*; import org.apache.thrift.meta_data.*; import org.apache.thrift.transport.*; import org.apache.thrift.protocol.*; @SuppressWarnings("all") public class FrontendManager { public interface Iface { public List<IndexInfo> list_indexes() throws TException; public void save_insight(String index_code, String insight_code, String json_value) throws TException; } public interface AsyncIface { public void list_indexes(AsyncMethodCallback<AsyncClient.list_indexes_call> resultHandler) throws TException; public void save_insight(String index_code, String insight_code, String json_value, AsyncMethodCallback<AsyncClient.save_insight_call> resultHandler) throws TException; } public static class Client implements TServiceClient, Iface { public static class Factory implements TServiceClientFactory<Client> { public Factory() {} public Client getClient(TProtocol prot) { return new Client(prot); } public Client getClient(TProtocol iprot, TProtocol oprot) { return new Client(iprot, oprot); } } 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 List<IndexInfo> list_indexes() throws TException { send_list_indexes(); return recv_list_indexes(); } public void send_list_indexes() throws TException { oprot_.writeMessageBegin(new TMessage("list_indexes", TMessageType.CALL, ++seqid_)); list_indexes_args args = new list_indexes_args(); args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public List<IndexInfo> recv_list_indexes() throws TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } if (msg.seqid != seqid_) { throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "list_indexes failed: out of sequence response"); } list_indexes_result result = new list_indexes_result(); result.read(iprot_); iprot_.readMessageEnd(); if (result.is_set_success()) { return result.success; } throw new TApplicationException(TApplicationException.MISSING_RESULT, "list_indexes failed: unknown result"); } public void save_insight(String index_code, String insight_code, String json_value) throws TException { send_save_insight(index_code, insight_code, json_value); recv_save_insight(); } public void send_save_insight(String index_code, String insight_code, String json_value) throws TException { oprot_.writeMessageBegin(new TMessage("save_insight", TMessageType.CALL, ++seqid_)); save_insight_args args = new save_insight_args(); args.set_index_code(index_code); args.set_insight_code(insight_code); args.set_json_value(json_value); args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public void recv_save_insight() throws TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } if (msg.seqid != seqid_) { throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "save_insight failed: out of sequence response"); } save_insight_result result = new save_insight_result(); result.read(iprot_); iprot_.readMessageEnd(); return; } } public static class AsyncClient extends TAsyncClient implements AsyncIface { public static class Factory implements TAsyncClientFactory<AsyncClient> { private TAsyncClientManager clientManager; private TProtocolFactory protocolFactory; public Factory(TAsyncClientManager clientManager, TProtocolFactory protocolFactory) { this.clientManager = clientManager; this.protocolFactory = protocolFactory; } public AsyncClient getAsyncClient(TNonblockingTransport transport) { return new AsyncClient(protocolFactory, clientManager, transport); } } public AsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager clientManager, TNonblockingTransport transport) { super(protocolFactory, clientManager, transport); } public void list_indexes(AsyncMethodCallback<list_indexes_call> resultHandler) throws TException { checkReady(); list_indexes_call method_call = new list_indexes_call(resultHandler, this, protocolFactory, transport); manager.call(method_call); } public static class list_indexes_call extends TAsyncMethodCall { public list_indexes_call(AsyncMethodCallback<list_indexes_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { super(client, protocolFactory, transport, resultHandler, false); } public void write_args(TProtocol prot) throws TException { prot.writeMessageBegin(new TMessage("list_indexes", TMessageType.CALL, 0)); list_indexes_args args = new list_indexes_args(); args.write(prot); prot.writeMessageEnd(); } public List<IndexInfo> getResult() throws TException { if (getState() != State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_list_indexes(); } } public void save_insight(String index_code, String insight_code, String json_value, AsyncMethodCallback<save_insight_call> resultHandler) throws TException { checkReady(); save_insight_call method_call = new save_insight_call(index_code, insight_code, json_value, resultHandler, this, protocolFactory, transport); manager.call(method_call); } public static class save_insight_call extends TAsyncMethodCall { private String index_code; private String insight_code; private String json_value; public save_insight_call(String index_code, String insight_code, String json_value, AsyncMethodCallback<save_insight_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { super(client, protocolFactory, transport, resultHandler, false); this.index_code = index_code; this.insight_code = insight_code; this.json_value = json_value; } public void write_args(TProtocol prot) throws TException { prot.writeMessageBegin(new TMessage("save_insight", TMessageType.CALL, 0)); save_insight_args args = new save_insight_args(); args.set_index_code(index_code); args.set_insight_code(insight_code); args.set_json_value(json_value); args.write(prot); prot.writeMessageEnd(); } public void getResult() throws TException { if (getState() != State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); (new Client(prot)).recv_save_insight(); } } } public static class Processor implements TProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); public Processor(Iface iface) { iface_ = iface; processMap_.put("list_indexes", new list_indexes()); processMap_.put("save_insight", new save_insight()); } 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 list_indexes implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { list_indexes_args args = new list_indexes_args(); try { args.read(iprot); } catch (TProtocolException e) { iprot.readMessageEnd(); TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); oprot.writeMessageBegin(new TMessage("list_indexes", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } iprot.readMessageEnd(); list_indexes_result result = new list_indexes_result(); result.success = iface_.list_indexes(); oprot.writeMessageBegin(new TMessage("list_indexes", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } private class save_insight implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { save_insight_args args = new save_insight_args(); try { args.read(iprot); } catch (TProtocolException e) { iprot.readMessageEnd(); TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); oprot.writeMessageBegin(new TMessage("save_insight", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } iprot.readMessageEnd(); save_insight_result result = new save_insight_result(); iface_.save_insight(args.index_code, args.insight_code, args.json_value); oprot.writeMessageBegin(new TMessage("save_insight", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } } public static class list_indexes_args implements TBase<list_indexes_args, list_indexes_args._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("list_indexes_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<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { 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; } } public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(list_indexes_args.class, metaDataMap); } public list_indexes_args() { } /** * Performs a deep copy on <i>other</i>. */ public list_indexes_args(list_indexes_args other) { } public list_indexes_args deepCopy() { return new list_indexes_args(this); } @Override public void clear() { } public void setFieldValue(_Fields field, Object value) { switch (field) { } } public Object getFieldValue(_Fields field) { switch (field) { } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof list_indexes_args) return this.equals((list_indexes_args)that); return false; } public boolean equals(list_indexes_args that) { if (that == null) return false; return true; } @Override public int hashCode() { return 0; } public int compareTo(list_indexes_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; list_indexes_args typedOther = (list_indexes_args)other; return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method 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("list_indexes_args("); boolean first = true; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class list_indexes_result implements TBase<list_indexes_result, list_indexes_result._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("list_indexes_result"); private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0); private List<IndexInfo> 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<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 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, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, new ListMetaData(TType.LIST, new StructMetaData(TType.STRUCT, IndexInfo.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(list_indexes_result.class, metaDataMap); } public list_indexes_result() { } public list_indexes_result( List<IndexInfo> success) { this(); this.success = success; } /** * Performs a deep copy on <i>other</i>. */ public list_indexes_result(list_indexes_result other) { if (other.is_set_success()) { List<IndexInfo> __this__success = new ArrayList<IndexInfo>(); for (IndexInfo other_element : other.success) { __this__success.add(new IndexInfo(other_element)); } this.success = __this__success; } } public list_indexes_result deepCopy() { return new list_indexes_result(this); } @Override public void clear() { this.success = null; } public int get_success_size() { return (this.success == null) ? 0 : this.success.size(); } public java.util.Iterator<IndexInfo> get_success_iterator() { return (this.success == null) ? null : this.success.iterator(); } public void add_to_success(IndexInfo elem) { if (this.success == null) { this.success = new ArrayList<IndexInfo>(); } this.success.add(elem); } public List<IndexInfo> get_success() { return this.success; } public list_indexes_result set_success(List<IndexInfo> success) { this.success = success; return this; } public void unset_success() { this.success = null; } /** Returns true if field success is set (has been asigned a value) and false otherwise */ public boolean is_set_success() { return this.success != null; } public void set_success_isSet(boolean value) { if (!value) { this.success = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: if (value == null) { unset_success(); } else { set_success((List<IndexInfo>)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return get_success(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SUCCESS: return is_set_success(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof list_indexes_result) return this.equals((list_indexes_result)that); return false; } public boolean equals(list_indexes_result that) { if (that == null) return false; boolean this_present_success = true && this.is_set_success(); boolean that_present_success = true && that.is_set_success(); 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() { return 0; } public int compareTo(list_indexes_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; list_indexes_result typedOther = (list_indexes_result)other; lastComparison = Boolean.valueOf(is_set_success()).compareTo(typedOther.is_set_success()); if (lastComparison != 0) { return lastComparison; } if (is_set_success()) { lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 0: // SUCCESS if (field.type == TType.LIST) { { TList _list165 = iprot.readListBegin(); this.success = new ArrayList<IndexInfo>(_list165.size); for (int _i166 = 0; _i166 < _list165.size; ++_i166) { IndexInfo _elem167; _elem167 = new IndexInfo(); _elem167.read(iprot); this.success.add(_elem167); } iprot.readListEnd(); } } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(STRUCT_DESC); if (this.is_set_success()) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRUCT, this.success.size())); for (IndexInfo _iter168 : this.success) { _iter168.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("list_indexes_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 TException { // check for required fields } } public static class save_insight_args implements TBase<save_insight_args, save_insight_args._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("save_insight_args"); private static final TField INDEX_CODE_FIELD_DESC = new TField("index_code", TType.STRING, (short)1); private static final TField INSIGHT_CODE_FIELD_DESC = new TField("insight_code", TType.STRING, (short)2); private static final TField JSON_VALUE_FIELD_DESC = new TField("json_value", TType.STRING, (short)3); private String index_code; private String insight_code; private String json_value; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { INDEX_CODE((short)1, "index_code"), INSIGHT_CODE((short)2, "insight_code"), JSON_VALUE((short)3, "json_value"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // INDEX_CODE return INDEX_CODE; case 2: // INSIGHT_CODE return INSIGHT_CODE; case 3: // JSON_VALUE return JSON_VALUE; 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, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.INDEX_CODE, new FieldMetaData("index_code", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMap.put(_Fields.INSIGHT_CODE, new FieldMetaData("insight_code", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMap.put(_Fields.JSON_VALUE, new FieldMetaData("json_value", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(save_insight_args.class, metaDataMap); } public save_insight_args() { } public save_insight_args( String index_code, String insight_code, String json_value) { this(); this.index_code = index_code; this.insight_code = insight_code; this.json_value = json_value; } /** * Performs a deep copy on <i>other</i>. */ public save_insight_args(save_insight_args other) { if (other.is_set_index_code()) { this.index_code = other.index_code; } if (other.is_set_insight_code()) { this.insight_code = other.insight_code; } if (other.is_set_json_value()) { this.json_value = other.json_value; } } public save_insight_args deepCopy() { return new save_insight_args(this); } @Override public void clear() { this.index_code = null; this.insight_code = null; this.json_value = null; } public String get_index_code() { return this.index_code; } public save_insight_args set_index_code(String index_code) { this.index_code = index_code; return this; } public void unset_index_code() { this.index_code = null; } /** Returns true if field index_code is set (has been asigned a value) and false otherwise */ public boolean is_set_index_code() { return this.index_code != null; } public void set_index_code_isSet(boolean value) { if (!value) { this.index_code = null; } } public String get_insight_code() { return this.insight_code; } public save_insight_args set_insight_code(String insight_code) { this.insight_code = insight_code; return this; } public void unset_insight_code() { this.insight_code = null; } /** Returns true if field insight_code is set (has been asigned a value) and false otherwise */ public boolean is_set_insight_code() { return this.insight_code != null; } public void set_insight_code_isSet(boolean value) { if (!value) { this.insight_code = null; } } public String get_json_value() { return this.json_value; } public save_insight_args set_json_value(String json_value) { this.json_value = json_value; return this; } public void unset_json_value() { this.json_value = null; } /** Returns true if field json_value is set (has been asigned a value) and false otherwise */ public boolean is_set_json_value() { return this.json_value != null; } public void set_json_value_isSet(boolean value) { if (!value) { this.json_value = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case INDEX_CODE: if (value == null) { unset_index_code(); } else { set_index_code((String)value); } break; case INSIGHT_CODE: if (value == null) { unset_insight_code(); } else { set_insight_code((String)value); } break; case JSON_VALUE: if (value == null) { unset_json_value(); } else { set_json_value((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case INDEX_CODE: return get_index_code(); case INSIGHT_CODE: return get_insight_code(); case JSON_VALUE: return get_json_value(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case INDEX_CODE: return is_set_index_code(); case INSIGHT_CODE: return is_set_insight_code(); case JSON_VALUE: return is_set_json_value(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof save_insight_args) return this.equals((save_insight_args)that); return false; } public boolean equals(save_insight_args that) { if (that == null) return false; boolean this_present_index_code = true && this.is_set_index_code(); boolean that_present_index_code = true && that.is_set_index_code(); if (this_present_index_code || that_present_index_code) { if (!(this_present_index_code && that_present_index_code)) return false; if (!this.index_code.equals(that.index_code)) return false; } boolean this_present_insight_code = true && this.is_set_insight_code(); boolean that_present_insight_code = true && that.is_set_insight_code(); if (this_present_insight_code || that_present_insight_code) { if (!(this_present_insight_code && that_present_insight_code)) return false; if (!this.insight_code.equals(that.insight_code)) return false; } boolean this_present_json_value = true && this.is_set_json_value(); boolean that_present_json_value = true && that.is_set_json_value(); if (this_present_json_value || that_present_json_value) { if (!(this_present_json_value && that_present_json_value)) return false; if (!this.json_value.equals(that.json_value)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(save_insight_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; save_insight_args typedOther = (save_insight_args)other; lastComparison = Boolean.valueOf(is_set_index_code()).compareTo(typedOther.is_set_index_code()); if (lastComparison != 0) { return lastComparison; } if (is_set_index_code()) { lastComparison = TBaseHelper.compareTo(this.index_code, typedOther.index_code); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_insight_code()).compareTo(typedOther.is_set_insight_code()); if (lastComparison != 0) { return lastComparison; } if (is_set_insight_code()) { lastComparison = TBaseHelper.compareTo(this.insight_code, typedOther.insight_code); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_json_value()).compareTo(typedOther.is_set_json_value()); if (lastComparison != 0) { return lastComparison; } if (is_set_json_value()) { lastComparison = TBaseHelper.compareTo(this.json_value, typedOther.json_value); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // INDEX_CODE if (field.type == TType.STRING) { this.index_code = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: // INSIGHT_CODE if (field.type == TType.STRING) { this.insight_code = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: // JSON_VALUE if (field.type == TType.STRING) { this.json_value = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.index_code != null) { oprot.writeFieldBegin(INDEX_CODE_FIELD_DESC); oprot.writeString(this.index_code); oprot.writeFieldEnd(); } if (this.insight_code != null) { oprot.writeFieldBegin(INSIGHT_CODE_FIELD_DESC); oprot.writeString(this.insight_code); oprot.writeFieldEnd(); } if (this.json_value != null) { oprot.writeFieldBegin(JSON_VALUE_FIELD_DESC); oprot.writeString(this.json_value); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("save_insight_args("); boolean first = true; sb.append("index_code:"); if (this.index_code == null) { sb.append("null"); } else { sb.append(this.index_code); } first = false; if (!first) sb.append(", "); sb.append("insight_code:"); if (this.insight_code == null) { sb.append("null"); } else { sb.append(this.insight_code); } first = false; if (!first) sb.append(", "); sb.append("json_value:"); if (this.json_value == null) { sb.append("null"); } else { sb.append(this.json_value); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class save_insight_result implements TBase<save_insight_result, save_insight_result._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("save_insight_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<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { 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; } } public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(save_insight_result.class, metaDataMap); } public save_insight_result() { } /** * Performs a deep copy on <i>other</i>. */ public save_insight_result(save_insight_result other) { } public save_insight_result deepCopy() { return new save_insight_result(this); } @Override public void clear() { } public void setFieldValue(_Fields field, Object value) { switch (field) { } } public Object getFieldValue(_Fields field) { switch (field) { } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof save_insight_result) return this.equals((save_insight_result)that); return false; } public boolean equals(save_insight_result that) { if (that == null) return false; return true; } @Override public int hashCode() { return 0; } public int compareTo(save_insight_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; save_insight_result typedOther = (save_insight_result)other; return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("save_insight_result("); boolean first = true; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } }