Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
100 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.model.v1.catalog;
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 Category implements TBase<Category._Fields>, java.io.Serializable, Cloneable, Comparable<Category> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Category");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
31
  private static final TField CHILD_CATEGORIES_FIELD_DESC = new TField("childCategories", TType.LIST, (short)3);
32
  private static final TField PARENT_ID_FIELD_DESC = new TField("parent_id", TType.I64, (short)4);
33
  private static final TField IS_TOP_LEVEL_FIELD_DESC = new TField("isTopLevel", TType.BOOL, (short)5);
34
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)6);
103 ashish 35
  private static final TField CATEGORY_STATUS_FIELD_DESC = new TField("categoryStatus", TType.I32, (short)7);
100 ashish 36
 
37
  private long id;
38
  private String name;
39
  private List<Long> childCategories;
40
  private long parent_id;
41
  private boolean isTopLevel;
42
  private long addedOn;
103 ashish 43
  private status categoryStatus;
100 ashish 44
 
45
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
46
  public enum _Fields implements TFieldIdEnum {
47
    ID((short)1, "id"),
48
    NAME((short)2, "name"),
49
    CHILD_CATEGORIES((short)3, "childCategories"),
50
    PARENT_ID((short)4, "parent_id"),
51
    IS_TOP_LEVEL((short)5, "isTopLevel"),
103 ashish 52
    ADDED_ON((short)6, "addedOn"),
53
    /**
54
     * 
55
     * @see status
56
     */
57
    CATEGORY_STATUS((short)7, "categoryStatus");
100 ashish 58
 
59
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
60
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
61
 
62
    static {
63
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
64
        byId.put((int)field._thriftId, field);
65
        byName.put(field.getFieldName(), field);
66
      }
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, or null if its not found.
71
     */
72
    public static _Fields findByThriftId(int fieldId) {
73
      return byId.get(fieldId);
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches fieldId, throwing an exception
78
     * if it is not found.
79
     */
80
    public static _Fields findByThriftIdOrThrow(int fieldId) {
81
      _Fields fields = findByThriftId(fieldId);
82
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
83
      return fields;
84
    }
85
 
86
    /**
87
     * Find the _Fields constant that matches name, or null if its not found.
88
     */
89
    public static _Fields findByName(String name) {
90
      return byName.get(name);
91
    }
92
 
93
    private final short _thriftId;
94
    private final String _fieldName;
95
 
96
    _Fields(short thriftId, String fieldName) {
97
      _thriftId = thriftId;
98
      _fieldName = fieldName;
99
    }
100
 
101
    public short getThriftFieldId() {
102
      return _thriftId;
103
    }
104
 
105
    public String getFieldName() {
106
      return _fieldName;
107
    }
108
  }
109
 
110
  // isset id assignments
111
  private static final int __ID_ISSET_ID = 0;
112
  private static final int __PARENT_ID_ISSET_ID = 1;
113
  private static final int __ISTOPLEVEL_ISSET_ID = 2;
114
  private static final int __ADDEDON_ISSET_ID = 3;
115
  private BitSet __isset_bit_vector = new BitSet(4);
116
 
117
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
118
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.I64)));
120
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
121
        new FieldValueMetaData(TType.STRING)));
122
    put(_Fields.CHILD_CATEGORIES, new FieldMetaData("childCategories", TFieldRequirementType.DEFAULT, 
123
        new ListMetaData(TType.LIST, 
124
            new FieldValueMetaData(TType.I64))));
125
    put(_Fields.PARENT_ID, new FieldMetaData("parent_id", TFieldRequirementType.DEFAULT, 
126
        new FieldValueMetaData(TType.I64)));
127
    put(_Fields.IS_TOP_LEVEL, new FieldMetaData("isTopLevel", TFieldRequirementType.DEFAULT, 
128
        new FieldValueMetaData(TType.BOOL)));
129
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
130
        new FieldValueMetaData(TType.I64)));
103 ashish 131
    put(_Fields.CATEGORY_STATUS, new FieldMetaData("categoryStatus", TFieldRequirementType.DEFAULT, 
132
        new EnumMetaData(TType.ENUM, status.class)));
100 ashish 133
  }});
134
 
135
  static {
136
    FieldMetaData.addStructMetaDataMap(Category.class, metaDataMap);
137
  }
138
 
139
  public Category() {
140
  }
141
 
142
  public Category(
143
    long id,
144
    String name,
145
    List<Long> childCategories,
146
    long parent_id,
147
    boolean isTopLevel,
103 ashish 148
    long addedOn,
149
    status categoryStatus)
100 ashish 150
  {
151
    this();
152
    this.id = id;
153
    setIdIsSet(true);
154
    this.name = name;
155
    this.childCategories = childCategories;
156
    this.parent_id = parent_id;
157
    setParent_idIsSet(true);
158
    this.isTopLevel = isTopLevel;
159
    setIsTopLevelIsSet(true);
160
    this.addedOn = addedOn;
161
    setAddedOnIsSet(true);
103 ashish 162
    this.categoryStatus = categoryStatus;
100 ashish 163
  }
164
 
165
  /**
166
   * Performs a deep copy on <i>other</i>.
167
   */
168
  public Category(Category other) {
169
    __isset_bit_vector.clear();
170
    __isset_bit_vector.or(other.__isset_bit_vector);
171
    this.id = other.id;
172
    if (other.isSetName()) {
173
      this.name = other.name;
174
    }
175
    if (other.isSetChildCategories()) {
176
      List<Long> __this__childCategories = new ArrayList<Long>();
177
      for (Long other_element : other.childCategories) {
178
        __this__childCategories.add(other_element);
179
      }
180
      this.childCategories = __this__childCategories;
181
    }
182
    this.parent_id = other.parent_id;
183
    this.isTopLevel = other.isTopLevel;
184
    this.addedOn = other.addedOn;
103 ashish 185
    if (other.isSetCategoryStatus()) {
186
      this.categoryStatus = other.categoryStatus;
187
    }
100 ashish 188
  }
189
 
190
  public Category deepCopy() {
191
    return new Category(this);
192
  }
193
 
194
  @Deprecated
195
  public Category clone() {
196
    return new Category(this);
197
  }
198
 
199
  public long getId() {
200
    return this.id;
201
  }
202
 
203
  public Category setId(long id) {
204
    this.id = id;
205
    setIdIsSet(true);
206
    return this;
207
  }
208
 
209
  public void unsetId() {
210
    __isset_bit_vector.clear(__ID_ISSET_ID);
211
  }
212
 
213
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
214
  public boolean isSetId() {
215
    return __isset_bit_vector.get(__ID_ISSET_ID);
216
  }
217
 
218
  public void setIdIsSet(boolean value) {
219
    __isset_bit_vector.set(__ID_ISSET_ID, value);
220
  }
221
 
222
  public String getName() {
223
    return this.name;
224
  }
225
 
226
  public Category setName(String name) {
227
    this.name = name;
228
    return this;
229
  }
230
 
231
  public void unsetName() {
232
    this.name = null;
233
  }
234
 
235
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
236
  public boolean isSetName() {
237
    return this.name != null;
238
  }
239
 
240
  public void setNameIsSet(boolean value) {
241
    if (!value) {
242
      this.name = null;
243
    }
244
  }
245
 
246
  public int getChildCategoriesSize() {
247
    return (this.childCategories == null) ? 0 : this.childCategories.size();
248
  }
249
 
250
  public java.util.Iterator<Long> getChildCategoriesIterator() {
251
    return (this.childCategories == null) ? null : this.childCategories.iterator();
252
  }
253
 
254
  public void addToChildCategories(long elem) {
255
    if (this.childCategories == null) {
256
      this.childCategories = new ArrayList<Long>();
257
    }
258
    this.childCategories.add(elem);
259
  }
260
 
261
  public List<Long> getChildCategories() {
262
    return this.childCategories;
263
  }
264
 
265
  public Category setChildCategories(List<Long> childCategories) {
266
    this.childCategories = childCategories;
267
    return this;
268
  }
269
 
270
  public void unsetChildCategories() {
271
    this.childCategories = null;
272
  }
273
 
274
  /** Returns true if field childCategories is set (has been asigned a value) and false otherwise */
275
  public boolean isSetChildCategories() {
276
    return this.childCategories != null;
277
  }
278
 
279
  public void setChildCategoriesIsSet(boolean value) {
280
    if (!value) {
281
      this.childCategories = null;
282
    }
283
  }
284
 
285
  public long getParent_id() {
286
    return this.parent_id;
287
  }
288
 
289
  public Category setParent_id(long parent_id) {
290
    this.parent_id = parent_id;
291
    setParent_idIsSet(true);
292
    return this;
293
  }
294
 
295
  public void unsetParent_id() {
296
    __isset_bit_vector.clear(__PARENT_ID_ISSET_ID);
297
  }
298
 
299
  /** Returns true if field parent_id is set (has been asigned a value) and false otherwise */
300
  public boolean isSetParent_id() {
301
    return __isset_bit_vector.get(__PARENT_ID_ISSET_ID);
302
  }
303
 
304
  public void setParent_idIsSet(boolean value) {
305
    __isset_bit_vector.set(__PARENT_ID_ISSET_ID, value);
306
  }
307
 
308
  public boolean isIsTopLevel() {
309
    return this.isTopLevel;
310
  }
311
 
312
  public Category setIsTopLevel(boolean isTopLevel) {
313
    this.isTopLevel = isTopLevel;
314
    setIsTopLevelIsSet(true);
315
    return this;
316
  }
317
 
318
  public void unsetIsTopLevel() {
319
    __isset_bit_vector.clear(__ISTOPLEVEL_ISSET_ID);
320
  }
321
 
322
  /** Returns true if field isTopLevel is set (has been asigned a value) and false otherwise */
323
  public boolean isSetIsTopLevel() {
324
    return __isset_bit_vector.get(__ISTOPLEVEL_ISSET_ID);
325
  }
326
 
327
  public void setIsTopLevelIsSet(boolean value) {
328
    __isset_bit_vector.set(__ISTOPLEVEL_ISSET_ID, value);
329
  }
330
 
331
  public long getAddedOn() {
332
    return this.addedOn;
333
  }
334
 
335
  public Category setAddedOn(long addedOn) {
336
    this.addedOn = addedOn;
337
    setAddedOnIsSet(true);
338
    return this;
339
  }
340
 
341
  public void unsetAddedOn() {
342
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
343
  }
344
 
345
  /** Returns true if field addedOn is set (has been asigned a value) and false otherwise */
346
  public boolean isSetAddedOn() {
347
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
348
  }
349
 
350
  public void setAddedOnIsSet(boolean value) {
351
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
352
  }
353
 
103 ashish 354
  /**
355
   * 
356
   * @see status
357
   */
358
  public status getCategoryStatus() {
359
    return this.categoryStatus;
360
  }
361
 
362
  /**
363
   * 
364
   * @see status
365
   */
366
  public Category setCategoryStatus(status categoryStatus) {
367
    this.categoryStatus = categoryStatus;
368
    return this;
369
  }
370
 
371
  public void unsetCategoryStatus() {
372
    this.categoryStatus = null;
373
  }
374
 
375
  /** Returns true if field categoryStatus is set (has been asigned a value) and false otherwise */
376
  public boolean isSetCategoryStatus() {
377
    return this.categoryStatus != null;
378
  }
379
 
380
  public void setCategoryStatusIsSet(boolean value) {
381
    if (!value) {
382
      this.categoryStatus = null;
383
    }
384
  }
385
 
100 ashish 386
  public void setFieldValue(_Fields field, Object value) {
387
    switch (field) {
388
    case ID:
389
      if (value == null) {
390
        unsetId();
391
      } else {
392
        setId((Long)value);
393
      }
394
      break;
395
 
396
    case NAME:
397
      if (value == null) {
398
        unsetName();
399
      } else {
400
        setName((String)value);
401
      }
402
      break;
403
 
404
    case CHILD_CATEGORIES:
405
      if (value == null) {
406
        unsetChildCategories();
407
      } else {
408
        setChildCategories((List<Long>)value);
409
      }
410
      break;
411
 
412
    case PARENT_ID:
413
      if (value == null) {
414
        unsetParent_id();
415
      } else {
416
        setParent_id((Long)value);
417
      }
418
      break;
419
 
420
    case IS_TOP_LEVEL:
421
      if (value == null) {
422
        unsetIsTopLevel();
423
      } else {
424
        setIsTopLevel((Boolean)value);
425
      }
426
      break;
427
 
428
    case ADDED_ON:
429
      if (value == null) {
430
        unsetAddedOn();
431
      } else {
432
        setAddedOn((Long)value);
433
      }
434
      break;
435
 
103 ashish 436
    case CATEGORY_STATUS:
437
      if (value == null) {
438
        unsetCategoryStatus();
439
      } else {
440
        setCategoryStatus((status)value);
441
      }
442
      break;
443
 
100 ashish 444
    }
445
  }
446
 
447
  public void setFieldValue(int fieldID, Object value) {
448
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
449
  }
450
 
451
  public Object getFieldValue(_Fields field) {
452
    switch (field) {
453
    case ID:
454
      return new Long(getId());
455
 
456
    case NAME:
457
      return getName();
458
 
459
    case CHILD_CATEGORIES:
460
      return getChildCategories();
461
 
462
    case PARENT_ID:
463
      return new Long(getParent_id());
464
 
465
    case IS_TOP_LEVEL:
466
      return new Boolean(isIsTopLevel());
467
 
468
    case ADDED_ON:
469
      return new Long(getAddedOn());
470
 
103 ashish 471
    case CATEGORY_STATUS:
472
      return getCategoryStatus();
473
 
100 ashish 474
    }
475
    throw new IllegalStateException();
476
  }
477
 
478
  public Object getFieldValue(int fieldId) {
479
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
480
  }
481
 
482
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
483
  public boolean isSet(_Fields field) {
484
    switch (field) {
485
    case ID:
486
      return isSetId();
487
    case NAME:
488
      return isSetName();
489
    case CHILD_CATEGORIES:
490
      return isSetChildCategories();
491
    case PARENT_ID:
492
      return isSetParent_id();
493
    case IS_TOP_LEVEL:
494
      return isSetIsTopLevel();
495
    case ADDED_ON:
496
      return isSetAddedOn();
103 ashish 497
    case CATEGORY_STATUS:
498
      return isSetCategoryStatus();
100 ashish 499
    }
500
    throw new IllegalStateException();
501
  }
502
 
503
  public boolean isSet(int fieldID) {
504
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
505
  }
506
 
507
  @Override
508
  public boolean equals(Object that) {
509
    if (that == null)
510
      return false;
511
    if (that instanceof Category)
512
      return this.equals((Category)that);
513
    return false;
514
  }
515
 
516
  public boolean equals(Category that) {
517
    if (that == null)
518
      return false;
519
 
520
    boolean this_present_id = true;
521
    boolean that_present_id = true;
522
    if (this_present_id || that_present_id) {
523
      if (!(this_present_id && that_present_id))
524
        return false;
525
      if (this.id != that.id)
526
        return false;
527
    }
528
 
529
    boolean this_present_name = true && this.isSetName();
530
    boolean that_present_name = true && that.isSetName();
531
    if (this_present_name || that_present_name) {
532
      if (!(this_present_name && that_present_name))
533
        return false;
534
      if (!this.name.equals(that.name))
535
        return false;
536
    }
537
 
538
    boolean this_present_childCategories = true && this.isSetChildCategories();
539
    boolean that_present_childCategories = true && that.isSetChildCategories();
540
    if (this_present_childCategories || that_present_childCategories) {
541
      if (!(this_present_childCategories && that_present_childCategories))
542
        return false;
543
      if (!this.childCategories.equals(that.childCategories))
544
        return false;
545
    }
546
 
547
    boolean this_present_parent_id = true;
548
    boolean that_present_parent_id = true;
549
    if (this_present_parent_id || that_present_parent_id) {
550
      if (!(this_present_parent_id && that_present_parent_id))
551
        return false;
552
      if (this.parent_id != that.parent_id)
553
        return false;
554
    }
555
 
556
    boolean this_present_isTopLevel = true;
557
    boolean that_present_isTopLevel = true;
558
    if (this_present_isTopLevel || that_present_isTopLevel) {
559
      if (!(this_present_isTopLevel && that_present_isTopLevel))
560
        return false;
561
      if (this.isTopLevel != that.isTopLevel)
562
        return false;
563
    }
564
 
565
    boolean this_present_addedOn = true;
566
    boolean that_present_addedOn = true;
567
    if (this_present_addedOn || that_present_addedOn) {
568
      if (!(this_present_addedOn && that_present_addedOn))
569
        return false;
570
      if (this.addedOn != that.addedOn)
571
        return false;
572
    }
573
 
103 ashish 574
    boolean this_present_categoryStatus = true && this.isSetCategoryStatus();
575
    boolean that_present_categoryStatus = true && that.isSetCategoryStatus();
576
    if (this_present_categoryStatus || that_present_categoryStatus) {
577
      if (!(this_present_categoryStatus && that_present_categoryStatus))
578
        return false;
579
      if (!this.categoryStatus.equals(that.categoryStatus))
580
        return false;
581
    }
582
 
100 ashish 583
    return true;
584
  }
585
 
586
  @Override
587
  public int hashCode() {
588
    return 0;
589
  }
590
 
591
  public int compareTo(Category other) {
592
    if (!getClass().equals(other.getClass())) {
593
      return getClass().getName().compareTo(other.getClass().getName());
594
    }
595
 
596
    int lastComparison = 0;
597
    Category typedOther = (Category)other;
598
 
599
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
600
    if (lastComparison != 0) {
601
      return lastComparison;
602
    }
603
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
604
    if (lastComparison != 0) {
605
      return lastComparison;
606
    }
607
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
608
    if (lastComparison != 0) {
609
      return lastComparison;
610
    }
611
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
612
    if (lastComparison != 0) {
613
      return lastComparison;
614
    }
615
    lastComparison = Boolean.valueOf(isSetChildCategories()).compareTo(isSetChildCategories());
616
    if (lastComparison != 0) {
617
      return lastComparison;
618
    }
619
    lastComparison = TBaseHelper.compareTo(childCategories, typedOther.childCategories);
620
    if (lastComparison != 0) {
621
      return lastComparison;
622
    }
623
    lastComparison = Boolean.valueOf(isSetParent_id()).compareTo(isSetParent_id());
624
    if (lastComparison != 0) {
625
      return lastComparison;
626
    }
627
    lastComparison = TBaseHelper.compareTo(parent_id, typedOther.parent_id);
628
    if (lastComparison != 0) {
629
      return lastComparison;
630
    }
631
    lastComparison = Boolean.valueOf(isSetIsTopLevel()).compareTo(isSetIsTopLevel());
632
    if (lastComparison != 0) {
633
      return lastComparison;
634
    }
635
    lastComparison = TBaseHelper.compareTo(isTopLevel, typedOther.isTopLevel);
636
    if (lastComparison != 0) {
637
      return lastComparison;
638
    }
639
    lastComparison = Boolean.valueOf(isSetAddedOn()).compareTo(isSetAddedOn());
640
    if (lastComparison != 0) {
641
      return lastComparison;
642
    }
643
    lastComparison = TBaseHelper.compareTo(addedOn, typedOther.addedOn);
644
    if (lastComparison != 0) {
645
      return lastComparison;
646
    }
103 ashish 647
    lastComparison = Boolean.valueOf(isSetCategoryStatus()).compareTo(isSetCategoryStatus());
648
    if (lastComparison != 0) {
649
      return lastComparison;
650
    }
651
    lastComparison = TBaseHelper.compareTo(categoryStatus, typedOther.categoryStatus);
652
    if (lastComparison != 0) {
653
      return lastComparison;
654
    }
100 ashish 655
    return 0;
656
  }
657
 
658
  public void read(TProtocol iprot) throws TException {
659
    TField field;
660
    iprot.readStructBegin();
661
    while (true)
662
    {
663
      field = iprot.readFieldBegin();
664
      if (field.type == TType.STOP) { 
665
        break;
666
      }
667
      _Fields fieldId = _Fields.findByThriftId(field.id);
668
      if (fieldId == null) {
669
        TProtocolUtil.skip(iprot, field.type);
670
      } else {
671
        switch (fieldId) {
672
          case ID:
673
            if (field.type == TType.I64) {
674
              this.id = iprot.readI64();
675
              setIdIsSet(true);
676
            } else { 
677
              TProtocolUtil.skip(iprot, field.type);
678
            }
679
            break;
680
          case NAME:
681
            if (field.type == TType.STRING) {
682
              this.name = iprot.readString();
683
            } else { 
684
              TProtocolUtil.skip(iprot, field.type);
685
            }
686
            break;
687
          case CHILD_CATEGORIES:
688
            if (field.type == TType.LIST) {
689
              {
690
                TList _list0 = iprot.readListBegin();
691
                this.childCategories = new ArrayList<Long>(_list0.size);
692
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
693
                {
694
                  long _elem2;
695
                  _elem2 = iprot.readI64();
696
                  this.childCategories.add(_elem2);
697
                }
698
                iprot.readListEnd();
699
              }
700
            } else { 
701
              TProtocolUtil.skip(iprot, field.type);
702
            }
703
            break;
704
          case PARENT_ID:
705
            if (field.type == TType.I64) {
706
              this.parent_id = iprot.readI64();
707
              setParent_idIsSet(true);
708
            } else { 
709
              TProtocolUtil.skip(iprot, field.type);
710
            }
711
            break;
712
          case IS_TOP_LEVEL:
713
            if (field.type == TType.BOOL) {
714
              this.isTopLevel = iprot.readBool();
715
              setIsTopLevelIsSet(true);
716
            } else { 
717
              TProtocolUtil.skip(iprot, field.type);
718
            }
719
            break;
720
          case ADDED_ON:
721
            if (field.type == TType.I64) {
722
              this.addedOn = iprot.readI64();
723
              setAddedOnIsSet(true);
724
            } else { 
725
              TProtocolUtil.skip(iprot, field.type);
726
            }
727
            break;
103 ashish 728
          case CATEGORY_STATUS:
729
            if (field.type == TType.I32) {
730
              this.categoryStatus = status.findByValue(iprot.readI32());
731
            } else { 
732
              TProtocolUtil.skip(iprot, field.type);
733
            }
734
            break;
100 ashish 735
        }
736
        iprot.readFieldEnd();
737
      }
738
    }
739
    iprot.readStructEnd();
740
    validate();
741
  }
742
 
743
  public void write(TProtocol oprot) throws TException {
744
    validate();
745
 
746
    oprot.writeStructBegin(STRUCT_DESC);
747
    oprot.writeFieldBegin(ID_FIELD_DESC);
748
    oprot.writeI64(this.id);
749
    oprot.writeFieldEnd();
750
    if (this.name != null) {
751
      oprot.writeFieldBegin(NAME_FIELD_DESC);
752
      oprot.writeString(this.name);
753
      oprot.writeFieldEnd();
754
    }
755
    if (this.childCategories != null) {
756
      oprot.writeFieldBegin(CHILD_CATEGORIES_FIELD_DESC);
757
      {
758
        oprot.writeListBegin(new TList(TType.I64, this.childCategories.size()));
759
        for (long _iter3 : this.childCategories)
760
        {
761
          oprot.writeI64(_iter3);
762
        }
763
        oprot.writeListEnd();
764
      }
765
      oprot.writeFieldEnd();
766
    }
767
    oprot.writeFieldBegin(PARENT_ID_FIELD_DESC);
768
    oprot.writeI64(this.parent_id);
769
    oprot.writeFieldEnd();
770
    oprot.writeFieldBegin(IS_TOP_LEVEL_FIELD_DESC);
771
    oprot.writeBool(this.isTopLevel);
772
    oprot.writeFieldEnd();
773
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
774
    oprot.writeI64(this.addedOn);
775
    oprot.writeFieldEnd();
103 ashish 776
    if (this.categoryStatus != null) {
777
      oprot.writeFieldBegin(CATEGORY_STATUS_FIELD_DESC);
778
      oprot.writeI32(this.categoryStatus.getValue());
779
      oprot.writeFieldEnd();
780
    }
100 ashish 781
    oprot.writeFieldStop();
782
    oprot.writeStructEnd();
783
  }
784
 
785
  @Override
786
  public String toString() {
787
    StringBuilder sb = new StringBuilder("Category(");
788
    boolean first = true;
789
 
790
    sb.append("id:");
791
    sb.append(this.id);
792
    first = false;
793
    if (!first) sb.append(", ");
794
    sb.append("name:");
795
    if (this.name == null) {
796
      sb.append("null");
797
    } else {
798
      sb.append(this.name);
799
    }
800
    first = false;
801
    if (!first) sb.append(", ");
802
    sb.append("childCategories:");
803
    if (this.childCategories == null) {
804
      sb.append("null");
805
    } else {
806
      sb.append(this.childCategories);
807
    }
808
    first = false;
809
    if (!first) sb.append(", ");
810
    sb.append("parent_id:");
811
    sb.append(this.parent_id);
812
    first = false;
813
    if (!first) sb.append(", ");
814
    sb.append("isTopLevel:");
815
    sb.append(this.isTopLevel);
816
    first = false;
817
    if (!first) sb.append(", ");
818
    sb.append("addedOn:");
819
    sb.append(this.addedOn);
820
    first = false;
103 ashish 821
    if (!first) sb.append(", ");
822
    sb.append("categoryStatus:");
823
    if (this.categoryStatus == null) {
824
      sb.append("null");
825
    } else {
826
      String categoryStatus_name = categoryStatus.name();
827
      if (categoryStatus_name != null) {
828
        sb.append(categoryStatus_name);
829
        sb.append(" (");
830
      }
831
      sb.append(this.categoryStatus);
832
      if (categoryStatus_name != null) {
833
        sb.append(")");
834
      }
835
    }
836
    first = false;
100 ashish 837
    sb.append(")");
838
    return sb.toString();
839
  }
840
 
841
  public void validate() throws TException {
842
    // check for required fields
843
  }
844
 
845
}
846