Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
412 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.logistics;
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 ShipmentStatusInfo implements TBase<ShipmentStatusInfo._Fields>, java.io.Serializable, Cloneable, Comparable<ShipmentStatusInfo> {
27
  private static final TStruct STRUCT_DESC = new TStruct("ShipmentStatusInfo");
28
 
29
  private static final TField AWB_FIELD_DESC = new TField("awb", TType.STRING, (short)1);
442 rajveer 30
  private static final TField PROVIDER_ID_FIELD_DESC = new TField("provider_id", TType.I64, (short)2);
31
  private static final TField UPDATES_FIELD_DESC = new TField("updates", TType.LIST, (short)3);
32
  private static final TField CURRENT_UPDATE_FIELD_DESC = new TField("currentUpdate", TType.STRUCT, (short)4);
412 ashish 33
 
34
  private String awb;
35
  private long provider_id;
36
  private List<ShipmentUpdate> updates;
37
  private ShipmentUpdate currentUpdate;
38
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
41
    AWB((short)1, "awb"),
442 rajveer 42
    PROVIDER_ID((short)2, "provider_id"),
43
    UPDATES((short)3, "updates"),
44
    CURRENT_UPDATE((short)4, "currentUpdate");
412 ashish 45
 
46
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
49
    static {
50
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
51
        byId.put((int)field._thriftId, field);
52
        byName.put(field.getFieldName(), field);
53
      }
54
    }
55
 
56
    /**
57
     * Find the _Fields constant that matches fieldId, or null if its not found.
58
     */
59
    public static _Fields findByThriftId(int fieldId) {
60
      return byId.get(fieldId);
61
    }
62
 
63
    /**
64
     * Find the _Fields constant that matches fieldId, throwing an exception
65
     * if it is not found.
66
     */
67
    public static _Fields findByThriftIdOrThrow(int fieldId) {
68
      _Fields fields = findByThriftId(fieldId);
69
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
70
      return fields;
71
    }
72
 
73
    /**
74
     * Find the _Fields constant that matches name, or null if its not found.
75
     */
76
    public static _Fields findByName(String name) {
77
      return byName.get(name);
78
    }
79
 
80
    private final short _thriftId;
81
    private final String _fieldName;
82
 
83
    _Fields(short thriftId, String fieldName) {
84
      _thriftId = thriftId;
85
      _fieldName = fieldName;
86
    }
87
 
88
    public short getThriftFieldId() {
89
      return _thriftId;
90
    }
91
 
92
    public String getFieldName() {
93
      return _fieldName;
94
    }
95
  }
96
 
97
  // isset id assignments
98
  private static final int __PROVIDER_ID_ISSET_ID = 0;
99
  private BitSet __isset_bit_vector = new BitSet(1);
100
 
101
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
102
    put(_Fields.AWB, new FieldMetaData("awb", TFieldRequirementType.DEFAULT, 
103
        new FieldValueMetaData(TType.STRING)));
104
    put(_Fields.PROVIDER_ID, new FieldMetaData("provider_id", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.I64)));
106
    put(_Fields.UPDATES, new FieldMetaData("updates", TFieldRequirementType.DEFAULT, 
107
        new ListMetaData(TType.LIST, 
108
            new StructMetaData(TType.STRUCT, ShipmentUpdate.class))));
109
    put(_Fields.CURRENT_UPDATE, new FieldMetaData("currentUpdate", TFieldRequirementType.DEFAULT, 
110
        new StructMetaData(TType.STRUCT, ShipmentUpdate.class)));
111
  }});
112
 
113
  static {
114
    FieldMetaData.addStructMetaDataMap(ShipmentStatusInfo.class, metaDataMap);
115
  }
116
 
117
  public ShipmentStatusInfo() {
118
  }
119
 
120
  public ShipmentStatusInfo(
121
    String awb,
122
    long provider_id,
123
    List<ShipmentUpdate> updates,
124
    ShipmentUpdate currentUpdate)
125
  {
126
    this();
127
    this.awb = awb;
128
    this.provider_id = provider_id;
129
    setProvider_idIsSet(true);
130
    this.updates = updates;
131
    this.currentUpdate = currentUpdate;
132
  }
133
 
134
  /**
135
   * Performs a deep copy on <i>other</i>.
136
   */
137
  public ShipmentStatusInfo(ShipmentStatusInfo other) {
138
    __isset_bit_vector.clear();
139
    __isset_bit_vector.or(other.__isset_bit_vector);
140
    if (other.isSetAwb()) {
141
      this.awb = other.awb;
142
    }
143
    this.provider_id = other.provider_id;
144
    if (other.isSetUpdates()) {
145
      List<ShipmentUpdate> __this__updates = new ArrayList<ShipmentUpdate>();
146
      for (ShipmentUpdate other_element : other.updates) {
147
        __this__updates.add(new ShipmentUpdate(other_element));
148
      }
149
      this.updates = __this__updates;
150
    }
151
    if (other.isSetCurrentUpdate()) {
152
      this.currentUpdate = new ShipmentUpdate(other.currentUpdate);
153
    }
154
  }
155
 
156
  public ShipmentStatusInfo deepCopy() {
157
    return new ShipmentStatusInfo(this);
158
  }
159
 
160
  @Deprecated
161
  public ShipmentStatusInfo clone() {
162
    return new ShipmentStatusInfo(this);
163
  }
164
 
165
  public String getAwb() {
166
    return this.awb;
167
  }
168
 
169
  public ShipmentStatusInfo setAwb(String awb) {
170
    this.awb = awb;
171
    return this;
172
  }
173
 
174
  public void unsetAwb() {
175
    this.awb = null;
176
  }
177
 
178
  /** Returns true if field awb is set (has been asigned a value) and false otherwise */
179
  public boolean isSetAwb() {
180
    return this.awb != null;
181
  }
182
 
183
  public void setAwbIsSet(boolean value) {
184
    if (!value) {
185
      this.awb = null;
186
    }
187
  }
188
 
189
  public long getProvider_id() {
190
    return this.provider_id;
191
  }
192
 
193
  public ShipmentStatusInfo setProvider_id(long provider_id) {
194
    this.provider_id = provider_id;
195
    setProvider_idIsSet(true);
196
    return this;
197
  }
198
 
199
  public void unsetProvider_id() {
200
    __isset_bit_vector.clear(__PROVIDER_ID_ISSET_ID);
201
  }
202
 
203
  /** Returns true if field provider_id is set (has been asigned a value) and false otherwise */
204
  public boolean isSetProvider_id() {
205
    return __isset_bit_vector.get(__PROVIDER_ID_ISSET_ID);
206
  }
207
 
208
  public void setProvider_idIsSet(boolean value) {
209
    __isset_bit_vector.set(__PROVIDER_ID_ISSET_ID, value);
210
  }
211
 
212
  public int getUpdatesSize() {
213
    return (this.updates == null) ? 0 : this.updates.size();
214
  }
215
 
216
  public java.util.Iterator<ShipmentUpdate> getUpdatesIterator() {
217
    return (this.updates == null) ? null : this.updates.iterator();
218
  }
219
 
220
  public void addToUpdates(ShipmentUpdate elem) {
221
    if (this.updates == null) {
222
      this.updates = new ArrayList<ShipmentUpdate>();
223
    }
224
    this.updates.add(elem);
225
  }
226
 
227
  public List<ShipmentUpdate> getUpdates() {
228
    return this.updates;
229
  }
230
 
231
  public ShipmentStatusInfo setUpdates(List<ShipmentUpdate> updates) {
232
    this.updates = updates;
233
    return this;
234
  }
235
 
236
  public void unsetUpdates() {
237
    this.updates = null;
238
  }
239
 
240
  /** Returns true if field updates is set (has been asigned a value) and false otherwise */
241
  public boolean isSetUpdates() {
242
    return this.updates != null;
243
  }
244
 
245
  public void setUpdatesIsSet(boolean value) {
246
    if (!value) {
247
      this.updates = null;
248
    }
249
  }
250
 
251
  public ShipmentUpdate getCurrentUpdate() {
252
    return this.currentUpdate;
253
  }
254
 
255
  public ShipmentStatusInfo setCurrentUpdate(ShipmentUpdate currentUpdate) {
256
    this.currentUpdate = currentUpdate;
257
    return this;
258
  }
259
 
260
  public void unsetCurrentUpdate() {
261
    this.currentUpdate = null;
262
  }
263
 
264
  /** Returns true if field currentUpdate is set (has been asigned a value) and false otherwise */
265
  public boolean isSetCurrentUpdate() {
266
    return this.currentUpdate != null;
267
  }
268
 
269
  public void setCurrentUpdateIsSet(boolean value) {
270
    if (!value) {
271
      this.currentUpdate = null;
272
    }
273
  }
274
 
275
  public void setFieldValue(_Fields field, Object value) {
276
    switch (field) {
277
    case AWB:
278
      if (value == null) {
279
        unsetAwb();
280
      } else {
281
        setAwb((String)value);
282
      }
283
      break;
284
 
285
    case PROVIDER_ID:
286
      if (value == null) {
287
        unsetProvider_id();
288
      } else {
289
        setProvider_id((Long)value);
290
      }
291
      break;
292
 
293
    case UPDATES:
294
      if (value == null) {
295
        unsetUpdates();
296
      } else {
297
        setUpdates((List<ShipmentUpdate>)value);
298
      }
299
      break;
300
 
301
    case CURRENT_UPDATE:
302
      if (value == null) {
303
        unsetCurrentUpdate();
304
      } else {
305
        setCurrentUpdate((ShipmentUpdate)value);
306
      }
307
      break;
308
 
309
    }
310
  }
311
 
312
  public void setFieldValue(int fieldID, Object value) {
313
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
314
  }
315
 
316
  public Object getFieldValue(_Fields field) {
317
    switch (field) {
318
    case AWB:
319
      return getAwb();
320
 
321
    case PROVIDER_ID:
322
      return new Long(getProvider_id());
323
 
324
    case UPDATES:
325
      return getUpdates();
326
 
327
    case CURRENT_UPDATE:
328
      return getCurrentUpdate();
329
 
330
    }
331
    throw new IllegalStateException();
332
  }
333
 
334
  public Object getFieldValue(int fieldId) {
335
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
336
  }
337
 
338
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
339
  public boolean isSet(_Fields field) {
340
    switch (field) {
341
    case AWB:
342
      return isSetAwb();
343
    case PROVIDER_ID:
344
      return isSetProvider_id();
345
    case UPDATES:
346
      return isSetUpdates();
347
    case CURRENT_UPDATE:
348
      return isSetCurrentUpdate();
349
    }
350
    throw new IllegalStateException();
351
  }
352
 
353
  public boolean isSet(int fieldID) {
354
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
355
  }
356
 
357
  @Override
358
  public boolean equals(Object that) {
359
    if (that == null)
360
      return false;
361
    if (that instanceof ShipmentStatusInfo)
362
      return this.equals((ShipmentStatusInfo)that);
363
    return false;
364
  }
365
 
366
  public boolean equals(ShipmentStatusInfo that) {
367
    if (that == null)
368
      return false;
369
 
370
    boolean this_present_awb = true && this.isSetAwb();
371
    boolean that_present_awb = true && that.isSetAwb();
372
    if (this_present_awb || that_present_awb) {
373
      if (!(this_present_awb && that_present_awb))
374
        return false;
375
      if (!this.awb.equals(that.awb))
376
        return false;
377
    }
378
 
379
    boolean this_present_provider_id = true;
380
    boolean that_present_provider_id = true;
381
    if (this_present_provider_id || that_present_provider_id) {
382
      if (!(this_present_provider_id && that_present_provider_id))
383
        return false;
384
      if (this.provider_id != that.provider_id)
385
        return false;
386
    }
387
 
388
    boolean this_present_updates = true && this.isSetUpdates();
389
    boolean that_present_updates = true && that.isSetUpdates();
390
    if (this_present_updates || that_present_updates) {
391
      if (!(this_present_updates && that_present_updates))
392
        return false;
393
      if (!this.updates.equals(that.updates))
394
        return false;
395
    }
396
 
397
    boolean this_present_currentUpdate = true && this.isSetCurrentUpdate();
398
    boolean that_present_currentUpdate = true && that.isSetCurrentUpdate();
399
    if (this_present_currentUpdate || that_present_currentUpdate) {
400
      if (!(this_present_currentUpdate && that_present_currentUpdate))
401
        return false;
402
      if (!this.currentUpdate.equals(that.currentUpdate))
403
        return false;
404
    }
405
 
406
    return true;
407
  }
408
 
409
  @Override
410
  public int hashCode() {
411
    return 0;
412
  }
413
 
414
  public int compareTo(ShipmentStatusInfo other) {
415
    if (!getClass().equals(other.getClass())) {
416
      return getClass().getName().compareTo(other.getClass().getName());
417
    }
418
 
419
    int lastComparison = 0;
420
    ShipmentStatusInfo typedOther = (ShipmentStatusInfo)other;
421
 
422
    lastComparison = Boolean.valueOf(isSetAwb()).compareTo(isSetAwb());
423
    if (lastComparison != 0) {
424
      return lastComparison;
425
    }
426
    lastComparison = TBaseHelper.compareTo(awb, typedOther.awb);
427
    if (lastComparison != 0) {
428
      return lastComparison;
429
    }
430
    lastComparison = Boolean.valueOf(isSetProvider_id()).compareTo(isSetProvider_id());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    lastComparison = TBaseHelper.compareTo(provider_id, typedOther.provider_id);
435
    if (lastComparison != 0) {
436
      return lastComparison;
437
    }
438
    lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(isSetUpdates());
439
    if (lastComparison != 0) {
440
      return lastComparison;
441
    }
442
    lastComparison = TBaseHelper.compareTo(updates, typedOther.updates);
443
    if (lastComparison != 0) {
444
      return lastComparison;
445
    }
446
    lastComparison = Boolean.valueOf(isSetCurrentUpdate()).compareTo(isSetCurrentUpdate());
447
    if (lastComparison != 0) {
448
      return lastComparison;
449
    }
450
    lastComparison = TBaseHelper.compareTo(currentUpdate, typedOther.currentUpdate);
451
    if (lastComparison != 0) {
452
      return lastComparison;
453
    }
454
    return 0;
455
  }
456
 
457
  public void read(TProtocol iprot) throws TException {
458
    TField field;
459
    iprot.readStructBegin();
460
    while (true)
461
    {
462
      field = iprot.readFieldBegin();
463
      if (field.type == TType.STOP) { 
464
        break;
465
      }
466
      _Fields fieldId = _Fields.findByThriftId(field.id);
467
      if (fieldId == null) {
468
        TProtocolUtil.skip(iprot, field.type);
469
      } else {
470
        switch (fieldId) {
471
          case AWB:
472
            if (field.type == TType.STRING) {
473
              this.awb = iprot.readString();
474
            } else { 
475
              TProtocolUtil.skip(iprot, field.type);
476
            }
477
            break;
478
          case PROVIDER_ID:
479
            if (field.type == TType.I64) {
480
              this.provider_id = iprot.readI64();
481
              setProvider_idIsSet(true);
482
            } else { 
483
              TProtocolUtil.skip(iprot, field.type);
484
            }
485
            break;
486
          case UPDATES:
487
            if (field.type == TType.LIST) {
488
              {
489
                TList _list0 = iprot.readListBegin();
490
                this.updates = new ArrayList<ShipmentUpdate>(_list0.size);
491
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
492
                {
493
                  ShipmentUpdate _elem2;
494
                  _elem2 = new ShipmentUpdate();
495
                  _elem2.read(iprot);
496
                  this.updates.add(_elem2);
497
                }
498
                iprot.readListEnd();
499
              }
500
            } else { 
501
              TProtocolUtil.skip(iprot, field.type);
502
            }
503
            break;
504
          case CURRENT_UPDATE:
505
            if (field.type == TType.STRUCT) {
506
              this.currentUpdate = new ShipmentUpdate();
507
              this.currentUpdate.read(iprot);
508
            } else { 
509
              TProtocolUtil.skip(iprot, field.type);
510
            }
511
            break;
512
        }
513
        iprot.readFieldEnd();
514
      }
515
    }
516
    iprot.readStructEnd();
517
    validate();
518
  }
519
 
520
  public void write(TProtocol oprot) throws TException {
521
    validate();
522
 
523
    oprot.writeStructBegin(STRUCT_DESC);
524
    if (this.awb != null) {
525
      oprot.writeFieldBegin(AWB_FIELD_DESC);
526
      oprot.writeString(this.awb);
527
      oprot.writeFieldEnd();
528
    }
529
    oprot.writeFieldBegin(PROVIDER_ID_FIELD_DESC);
530
    oprot.writeI64(this.provider_id);
531
    oprot.writeFieldEnd();
532
    if (this.updates != null) {
533
      oprot.writeFieldBegin(UPDATES_FIELD_DESC);
534
      {
535
        oprot.writeListBegin(new TList(TType.STRUCT, this.updates.size()));
536
        for (ShipmentUpdate _iter3 : this.updates)
537
        {
538
          _iter3.write(oprot);
539
        }
540
        oprot.writeListEnd();
541
      }
542
      oprot.writeFieldEnd();
543
    }
544
    if (this.currentUpdate != null) {
545
      oprot.writeFieldBegin(CURRENT_UPDATE_FIELD_DESC);
546
      this.currentUpdate.write(oprot);
547
      oprot.writeFieldEnd();
548
    }
549
    oprot.writeFieldStop();
550
    oprot.writeStructEnd();
551
  }
552
 
553
  @Override
554
  public String toString() {
555
    StringBuilder sb = new StringBuilder("ShipmentStatusInfo(");
556
    boolean first = true;
557
 
558
    sb.append("awb:");
559
    if (this.awb == null) {
560
      sb.append("null");
561
    } else {
562
      sb.append(this.awb);
563
    }
564
    first = false;
565
    if (!first) sb.append(", ");
566
    sb.append("provider_id:");
567
    sb.append(this.provider_id);
568
    first = false;
569
    if (!first) sb.append(", ");
570
    sb.append("updates:");
571
    if (this.updates == null) {
572
      sb.append("null");
573
    } else {
574
      sb.append(this.updates);
575
    }
576
    first = false;
577
    if (!first) sb.append(", ");
578
    sb.append("currentUpdate:");
579
    if (this.currentUpdate == null) {
580
      sb.append("null");
581
    } else {
582
      sb.append(this.currentUpdate);
583
    }
584
    first = false;
585
    sb.append(")");
586
    return sb.toString();
587
  }
588
 
589
  public void validate() throws TException {
590
    // check for required fields
591
  }
592
 
593
}
594