Blame | Last modification | View Log | RSS feed
/*** Autogenerated by Thrift** DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING*/package in.shop2020.utils;import java.util.List;import java.util.ArrayList;import java.util.Map;import java.util.HashMap;import java.util.EnumMap;import java.util.Set;import java.util.HashSet;import java.util.EnumSet;import java.util.Collections;import java.util.BitSet;import java.util.Arrays;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.apache.thrift.*;import org.apache.thrift.meta_data.*;import org.apache.thrift.protocol.*;public class EstimationService {public interface Iface {public List<ItemLogistics> getLogisticsEstimation(long itemId, Map<String,String> location) throws HelperServiceException, TException;}public static class Client implements Iface {public Client(TProtocol prot){this(prot, prot);}public Client(TProtocol iprot, TProtocol oprot){iprot_ = iprot;oprot_ = oprot;}protected TProtocol iprot_;protected TProtocol oprot_;protected int seqid_;public TProtocol getInputProtocol(){return this.iprot_;}public TProtocol getOutputProtocol(){return this.oprot_;}public List<ItemLogistics> getLogisticsEstimation(long itemId, Map<String,String> location) throws HelperServiceException, TException{send_getLogisticsEstimation(itemId, location);return recv_getLogisticsEstimation();}public void send_getLogisticsEstimation(long itemId, Map<String,String> location) throws TException{oprot_.writeMessageBegin(new TMessage("getLogisticsEstimation", TMessageType.CALL, seqid_));getLogisticsEstimation_args args = new getLogisticsEstimation_args();args.itemId = itemId;args.location = location;args.write(oprot_);oprot_.writeMessageEnd();oprot_.getTransport().flush();}public List<ItemLogistics> recv_getLogisticsEstimation() throws HelperServiceException, TException{TMessage msg = iprot_.readMessageBegin();if (msg.type == TMessageType.EXCEPTION) {TApplicationException x = TApplicationException.read(iprot_);iprot_.readMessageEnd();throw x;}getLogisticsEstimation_result result = new getLogisticsEstimation_result();result.read(iprot_);iprot_.readMessageEnd();if (result.isSetSuccess()) {return result.success;}if (result.se != null) {throw result.se;}throw new TApplicationException(TApplicationException.MISSING_RESULT, "getLogisticsEstimation failed: unknown result");}}public static class Processor implements TProcessor {private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());public Processor(Iface iface){iface_ = iface;processMap_.put("getLogisticsEstimation", new getLogisticsEstimation());}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 getLogisticsEstimation implements ProcessFunction {public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException{getLogisticsEstimation_args args = new getLogisticsEstimation_args();args.read(iprot);iprot.readMessageEnd();getLogisticsEstimation_result result = new getLogisticsEstimation_result();try {result.success = iface_.getLogisticsEstimation(args.itemId, args.location);} catch (HelperServiceException se) {result.se = se;} catch (Throwable th) {LOGGER.error("Internal error processing getLogisticsEstimation", th);TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getLogisticsEstimation");oprot.writeMessageBegin(new TMessage("getLogisticsEstimation", TMessageType.EXCEPTION, seqid));x.write(oprot);oprot.writeMessageEnd();oprot.getTransport().flush();return;}oprot.writeMessageBegin(new TMessage("getLogisticsEstimation", TMessageType.REPLY, seqid));result.write(oprot);oprot.writeMessageEnd();oprot.getTransport().flush();}}}public static class getLogisticsEstimation_args implements TBase<getLogisticsEstimation_args._Fields>, java.io.Serializable, Cloneable {private static final TStruct STRUCT_DESC = new TStruct("getLogisticsEstimation_args");private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)1);private static final TField LOCATION_FIELD_DESC = new TField("location", TType.MAP, (short)2);private long itemId;private Map<String,String> location;/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements TFieldIdEnum {ITEM_ID((short)1, "itemId"),LOCATION((short)2, "location");private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** Find the _Fields constant that matches fieldId, throwing an exception* if it is not found.*/public static _Fields findByThriftIdOrThrow(int fieldId) {_Fields fields = findByThriftId(fieldId);if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");return fields;}/*** Find the _Fields constant that matches name, or null if its not found.*/public static _Fields findByName(String name) {return byName.get(name);}private final short _thriftId;private final String _fieldName;_Fields(short thriftId, String fieldName) {_thriftId = thriftId;_fieldName = fieldName;}public short getThriftFieldId() {return _thriftId;}public String getFieldName() {return _fieldName;}}// isset id assignmentsprivate static final int __ITEMID_ISSET_ID = 0;private BitSet __isset_bit_vector = new BitSet(1);public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));put(_Fields.LOCATION, new FieldMetaData("location", TFieldRequirementType.DEFAULT,new MapMetaData(TType.MAP,new FieldValueMetaData(TType.STRING),new FieldValueMetaData(TType.STRING))));}});static {FieldMetaData.addStructMetaDataMap(getLogisticsEstimation_args.class, metaDataMap);}public getLogisticsEstimation_args() {}public getLogisticsEstimation_args(long itemId,Map<String,String> location){this();this.itemId = itemId;setItemIdIsSet(true);this.location = location;}/*** Performs a deep copy on <i>other</i>.*/public getLogisticsEstimation_args(getLogisticsEstimation_args other) {__isset_bit_vector.clear();__isset_bit_vector.or(other.__isset_bit_vector);this.itemId = other.itemId;if (other.isSetLocation()) {Map<String,String> __this__location = new HashMap<String,String>();for (Map.Entry<String, String> other_element : other.location.entrySet()) {String other_element_key = other_element.getKey();String other_element_value = other_element.getValue();String __this__location_copy_key = other_element_key;String __this__location_copy_value = other_element_value;__this__location.put(__this__location_copy_key, __this__location_copy_value);}this.location = __this__location;}}public getLogisticsEstimation_args deepCopy() {return new getLogisticsEstimation_args(this);}@Deprecatedpublic getLogisticsEstimation_args clone() {return new getLogisticsEstimation_args(this);}public long getItemId() {return this.itemId;}public getLogisticsEstimation_args setItemId(long itemId) {this.itemId = itemId;setItemIdIsSet(true);return this;}public void unsetItemId() {__isset_bit_vector.clear(__ITEMID_ISSET_ID);}/** Returns true if field itemId is set (has been asigned a value) and false otherwise */public boolean isSetItemId() {return __isset_bit_vector.get(__ITEMID_ISSET_ID);}public void setItemIdIsSet(boolean value) {__isset_bit_vector.set(__ITEMID_ISSET_ID, value);}public int getLocationSize() {return (this.location == null) ? 0 : this.location.size();}public void putToLocation(String key, String val) {if (this.location == null) {this.location = new HashMap<String,String>();}this.location.put(key, val);}public Map<String,String> getLocation() {return this.location;}public getLogisticsEstimation_args setLocation(Map<String,String> location) {this.location = location;return this;}public void unsetLocation() {this.location = null;}/** Returns true if field location is set (has been asigned a value) and false otherwise */public boolean isSetLocation() {return this.location != null;}public void setLocationIsSet(boolean value) {if (!value) {this.location = null;}}public void setFieldValue(_Fields field, Object value) {switch (field) {case ITEM_ID:if (value == null) {unsetItemId();} else {setItemId((Long)value);}break;case LOCATION:if (value == null) {unsetLocation();} else {setLocation((Map<String,String>)value);}break;}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {case ITEM_ID:return new Long(getItemId());case LOCATION:return getLocation();}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {case ITEM_ID:return isSetItemId();case LOCATION:return isSetLocation();}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof getLogisticsEstimation_args)return this.equals((getLogisticsEstimation_args)that);return false;}public boolean equals(getLogisticsEstimation_args that) {if (that == null)return false;boolean this_present_itemId = true;boolean that_present_itemId = true;if (this_present_itemId || that_present_itemId) {if (!(this_present_itemId && that_present_itemId))return false;if (this.itemId != that.itemId)return false;}boolean this_present_location = true && this.isSetLocation();boolean that_present_location = true && that.isSetLocation();if (this_present_location || that_present_location) {if (!(this_present_location && that_present_location))return false;if (!this.location.equals(that.location))return false;}return true;}@Overridepublic int hashCode() {return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {case ITEM_ID:if (field.type == TType.I64) {this.itemId = iprot.readI64();setItemIdIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case LOCATION:if (field.type == TType.MAP) {{TMap _map0 = iprot.readMapBegin();this.location = new HashMap<String,String>(2*_map0.size);for (int _i1 = 0; _i1 < _map0.size; ++_i1){String _key2;String _val3;_key2 = iprot.readString();_val3 = iprot.readString();this.location.put(_key2, _val3);}iprot.readMapEnd();}} else {TProtocolUtil.skip(iprot, field.type);}break;}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {validate();oprot.writeStructBegin(STRUCT_DESC);oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);oprot.writeI64(this.itemId);oprot.writeFieldEnd();if (this.location != null) {oprot.writeFieldBegin(LOCATION_FIELD_DESC);{oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.location.size()));for (Map.Entry<String, String> _iter4 : this.location.entrySet()){oprot.writeString(_iter4.getKey());oprot.writeString(_iter4.getValue());}oprot.writeMapEnd();}oprot.writeFieldEnd();}oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("getLogisticsEstimation_args(");boolean first = true;sb.append("itemId:");sb.append(this.itemId);first = false;if (!first) sb.append(", ");sb.append("location:");if (this.location == null) {sb.append("null");} else {sb.append(this.location);}first = false;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}public static class getLogisticsEstimation_result implements TBase<getLogisticsEstimation_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLogisticsEstimation_result> {private static final TStruct STRUCT_DESC = new TStruct("getLogisticsEstimation_result");private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);private static final TField SE_FIELD_DESC = new TField("se", TType.STRUCT, (short)1);private List<ItemLogistics> success;private HelperServiceException se;/** 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"),SE((short)1, "se");private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** Find the _Fields constant that matches fieldId, throwing an exception* if it is not found.*/public static _Fields findByThriftIdOrThrow(int fieldId) {_Fields fields = findByThriftId(fieldId);if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");return fields;}/*** Find the _Fields constant that matches name, or null if its not found.*/public static _Fields findByName(String name) {return byName.get(name);}private final short _thriftId;private final String _fieldName;_Fields(short thriftId, String fieldName) {_thriftId = thriftId;_fieldName = fieldName;}public short getThriftFieldId() {return _thriftId;}public String getFieldName() {return _fieldName;}}// isset id assignmentspublic static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT,new ListMetaData(TType.LIST,new StructMetaData(TType.STRUCT, ItemLogistics.class))));put(_Fields.SE, new FieldMetaData("se", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.STRUCT)));}});static {FieldMetaData.addStructMetaDataMap(getLogisticsEstimation_result.class, metaDataMap);}public getLogisticsEstimation_result() {}public getLogisticsEstimation_result(List<ItemLogistics> success,HelperServiceException se){this();this.success = success;this.se = se;}/*** Performs a deep copy on <i>other</i>.*/public getLogisticsEstimation_result(getLogisticsEstimation_result other) {if (other.isSetSuccess()) {List<ItemLogistics> __this__success = new ArrayList<ItemLogistics>();for (ItemLogistics other_element : other.success) {__this__success.add(new ItemLogistics(other_element));}this.success = __this__success;}if (other.isSetSe()) {this.se = new HelperServiceException(other.se);}}public getLogisticsEstimation_result deepCopy() {return new getLogisticsEstimation_result(this);}@Deprecatedpublic getLogisticsEstimation_result clone() {return new getLogisticsEstimation_result(this);}public int getSuccessSize() {return (this.success == null) ? 0 : this.success.size();}public java.util.Iterator<ItemLogistics> getSuccessIterator() {return (this.success == null) ? null : this.success.iterator();}public void addToSuccess(ItemLogistics elem) {if (this.success == null) {this.success = new ArrayList<ItemLogistics>();}this.success.add(elem);}public List<ItemLogistics> getSuccess() {return this.success;}public getLogisticsEstimation_result setSuccess(List<ItemLogistics> success) {this.success = success;return this;}public void unsetSuccess() {this.success = null;}/** Returns true if field success is set (has been asigned a value) and false otherwise */public boolean isSetSuccess() {return this.success != null;}public void setSuccessIsSet(boolean value) {if (!value) {this.success = null;}}public HelperServiceException getSe() {return this.se;}public getLogisticsEstimation_result setSe(HelperServiceException se) {this.se = se;return this;}public void unsetSe() {this.se = null;}/** Returns true if field se is set (has been asigned a value) and false otherwise */public boolean isSetSe() {return this.se != null;}public void setSeIsSet(boolean value) {if (!value) {this.se = null;}}public void setFieldValue(_Fields field, Object value) {switch (field) {case SUCCESS:if (value == null) {unsetSuccess();} else {setSuccess((List<ItemLogistics>)value);}break;case SE:if (value == null) {unsetSe();} else {setSe((HelperServiceException)value);}break;}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {case SUCCESS:return getSuccess();case SE:return getSe();}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {case SUCCESS:return isSetSuccess();case SE:return isSetSe();}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof getLogisticsEstimation_result)return this.equals((getLogisticsEstimation_result)that);return false;}public boolean equals(getLogisticsEstimation_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_se = true && this.isSetSe();boolean that_present_se = true && that.isSetSe();if (this_present_se || that_present_se) {if (!(this_present_se && that_present_se))return false;if (!this.se.equals(that.se))return false;}return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(getLogisticsEstimation_result other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;getLogisticsEstimation_result typedOther = (getLogisticsEstimation_result)other;lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(success, typedOther.success);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetSe()).compareTo(isSetSe());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(se, typedOther.se);if (lastComparison != 0) {return lastComparison;}return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {case SUCCESS:if (field.type == TType.LIST) {{TList _list5 = iprot.readListBegin();this.success = new ArrayList<ItemLogistics>(_list5.size);for (int _i6 = 0; _i6 < _list5.size; ++_i6){ItemLogistics _elem7;_elem7 = new ItemLogistics();_elem7.read(iprot);this.success.add(_elem7);}iprot.readListEnd();}} else {TProtocolUtil.skip(iprot, field.type);}break;case SE:if (field.type == TType.STRUCT) {this.se = new HelperServiceException();this.se.read(iprot);} else {TProtocolUtil.skip(iprot, field.type);}break;}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {oprot.writeStructBegin(STRUCT_DESC);if (this.isSetSuccess()) {oprot.writeFieldBegin(SUCCESS_FIELD_DESC);{oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));for (ItemLogistics _iter8 : this.success){_iter8.write(oprot);}oprot.writeListEnd();}oprot.writeFieldEnd();} else if (this.isSetSe()) {oprot.writeFieldBegin(SE_FIELD_DESC);this.se.write(oprot);oprot.writeFieldEnd();}oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("getLogisticsEstimation_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("se:");if (this.se == null) {sb.append("null");} else {sb.append(this.se);}first = false;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}}