Subversion Repositories SmartDukaan

Rev

Rev 100 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 100 Rev 103
Line 21... Line 21...
21
 
21
 
22
import org.apache.thrift.*;
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
24
import org.apache.thrift.protocol.*;
25
 
25
 
26
/**
-
 
27
 * Objects
-
 
28
 */
-
 
29
public class Category implements TBase<Category._Fields>, java.io.Serializable, Cloneable, Comparable<Category> {
26
public class Category implements TBase<Category._Fields>, java.io.Serializable, Cloneable, Comparable<Category> {
30
  private static final TStruct STRUCT_DESC = new TStruct("Category");
27
  private static final TStruct STRUCT_DESC = new TStruct("Category");
31
 
28
 
32
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
33
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
30
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
34
  private static final TField CHILD_CATEGORIES_FIELD_DESC = new TField("childCategories", TType.LIST, (short)3);
31
  private static final TField CHILD_CATEGORIES_FIELD_DESC = new TField("childCategories", TType.LIST, (short)3);
35
  private static final TField PARENT_ID_FIELD_DESC = new TField("parent_id", TType.I64, (short)4);
32
  private static final TField PARENT_ID_FIELD_DESC = new TField("parent_id", TType.I64, (short)4);
36
  private static final TField IS_TOP_LEVEL_FIELD_DESC = new TField("isTopLevel", TType.BOOL, (short)5);
33
  private static final TField IS_TOP_LEVEL_FIELD_DESC = new TField("isTopLevel", TType.BOOL, (short)5);
37
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)6);
34
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)6);
-
 
35
  private static final TField CATEGORY_STATUS_FIELD_DESC = new TField("categoryStatus", TType.I32, (short)7);
38
 
36
 
39
  private long id;
37
  private long id;
40
  private String name;
38
  private String name;
41
  private List<Long> childCategories;
39
  private List<Long> childCategories;
42
  private long parent_id;
40
  private long parent_id;
43
  private boolean isTopLevel;
41
  private boolean isTopLevel;
44
  private long addedOn;
42
  private long addedOn;
-
 
43
  private status categoryStatus;
45
 
44
 
46
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
45
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
47
  public enum _Fields implements TFieldIdEnum {
46
  public enum _Fields implements TFieldIdEnum {
48
    ID((short)1, "id"),
47
    ID((short)1, "id"),
49
    NAME((short)2, "name"),
48
    NAME((short)2, "name"),
50
    CHILD_CATEGORIES((short)3, "childCategories"),
49
    CHILD_CATEGORIES((short)3, "childCategories"),
51
    PARENT_ID((short)4, "parent_id"),
50
    PARENT_ID((short)4, "parent_id"),
52
    IS_TOP_LEVEL((short)5, "isTopLevel"),
51
    IS_TOP_LEVEL((short)5, "isTopLevel"),
53
    ADDED_ON((short)6, "addedOn");
52
    ADDED_ON((short)6, "addedOn"),
-
 
53
    /**
-
 
54
     * 
-
 
55
     * @see status
-
 
56
     */
-
 
57
    CATEGORY_STATUS((short)7, "categoryStatus");
54
 
58
 
55
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
59
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
56
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
60
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
57
 
61
 
58
    static {
62
    static {
Line 122... Line 126...
122
        new FieldValueMetaData(TType.I64)));
126
        new FieldValueMetaData(TType.I64)));
123
    put(_Fields.IS_TOP_LEVEL, new FieldMetaData("isTopLevel", TFieldRequirementType.DEFAULT, 
127
    put(_Fields.IS_TOP_LEVEL, new FieldMetaData("isTopLevel", TFieldRequirementType.DEFAULT, 
124
        new FieldValueMetaData(TType.BOOL)));
128
        new FieldValueMetaData(TType.BOOL)));
125
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
129
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
126
        new FieldValueMetaData(TType.I64)));
130
        new FieldValueMetaData(TType.I64)));
-
 
131
    put(_Fields.CATEGORY_STATUS, new FieldMetaData("categoryStatus", TFieldRequirementType.DEFAULT, 
-
 
132
        new EnumMetaData(TType.ENUM, status.class)));
127
  }});
133
  }});
128
 
134
 
129
  static {
135
  static {
130
    FieldMetaData.addStructMetaDataMap(Category.class, metaDataMap);
136
    FieldMetaData.addStructMetaDataMap(Category.class, metaDataMap);
131
  }
137
  }
Line 137... Line 143...
137
    long id,
143
    long id,
138
    String name,
144
    String name,
139
    List<Long> childCategories,
145
    List<Long> childCategories,
140
    long parent_id,
146
    long parent_id,
141
    boolean isTopLevel,
147
    boolean isTopLevel,
142
    long addedOn)
148
    long addedOn,
-
 
149
    status categoryStatus)
143
  {
150
  {
144
    this();
151
    this();
145
    this.id = id;
152
    this.id = id;
146
    setIdIsSet(true);
153
    setIdIsSet(true);
147
    this.name = name;
154
    this.name = name;
Line 150... Line 157...
150
    setParent_idIsSet(true);
157
    setParent_idIsSet(true);
151
    this.isTopLevel = isTopLevel;
158
    this.isTopLevel = isTopLevel;
152
    setIsTopLevelIsSet(true);
159
    setIsTopLevelIsSet(true);
153
    this.addedOn = addedOn;
160
    this.addedOn = addedOn;
154
    setAddedOnIsSet(true);
161
    setAddedOnIsSet(true);
-
 
162
    this.categoryStatus = categoryStatus;
155
  }
163
  }
156
 
164
 
157
  /**
165
  /**
158
   * Performs a deep copy on <i>other</i>.
166
   * Performs a deep copy on <i>other</i>.
159
   */
167
   */
Line 172... Line 180...
172
      this.childCategories = __this__childCategories;
180
      this.childCategories = __this__childCategories;
173
    }
181
    }
174
    this.parent_id = other.parent_id;
182
    this.parent_id = other.parent_id;
175
    this.isTopLevel = other.isTopLevel;
183
    this.isTopLevel = other.isTopLevel;
176
    this.addedOn = other.addedOn;
184
    this.addedOn = other.addedOn;
-
 
185
    if (other.isSetCategoryStatus()) {
-
 
186
      this.categoryStatus = other.categoryStatus;
-
 
187
    }
177
  }
188
  }
178
 
189
 
179
  public Category deepCopy() {
190
  public Category deepCopy() {
180
    return new Category(this);
191
    return new Category(this);
181
  }
192
  }
Line 338... Line 349...
338
 
349
 
339
  public void setAddedOnIsSet(boolean value) {
350
  public void setAddedOnIsSet(boolean value) {
340
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
351
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
341
  }
352
  }
342
 
353
 
-
 
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
 
343
  public void setFieldValue(_Fields field, Object value) {
386
  public void setFieldValue(_Fields field, Object value) {
344
    switch (field) {
387
    switch (field) {
345
    case ID:
388
    case ID:
346
      if (value == null) {
389
      if (value == null) {
347
        unsetId();
390
        unsetId();
Line 388... Line 431...
388
      } else {
431
      } else {
389
        setAddedOn((Long)value);
432
        setAddedOn((Long)value);
390
      }
433
      }
391
      break;
434
      break;
392
 
435
 
-
 
436
    case CATEGORY_STATUS:
-
 
437
      if (value == null) {
-
 
438
        unsetCategoryStatus();
-
 
439
      } else {
-
 
440
        setCategoryStatus((status)value);
-
 
441
      }
-
 
442
      break;
-
 
443
 
393
    }
444
    }
394
  }
445
  }
395
 
446
 
396
  public void setFieldValue(int fieldID, Object value) {
447
  public void setFieldValue(int fieldID, Object value) {
397
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
448
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
Line 415... Line 466...
415
      return new Boolean(isIsTopLevel());
466
      return new Boolean(isIsTopLevel());
416
 
467
 
417
    case ADDED_ON:
468
    case ADDED_ON:
418
      return new Long(getAddedOn());
469
      return new Long(getAddedOn());
419
 
470
 
-
 
471
    case CATEGORY_STATUS:
-
 
472
      return getCategoryStatus();
-
 
473
 
420
    }
474
    }
421
    throw new IllegalStateException();
475
    throw new IllegalStateException();
422
  }
476
  }
423
 
477
 
424
  public Object getFieldValue(int fieldId) {
478
  public Object getFieldValue(int fieldId) {
Line 438... Line 492...
438
      return isSetParent_id();
492
      return isSetParent_id();
439
    case IS_TOP_LEVEL:
493
    case IS_TOP_LEVEL:
440
      return isSetIsTopLevel();
494
      return isSetIsTopLevel();
441
    case ADDED_ON:
495
    case ADDED_ON:
442
      return isSetAddedOn();
496
      return isSetAddedOn();
-
 
497
    case CATEGORY_STATUS:
-
 
498
      return isSetCategoryStatus();
443
    }
499
    }
444
    throw new IllegalStateException();
500
    throw new IllegalStateException();
445
  }
501
  }
446
 
502
 
447
  public boolean isSet(int fieldID) {
503
  public boolean isSet(int fieldID) {
Line 513... Line 569...
513
        return false;
569
        return false;
514
      if (this.addedOn != that.addedOn)
570
      if (this.addedOn != that.addedOn)
515
        return false;
571
        return false;
516
    }
572
    }
517
 
573
 
-
 
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
 
518
    return true;
583
    return true;
519
  }
584
  }
520
 
585
 
521
  @Override
586
  @Override
522
  public int hashCode() {
587
  public int hashCode() {
Line 577... Line 642...
577
    }
642
    }
578
    lastComparison = TBaseHelper.compareTo(addedOn, typedOther.addedOn);
643
    lastComparison = TBaseHelper.compareTo(addedOn, typedOther.addedOn);
579
    if (lastComparison != 0) {
644
    if (lastComparison != 0) {
580
      return lastComparison;
645
      return lastComparison;
581
    }
646
    }
-
 
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
    }
582
    return 0;
655
    return 0;
583
  }
656
  }
584
 
657
 
585
  public void read(TProtocol iprot) throws TException {
658
  public void read(TProtocol iprot) throws TException {
586
    TField field;
659
    TField field;
Line 650... Line 723...
650
              setAddedOnIsSet(true);
723
              setAddedOnIsSet(true);
651
            } else { 
724
            } else { 
652
              TProtocolUtil.skip(iprot, field.type);
725
              TProtocolUtil.skip(iprot, field.type);
653
            }
726
            }
654
            break;
727
            break;
-
 
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;
655
        }
735
        }
656
        iprot.readFieldEnd();
736
        iprot.readFieldEnd();
657
      }
737
      }
658
    }
738
    }
659
    iprot.readStructEnd();
739
    iprot.readStructEnd();
Line 691... Line 771...
691
    oprot.writeBool(this.isTopLevel);
771
    oprot.writeBool(this.isTopLevel);
692
    oprot.writeFieldEnd();
772
    oprot.writeFieldEnd();
693
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
773
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
694
    oprot.writeI64(this.addedOn);
774
    oprot.writeI64(this.addedOn);
695
    oprot.writeFieldEnd();
775
    oprot.writeFieldEnd();
-
 
776
    if (this.categoryStatus != null) {
-
 
777
      oprot.writeFieldBegin(CATEGORY_STATUS_FIELD_DESC);
-
 
778
      oprot.writeI32(this.categoryStatus.getValue());
-
 
779
      oprot.writeFieldEnd();
-
 
780
    }
696
    oprot.writeFieldStop();
781
    oprot.writeFieldStop();
697
    oprot.writeStructEnd();
782
    oprot.writeStructEnd();
698
  }
783
  }
699
 
784
 
700
  @Override
785
  @Override
Line 731... Line 816...
731
    first = false;
816
    first = false;
732
    if (!first) sb.append(", ");
817
    if (!first) sb.append(", ");
733
    sb.append("addedOn:");
818
    sb.append("addedOn:");
734
    sb.append(this.addedOn);
819
    sb.append(this.addedOn);
735
    first = false;
820
    first = false;
-
 
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;
736
    sb.append(")");
837
    sb.append(")");
737
    return sb.toString();
838
    return sb.toString();
738
  }
839
  }
739
 
840
 
740
  public void validate() throws TException {
841
  public void validate() throws TException {