Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
116 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.utils;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class EstimationService {
27
 
28
  public interface Iface {
29
 
30
    public List<ItemLogistics> getLogisticsEstimation(long itemId, Map<String,String> location) throws HelperServiceException, TException;
31
 
32
  }
33
 
34
  public static class Client implements Iface {
35
    public Client(TProtocol prot)
36
    {
37
      this(prot, prot);
38
    }
39
 
40
    public Client(TProtocol iprot, TProtocol oprot)
41
    {
42
      iprot_ = iprot;
43
      oprot_ = oprot;
44
    }
45
 
46
    protected TProtocol iprot_;
47
    protected TProtocol oprot_;
48
 
49
    protected int seqid_;
50
 
51
    public TProtocol getInputProtocol()
52
    {
53
      return this.iprot_;
54
    }
55
 
56
    public TProtocol getOutputProtocol()
57
    {
58
      return this.oprot_;
59
    }
60
 
61
    public List<ItemLogistics> getLogisticsEstimation(long itemId, Map<String,String> location) throws HelperServiceException, TException
62
    {
63
      send_getLogisticsEstimation(itemId, location);
64
      return recv_getLogisticsEstimation();
65
    }
66
 
67
    public void send_getLogisticsEstimation(long itemId, Map<String,String> location) throws TException
68
    {
69
      oprot_.writeMessageBegin(new TMessage("getLogisticsEstimation", TMessageType.CALL, seqid_));
70
      getLogisticsEstimation_args args = new getLogisticsEstimation_args();
71
      args.itemId = itemId;
72
      args.location = location;
73
      args.write(oprot_);
74
      oprot_.writeMessageEnd();
75
      oprot_.getTransport().flush();
76
    }
77
 
78
    public List<ItemLogistics> recv_getLogisticsEstimation() throws HelperServiceException, TException
79
    {
80
      TMessage msg = iprot_.readMessageBegin();
81
      if (msg.type == TMessageType.EXCEPTION) {
82
        TApplicationException x = TApplicationException.read(iprot_);
83
        iprot_.readMessageEnd();
84
        throw x;
85
      }
86
      getLogisticsEstimation_result result = new getLogisticsEstimation_result();
87
      result.read(iprot_);
88
      iprot_.readMessageEnd();
89
      if (result.isSetSuccess()) {
90
        return result.success;
91
      }
92
      if (result.se != null) {
93
        throw result.se;
94
      }
95
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getLogisticsEstimation failed: unknown result");
96
    }
97
 
98
  }
99
  public static class Processor implements TProcessor {
100
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
101
    public Processor(Iface iface)
102
    {
103
      iface_ = iface;
104
      processMap_.put("getLogisticsEstimation", new getLogisticsEstimation());
105
    }
106
 
107
    protected static interface ProcessFunction {
108
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
109
    }
110
 
111
    private Iface iface_;
112
    protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();
113
 
114
    public boolean process(TProtocol iprot, TProtocol oprot) throws TException
115
    {
116
      TMessage msg = iprot.readMessageBegin();
117
      ProcessFunction fn = processMap_.get(msg.name);
118
      if (fn == null) {
119
        TProtocolUtil.skip(iprot, TType.STRUCT);
120
        iprot.readMessageEnd();
121
        TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
122
        oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
123
        x.write(oprot);
124
        oprot.writeMessageEnd();
125
        oprot.getTransport().flush();
126
        return true;
127
      }
128
      fn.process(msg.seqid, iprot, oprot);
129
      return true;
130
    }
131
 
132
    private class getLogisticsEstimation implements ProcessFunction {
133
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
134
      {
135
        getLogisticsEstimation_args args = new getLogisticsEstimation_args();
136
        args.read(iprot);
137
        iprot.readMessageEnd();
138
        getLogisticsEstimation_result result = new getLogisticsEstimation_result();
139
        try {
140
          result.success = iface_.getLogisticsEstimation(args.itemId, args.location);
141
        } catch (HelperServiceException se) {
142
          result.se = se;
143
        } catch (Throwable th) {
144
          LOGGER.error("Internal error processing getLogisticsEstimation", th);
145
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getLogisticsEstimation");
146
          oprot.writeMessageBegin(new TMessage("getLogisticsEstimation", TMessageType.EXCEPTION, seqid));
147
          x.write(oprot);
148
          oprot.writeMessageEnd();
149
          oprot.getTransport().flush();
150
          return;
151
        }
152
        oprot.writeMessageBegin(new TMessage("getLogisticsEstimation", TMessageType.REPLY, seqid));
153
        result.write(oprot);
154
        oprot.writeMessageEnd();
155
        oprot.getTransport().flush();
156
      }
157
 
158
    }
159
 
160
  }
161
 
162
  public static class getLogisticsEstimation_args implements TBase<getLogisticsEstimation_args._Fields>, java.io.Serializable, Cloneable   {
163
    private static final TStruct STRUCT_DESC = new TStruct("getLogisticsEstimation_args");
164
 
165
    private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)1);
166
    private static final TField LOCATION_FIELD_DESC = new TField("location", TType.MAP, (short)2);
167
 
168
    private long itemId;
169
    private Map<String,String> location;
170
 
171
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
172
    public enum _Fields implements TFieldIdEnum {
173
      ITEM_ID((short)1, "itemId"),
174
      LOCATION((short)2, "location");
175
 
176
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
177
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
178
 
179
      static {
180
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
181
          byId.put((int)field._thriftId, field);
182
          byName.put(field.getFieldName(), field);
183
        }
184
      }
185
 
186
      /**
187
       * Find the _Fields constant that matches fieldId, or null if its not found.
188
       */
189
      public static _Fields findByThriftId(int fieldId) {
190
        return byId.get(fieldId);
191
      }
192
 
193
      /**
194
       * Find the _Fields constant that matches fieldId, throwing an exception
195
       * if it is not found.
196
       */
197
      public static _Fields findByThriftIdOrThrow(int fieldId) {
198
        _Fields fields = findByThriftId(fieldId);
199
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
200
        return fields;
201
      }
202
 
203
      /**
204
       * Find the _Fields constant that matches name, or null if its not found.
205
       */
206
      public static _Fields findByName(String name) {
207
        return byName.get(name);
208
      }
209
 
210
      private final short _thriftId;
211
      private final String _fieldName;
212
 
213
      _Fields(short thriftId, String fieldName) {
214
        _thriftId = thriftId;
215
        _fieldName = fieldName;
216
      }
217
 
218
      public short getThriftFieldId() {
219
        return _thriftId;
220
      }
221
 
222
      public String getFieldName() {
223
        return _fieldName;
224
      }
225
    }
226
 
227
    // isset id assignments
228
    private static final int __ITEMID_ISSET_ID = 0;
229
    private BitSet __isset_bit_vector = new BitSet(1);
230
 
231
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
232
      put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
233
          new FieldValueMetaData(TType.I64)));
234
      put(_Fields.LOCATION, new FieldMetaData("location", TFieldRequirementType.DEFAULT, 
235
          new MapMetaData(TType.MAP, 
236
              new FieldValueMetaData(TType.STRING), 
237
              new FieldValueMetaData(TType.STRING))));
238
    }});
239
 
240
    static {
241
      FieldMetaData.addStructMetaDataMap(getLogisticsEstimation_args.class, metaDataMap);
242
    }
243
 
244
    public getLogisticsEstimation_args() {
245
    }
246
 
247
    public getLogisticsEstimation_args(
248
      long itemId,
249
      Map<String,String> location)
250
    {
251
      this();
252
      this.itemId = itemId;
253
      setItemIdIsSet(true);
254
      this.location = location;
255
    }
256
 
257
    /**
258
     * Performs a deep copy on <i>other</i>.
259
     */
260
    public getLogisticsEstimation_args(getLogisticsEstimation_args other) {
261
      __isset_bit_vector.clear();
262
      __isset_bit_vector.or(other.__isset_bit_vector);
263
      this.itemId = other.itemId;
264
      if (other.isSetLocation()) {
265
        Map<String,String> __this__location = new HashMap<String,String>();
266
        for (Map.Entry<String, String> other_element : other.location.entrySet()) {
267
 
268
          String other_element_key = other_element.getKey();
269
          String other_element_value = other_element.getValue();
270
 
271
          String __this__location_copy_key = other_element_key;
272
 
273
          String __this__location_copy_value = other_element_value;
274
 
275
          __this__location.put(__this__location_copy_key, __this__location_copy_value);
276
        }
277
        this.location = __this__location;
278
      }
279
    }
280
 
281
    public getLogisticsEstimation_args deepCopy() {
282
      return new getLogisticsEstimation_args(this);
283
    }
284
 
285
    @Deprecated
286
    public getLogisticsEstimation_args clone() {
287
      return new getLogisticsEstimation_args(this);
288
    }
289
 
290
    public long getItemId() {
291
      return this.itemId;
292
    }
293
 
294
    public getLogisticsEstimation_args setItemId(long itemId) {
295
      this.itemId = itemId;
296
      setItemIdIsSet(true);
297
      return this;
298
    }
299
 
300
    public void unsetItemId() {
301
      __isset_bit_vector.clear(__ITEMID_ISSET_ID);
302
    }
303
 
304
    /** Returns true if field itemId is set (has been asigned a value) and false otherwise */
305
    public boolean isSetItemId() {
306
      return __isset_bit_vector.get(__ITEMID_ISSET_ID);
307
    }
308
 
309
    public void setItemIdIsSet(boolean value) {
310
      __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
311
    }
312
 
313
    public int getLocationSize() {
314
      return (this.location == null) ? 0 : this.location.size();
315
    }
316
 
317
    public void putToLocation(String key, String val) {
318
      if (this.location == null) {
319
        this.location = new HashMap<String,String>();
320
      }
321
      this.location.put(key, val);
322
    }
323
 
324
    public Map<String,String> getLocation() {
325
      return this.location;
326
    }
327
 
328
    public getLogisticsEstimation_args setLocation(Map<String,String> location) {
329
      this.location = location;
330
      return this;
331
    }
332
 
333
    public void unsetLocation() {
334
      this.location = null;
335
    }
336
 
337
    /** Returns true if field location is set (has been asigned a value) and false otherwise */
338
    public boolean isSetLocation() {
339
      return this.location != null;
340
    }
341
 
342
    public void setLocationIsSet(boolean value) {
343
      if (!value) {
344
        this.location = null;
345
      }
346
    }
347
 
348
    public void setFieldValue(_Fields field, Object value) {
349
      switch (field) {
350
      case ITEM_ID:
351
        if (value == null) {
352
          unsetItemId();
353
        } else {
354
          setItemId((Long)value);
355
        }
356
        break;
357
 
358
      case LOCATION:
359
        if (value == null) {
360
          unsetLocation();
361
        } else {
362
          setLocation((Map<String,String>)value);
363
        }
364
        break;
365
 
366
      }
367
    }
368
 
369
    public void setFieldValue(int fieldID, Object value) {
370
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
371
    }
372
 
373
    public Object getFieldValue(_Fields field) {
374
      switch (field) {
375
      case ITEM_ID:
376
        return new Long(getItemId());
377
 
378
      case LOCATION:
379
        return getLocation();
380
 
381
      }
382
      throw new IllegalStateException();
383
    }
384
 
385
    public Object getFieldValue(int fieldId) {
386
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
387
    }
388
 
389
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
390
    public boolean isSet(_Fields field) {
391
      switch (field) {
392
      case ITEM_ID:
393
        return isSetItemId();
394
      case LOCATION:
395
        return isSetLocation();
396
      }
397
      throw new IllegalStateException();
398
    }
399
 
400
    public boolean isSet(int fieldID) {
401
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
402
    }
403
 
404
    @Override
405
    public boolean equals(Object that) {
406
      if (that == null)
407
        return false;
408
      if (that instanceof getLogisticsEstimation_args)
409
        return this.equals((getLogisticsEstimation_args)that);
410
      return false;
411
    }
412
 
413
    public boolean equals(getLogisticsEstimation_args that) {
414
      if (that == null)
415
        return false;
416
 
417
      boolean this_present_itemId = true;
418
      boolean that_present_itemId = true;
419
      if (this_present_itemId || that_present_itemId) {
420
        if (!(this_present_itemId && that_present_itemId))
421
          return false;
422
        if (this.itemId != that.itemId)
423
          return false;
424
      }
425
 
426
      boolean this_present_location = true && this.isSetLocation();
427
      boolean that_present_location = true && that.isSetLocation();
428
      if (this_present_location || that_present_location) {
429
        if (!(this_present_location && that_present_location))
430
          return false;
431
        if (!this.location.equals(that.location))
432
          return false;
433
      }
434
 
435
      return true;
436
    }
437
 
438
    @Override
439
    public int hashCode() {
440
      return 0;
441
    }
442
 
443
    public void read(TProtocol iprot) throws TException {
444
      TField field;
445
      iprot.readStructBegin();
446
      while (true)
447
      {
448
        field = iprot.readFieldBegin();
449
        if (field.type == TType.STOP) { 
450
          break;
451
        }
452
        _Fields fieldId = _Fields.findByThriftId(field.id);
453
        if (fieldId == null) {
454
          TProtocolUtil.skip(iprot, field.type);
455
        } else {
456
          switch (fieldId) {
457
            case ITEM_ID:
458
              if (field.type == TType.I64) {
459
                this.itemId = iprot.readI64();
460
                setItemIdIsSet(true);
461
              } else { 
462
                TProtocolUtil.skip(iprot, field.type);
463
              }
464
              break;
465
            case LOCATION:
466
              if (field.type == TType.MAP) {
467
                {
468
                  TMap _map0 = iprot.readMapBegin();
469
                  this.location = new HashMap<String,String>(2*_map0.size);
470
                  for (int _i1 = 0; _i1 < _map0.size; ++_i1)
471
                  {
472
                    String _key2;
473
                    String _val3;
474
                    _key2 = iprot.readString();
475
                    _val3 = iprot.readString();
476
                    this.location.put(_key2, _val3);
477
                  }
478
                  iprot.readMapEnd();
479
                }
480
              } else { 
481
                TProtocolUtil.skip(iprot, field.type);
482
              }
483
              break;
484
          }
485
          iprot.readFieldEnd();
486
        }
487
      }
488
      iprot.readStructEnd();
489
      validate();
490
    }
491
 
492
    public void write(TProtocol oprot) throws TException {
493
      validate();
494
 
495
      oprot.writeStructBegin(STRUCT_DESC);
496
      oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
497
      oprot.writeI64(this.itemId);
498
      oprot.writeFieldEnd();
499
      if (this.location != null) {
500
        oprot.writeFieldBegin(LOCATION_FIELD_DESC);
501
        {
502
          oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.location.size()));
503
          for (Map.Entry<String, String> _iter4 : this.location.entrySet())
504
          {
505
            oprot.writeString(_iter4.getKey());
506
            oprot.writeString(_iter4.getValue());
507
          }
508
          oprot.writeMapEnd();
509
        }
510
        oprot.writeFieldEnd();
511
      }
512
      oprot.writeFieldStop();
513
      oprot.writeStructEnd();
514
    }
515
 
516
    @Override
517
    public String toString() {
518
      StringBuilder sb = new StringBuilder("getLogisticsEstimation_args(");
519
      boolean first = true;
520
 
521
      sb.append("itemId:");
522
      sb.append(this.itemId);
523
      first = false;
524
      if (!first) sb.append(", ");
525
      sb.append("location:");
526
      if (this.location == null) {
527
        sb.append("null");
528
      } else {
529
        sb.append(this.location);
530
      }
531
      first = false;
532
      sb.append(")");
533
      return sb.toString();
534
    }
535
 
536
    public void validate() throws TException {
537
      // check for required fields
538
    }
539
 
540
  }
541
 
542
  public static class getLogisticsEstimation_result implements TBase<getLogisticsEstimation_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLogisticsEstimation_result>   {
543
    private static final TStruct STRUCT_DESC = new TStruct("getLogisticsEstimation_result");
544
 
545
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
546
    private static final TField SE_FIELD_DESC = new TField("se", TType.STRUCT, (short)1);
547
 
548
    private List<ItemLogistics> success;
549
    private HelperServiceException se;
550
 
551
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
552
    public enum _Fields implements TFieldIdEnum {
553
      SUCCESS((short)0, "success"),
554
      SE((short)1, "se");
555
 
556
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
557
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
558
 
559
      static {
560
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
561
          byId.put((int)field._thriftId, field);
562
          byName.put(field.getFieldName(), field);
563
        }
564
      }
565
 
566
      /**
567
       * Find the _Fields constant that matches fieldId, or null if its not found.
568
       */
569
      public static _Fields findByThriftId(int fieldId) {
570
        return byId.get(fieldId);
571
      }
572
 
573
      /**
574
       * Find the _Fields constant that matches fieldId, throwing an exception
575
       * if it is not found.
576
       */
577
      public static _Fields findByThriftIdOrThrow(int fieldId) {
578
        _Fields fields = findByThriftId(fieldId);
579
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
580
        return fields;
581
      }
582
 
583
      /**
584
       * Find the _Fields constant that matches name, or null if its not found.
585
       */
586
      public static _Fields findByName(String name) {
587
        return byName.get(name);
588
      }
589
 
590
      private final short _thriftId;
591
      private final String _fieldName;
592
 
593
      _Fields(short thriftId, String fieldName) {
594
        _thriftId = thriftId;
595
        _fieldName = fieldName;
596
      }
597
 
598
      public short getThriftFieldId() {
599
        return _thriftId;
600
      }
601
 
602
      public String getFieldName() {
603
        return _fieldName;
604
      }
605
    }
606
 
607
    // isset id assignments
608
 
609
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
610
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
611
          new ListMetaData(TType.LIST, 
612
              new StructMetaData(TType.STRUCT, ItemLogistics.class))));
613
      put(_Fields.SE, new FieldMetaData("se", TFieldRequirementType.DEFAULT, 
614
          new FieldValueMetaData(TType.STRUCT)));
615
    }});
616
 
617
    static {
618
      FieldMetaData.addStructMetaDataMap(getLogisticsEstimation_result.class, metaDataMap);
619
    }
620
 
621
    public getLogisticsEstimation_result() {
622
    }
623
 
624
    public getLogisticsEstimation_result(
625
      List<ItemLogistics> success,
626
      HelperServiceException se)
627
    {
628
      this();
629
      this.success = success;
630
      this.se = se;
631
    }
632
 
633
    /**
634
     * Performs a deep copy on <i>other</i>.
635
     */
636
    public getLogisticsEstimation_result(getLogisticsEstimation_result other) {
637
      if (other.isSetSuccess()) {
638
        List<ItemLogistics> __this__success = new ArrayList<ItemLogistics>();
639
        for (ItemLogistics other_element : other.success) {
640
          __this__success.add(new ItemLogistics(other_element));
641
        }
642
        this.success = __this__success;
643
      }
644
      if (other.isSetSe()) {
645
        this.se = new HelperServiceException(other.se);
646
      }
647
    }
648
 
649
    public getLogisticsEstimation_result deepCopy() {
650
      return new getLogisticsEstimation_result(this);
651
    }
652
 
653
    @Deprecated
654
    public getLogisticsEstimation_result clone() {
655
      return new getLogisticsEstimation_result(this);
656
    }
657
 
658
    public int getSuccessSize() {
659
      return (this.success == null) ? 0 : this.success.size();
660
    }
661
 
662
    public java.util.Iterator<ItemLogistics> getSuccessIterator() {
663
      return (this.success == null) ? null : this.success.iterator();
664
    }
665
 
666
    public void addToSuccess(ItemLogistics elem) {
667
      if (this.success == null) {
668
        this.success = new ArrayList<ItemLogistics>();
669
      }
670
      this.success.add(elem);
671
    }
672
 
673
    public List<ItemLogistics> getSuccess() {
674
      return this.success;
675
    }
676
 
677
    public getLogisticsEstimation_result setSuccess(List<ItemLogistics> success) {
678
      this.success = success;
679
      return this;
680
    }
681
 
682
    public void unsetSuccess() {
683
      this.success = null;
684
    }
685
 
686
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
687
    public boolean isSetSuccess() {
688
      return this.success != null;
689
    }
690
 
691
    public void setSuccessIsSet(boolean value) {
692
      if (!value) {
693
        this.success = null;
694
      }
695
    }
696
 
697
    public HelperServiceException getSe() {
698
      return this.se;
699
    }
700
 
701
    public getLogisticsEstimation_result setSe(HelperServiceException se) {
702
      this.se = se;
703
      return this;
704
    }
705
 
706
    public void unsetSe() {
707
      this.se = null;
708
    }
709
 
710
    /** Returns true if field se is set (has been asigned a value) and false otherwise */
711
    public boolean isSetSe() {
712
      return this.se != null;
713
    }
714
 
715
    public void setSeIsSet(boolean value) {
716
      if (!value) {
717
        this.se = null;
718
      }
719
    }
720
 
721
    public void setFieldValue(_Fields field, Object value) {
722
      switch (field) {
723
      case SUCCESS:
724
        if (value == null) {
725
          unsetSuccess();
726
        } else {
727
          setSuccess((List<ItemLogistics>)value);
728
        }
729
        break;
730
 
731
      case SE:
732
        if (value == null) {
733
          unsetSe();
734
        } else {
735
          setSe((HelperServiceException)value);
736
        }
737
        break;
738
 
739
      }
740
    }
741
 
742
    public void setFieldValue(int fieldID, Object value) {
743
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
744
    }
745
 
746
    public Object getFieldValue(_Fields field) {
747
      switch (field) {
748
      case SUCCESS:
749
        return getSuccess();
750
 
751
      case SE:
752
        return getSe();
753
 
754
      }
755
      throw new IllegalStateException();
756
    }
757
 
758
    public Object getFieldValue(int fieldId) {
759
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
760
    }
761
 
762
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
763
    public boolean isSet(_Fields field) {
764
      switch (field) {
765
      case SUCCESS:
766
        return isSetSuccess();
767
      case SE:
768
        return isSetSe();
769
      }
770
      throw new IllegalStateException();
771
    }
772
 
773
    public boolean isSet(int fieldID) {
774
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
775
    }
776
 
777
    @Override
778
    public boolean equals(Object that) {
779
      if (that == null)
780
        return false;
781
      if (that instanceof getLogisticsEstimation_result)
782
        return this.equals((getLogisticsEstimation_result)that);
783
      return false;
784
    }
785
 
786
    public boolean equals(getLogisticsEstimation_result that) {
787
      if (that == null)
788
        return false;
789
 
790
      boolean this_present_success = true && this.isSetSuccess();
791
      boolean that_present_success = true && that.isSetSuccess();
792
      if (this_present_success || that_present_success) {
793
        if (!(this_present_success && that_present_success))
794
          return false;
795
        if (!this.success.equals(that.success))
796
          return false;
797
      }
798
 
799
      boolean this_present_se = true && this.isSetSe();
800
      boolean that_present_se = true && that.isSetSe();
801
      if (this_present_se || that_present_se) {
802
        if (!(this_present_se && that_present_se))
803
          return false;
804
        if (!this.se.equals(that.se))
805
          return false;
806
      }
807
 
808
      return true;
809
    }
810
 
811
    @Override
812
    public int hashCode() {
813
      return 0;
814
    }
815
 
816
    public int compareTo(getLogisticsEstimation_result other) {
817
      if (!getClass().equals(other.getClass())) {
818
        return getClass().getName().compareTo(other.getClass().getName());
819
      }
820
 
821
      int lastComparison = 0;
822
      getLogisticsEstimation_result typedOther = (getLogisticsEstimation_result)other;
823
 
824
      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
825
      if (lastComparison != 0) {
826
        return lastComparison;
827
      }
828
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
829
      if (lastComparison != 0) {
830
        return lastComparison;
831
      }
832
      lastComparison = Boolean.valueOf(isSetSe()).compareTo(isSetSe());
833
      if (lastComparison != 0) {
834
        return lastComparison;
835
      }
836
      lastComparison = TBaseHelper.compareTo(se, typedOther.se);
837
      if (lastComparison != 0) {
838
        return lastComparison;
839
      }
840
      return 0;
841
    }
842
 
843
    public void read(TProtocol iprot) throws TException {
844
      TField field;
845
      iprot.readStructBegin();
846
      while (true)
847
      {
848
        field = iprot.readFieldBegin();
849
        if (field.type == TType.STOP) { 
850
          break;
851
        }
852
        _Fields fieldId = _Fields.findByThriftId(field.id);
853
        if (fieldId == null) {
854
          TProtocolUtil.skip(iprot, field.type);
855
        } else {
856
          switch (fieldId) {
857
            case SUCCESS:
858
              if (field.type == TType.LIST) {
859
                {
860
                  TList _list5 = iprot.readListBegin();
861
                  this.success = new ArrayList<ItemLogistics>(_list5.size);
862
                  for (int _i6 = 0; _i6 < _list5.size; ++_i6)
863
                  {
864
                    ItemLogistics _elem7;
865
                    _elem7 = new ItemLogistics();
866
                    _elem7.read(iprot);
867
                    this.success.add(_elem7);
868
                  }
869
                  iprot.readListEnd();
870
                }
871
              } else { 
872
                TProtocolUtil.skip(iprot, field.type);
873
              }
874
              break;
875
            case SE:
876
              if (field.type == TType.STRUCT) {
877
                this.se = new HelperServiceException();
878
                this.se.read(iprot);
879
              } else { 
880
                TProtocolUtil.skip(iprot, field.type);
881
              }
882
              break;
883
          }
884
          iprot.readFieldEnd();
885
        }
886
      }
887
      iprot.readStructEnd();
888
      validate();
889
    }
890
 
891
    public void write(TProtocol oprot) throws TException {
892
      oprot.writeStructBegin(STRUCT_DESC);
893
 
894
      if (this.isSetSuccess()) {
895
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
896
        {
897
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
898
          for (ItemLogistics _iter8 : this.success)
899
          {
900
            _iter8.write(oprot);
901
          }
902
          oprot.writeListEnd();
903
        }
904
        oprot.writeFieldEnd();
905
      } else if (this.isSetSe()) {
906
        oprot.writeFieldBegin(SE_FIELD_DESC);
907
        this.se.write(oprot);
908
        oprot.writeFieldEnd();
909
      }
910
      oprot.writeFieldStop();
911
      oprot.writeStructEnd();
912
    }
913
 
914
    @Override
915
    public String toString() {
916
      StringBuilder sb = new StringBuilder("getLogisticsEstimation_result(");
917
      boolean first = true;
918
 
919
      sb.append("success:");
920
      if (this.success == null) {
921
        sb.append("null");
922
      } else {
923
        sb.append(this.success);
924
      }
925
      first = false;
926
      if (!first) sb.append(", ");
927
      sb.append("se:");
928
      if (this.se == null) {
929
        sb.append("null");
930
      } else {
931
        sb.append(this.se);
932
      }
933
      first = false;
934
      sb.append(")");
935
      return sb.toString();
936
    }
937
 
938
    public void validate() throws TException {
939
      // check for required fields
940
    }
941
 
942
  }
943
 
944
}