Subversion Repositories SmartDukaan

Rev

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

Rev 553 Rev 771
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
 * Not used right now, will decide later
-
 
28
 * enum WidgetType{
-
 
29
 * 	ACCESSORIES,
-
 
30
 * 	RATINGS,
-
 
31
 * 	SIMILAR_ITEMS,
-
 
32
 * 	RECOMMENDED_ITEMS,
-
 
33
 * 	DEAL_PROMOTIONS,
-
 
34
 * 	
-
 
35
 * 	MY_RESEARCH,
-
 
36
 * 	BROWSE_HISTORY
-
 
37
 * }
-
 
38
 * 
-
 
39
 * enum RatingType{
-
 
40
 * 	SHOP2020,
-
 
41
 * 	AMAZON,
-
 
42
 * 	USER_ALL,
-
 
43
 * 	USER_CURRENT
-
 
44
 * }
-
 
45
 * 
-
 
46
 * struct RatingsWidget{
-
 
47
 * 	1:i64 catalog_item_id,
-
 
48
 * 	2:map<RatingType,double> ratings,
-
 
49
 * 	3:i64 user_id
-
 
50
 * }
-
 
51
 */
26
public class WidgetItem implements TBase<WidgetItem._Fields>, java.io.Serializable, Cloneable, Comparable<WidgetItem> {
52
public class WidgetItem implements TBase<WidgetItem._Fields>, java.io.Serializable, Cloneable, Comparable<WidgetItem> {
27
  private static final TStruct STRUCT_DESC = new TStruct("WidgetItem");
53
  private static final TStruct STRUCT_DESC = new TStruct("WidgetItem");
28
 
54
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
55
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)2);
56
  private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)2);
31
  private static final TField SNIPPET_FIELD_DESC = new TField("snippet", TType.STRING, (short)3);
-
 
32
  private static final TField ENABLED_FIELD_DESC = new TField("enabled", TType.BOOL, (short)4);
57
  private static final TField ENABLED_FIELD_DESC = new TField("enabled", TType.BOOL, (short)3);
33
  private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)5);
58
  private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)4);
34
 
59
 
35
  private long id;
60
  private long id;
36
  private long item_id;
61
  private long item_id;
37
  private String snippet;
-
 
38
  private boolean enabled;
62
  private boolean enabled;
39
  private long timestamp;
63
  private long timestamp;
40
 
64
 
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
65
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
42
  public enum _Fields implements TFieldIdEnum {
66
  public enum _Fields implements TFieldIdEnum {
43
    ID((short)1, "id"),
67
    ID((short)1, "id"),
44
    ITEM_ID((short)2, "item_id"),
68
    ITEM_ID((short)2, "item_id"),
45
    SNIPPET((short)3, "snippet"),
-
 
46
    ENABLED((short)4, "enabled"),
69
    ENABLED((short)3, "enabled"),
47
    TIMESTAMP((short)5, "timestamp");
70
    TIMESTAMP((short)4, "timestamp");
48
 
71
 
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
72
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
50
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
73
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
 
74
 
52
    static {
75
    static {
Line 107... Line 130...
107
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
130
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
108
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
131
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.I64)));
132
        new FieldValueMetaData(TType.I64)));
110
    put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
133
    put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
111
        new FieldValueMetaData(TType.I64)));
134
        new FieldValueMetaData(TType.I64)));
112
    put(_Fields.SNIPPET, new FieldMetaData("snippet", TFieldRequirementType.DEFAULT, 
-
 
113
        new FieldValueMetaData(TType.STRING)));
-
 
114
    put(_Fields.ENABLED, new FieldMetaData("enabled", TFieldRequirementType.DEFAULT, 
135
    put(_Fields.ENABLED, new FieldMetaData("enabled", TFieldRequirementType.DEFAULT, 
115
        new FieldValueMetaData(TType.BOOL)));
136
        new FieldValueMetaData(TType.BOOL)));
116
    put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
137
    put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
117
        new FieldValueMetaData(TType.I64)));
138
        new FieldValueMetaData(TType.I64)));
118
  }});
139
  }});
Line 125... Line 146...
125
  }
146
  }
126
 
147
 
127
  public WidgetItem(
148
  public WidgetItem(
128
    long id,
149
    long id,
129
    long item_id,
150
    long item_id,
130
    String snippet,
-
 
131
    boolean enabled,
151
    boolean enabled,
132
    long timestamp)
152
    long timestamp)
133
  {
153
  {
134
    this();
154
    this();
135
    this.id = id;
155
    this.id = id;
136
    setIdIsSet(true);
156
    setIdIsSet(true);
137
    this.item_id = item_id;
157
    this.item_id = item_id;
138
    setItem_idIsSet(true);
158
    setItem_idIsSet(true);
139
    this.snippet = snippet;
-
 
140
    this.enabled = enabled;
159
    this.enabled = enabled;
141
    setEnabledIsSet(true);
160
    setEnabledIsSet(true);
142
    this.timestamp = timestamp;
161
    this.timestamp = timestamp;
143
    setTimestampIsSet(true);
162
    setTimestampIsSet(true);
144
  }
163
  }
Line 149... Line 168...
149
  public WidgetItem(WidgetItem other) {
168
  public WidgetItem(WidgetItem other) {
150
    __isset_bit_vector.clear();
169
    __isset_bit_vector.clear();
151
    __isset_bit_vector.or(other.__isset_bit_vector);
170
    __isset_bit_vector.or(other.__isset_bit_vector);
152
    this.id = other.id;
171
    this.id = other.id;
153
    this.item_id = other.item_id;
172
    this.item_id = other.item_id;
154
    if (other.isSetSnippet()) {
-
 
155
      this.snippet = other.snippet;
-
 
156
    }
-
 
157
    this.enabled = other.enabled;
173
    this.enabled = other.enabled;
158
    this.timestamp = other.timestamp;
174
    this.timestamp = other.timestamp;
159
  }
175
  }
160
 
176
 
161
  public WidgetItem deepCopy() {
177
  public WidgetItem deepCopy() {
Line 211... Line 227...
211
 
227
 
212
  public void setItem_idIsSet(boolean value) {
228
  public void setItem_idIsSet(boolean value) {
213
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
229
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
214
  }
230
  }
215
 
231
 
216
  public String getSnippet() {
-
 
217
    return this.snippet;
-
 
218
  }
-
 
219
 
-
 
220
  public WidgetItem setSnippet(String snippet) {
-
 
221
    this.snippet = snippet;
-
 
222
    return this;
-
 
223
  }
-
 
224
 
-
 
225
  public void unsetSnippet() {
-
 
226
    this.snippet = null;
-
 
227
  }
-
 
228
 
-
 
229
  /** Returns true if field snippet is set (has been asigned a value) and false otherwise */
-
 
230
  public boolean isSetSnippet() {
-
 
231
    return this.snippet != null;
-
 
232
  }
-
 
233
 
-
 
234
  public void setSnippetIsSet(boolean value) {
-
 
235
    if (!value) {
-
 
236
      this.snippet = null;
-
 
237
    }
-
 
238
  }
-
 
239
 
-
 
240
  public boolean isEnabled() {
232
  public boolean isEnabled() {
241
    return this.enabled;
233
    return this.enabled;
242
  }
234
  }
243
 
235
 
244
  public WidgetItem setEnabled(boolean enabled) {
236
  public WidgetItem setEnabled(boolean enabled) {
Line 299... Line 291...
299
      } else {
291
      } else {
300
        setItem_id((Long)value);
292
        setItem_id((Long)value);
301
      }
293
      }
302
      break;
294
      break;
303
 
295
 
304
    case SNIPPET:
-
 
305
      if (value == null) {
-
 
306
        unsetSnippet();
-
 
307
      } else {
-
 
308
        setSnippet((String)value);
-
 
309
      }
-
 
310
      break;
-
 
311
 
-
 
312
    case ENABLED:
296
    case ENABLED:
313
      if (value == null) {
297
      if (value == null) {
314
        unsetEnabled();
298
        unsetEnabled();
315
      } else {
299
      } else {
316
        setEnabled((Boolean)value);
300
        setEnabled((Boolean)value);
Line 338... Line 322...
338
      return new Long(getId());
322
      return new Long(getId());
339
 
323
 
340
    case ITEM_ID:
324
    case ITEM_ID:
341
      return new Long(getItem_id());
325
      return new Long(getItem_id());
342
 
326
 
343
    case SNIPPET:
-
 
344
      return getSnippet();
-
 
345
 
-
 
346
    case ENABLED:
327
    case ENABLED:
347
      return new Boolean(isEnabled());
328
      return new Boolean(isEnabled());
348
 
329
 
349
    case TIMESTAMP:
330
    case TIMESTAMP:
350
      return new Long(getTimestamp());
331
      return new Long(getTimestamp());
Line 362... Line 343...
362
    switch (field) {
343
    switch (field) {
363
    case ID:
344
    case ID:
364
      return isSetId();
345
      return isSetId();
365
    case ITEM_ID:
346
    case ITEM_ID:
366
      return isSetItem_id();
347
      return isSetItem_id();
367
    case SNIPPET:
-
 
368
      return isSetSnippet();
-
 
369
    case ENABLED:
348
    case ENABLED:
370
      return isSetEnabled();
349
      return isSetEnabled();
371
    case TIMESTAMP:
350
    case TIMESTAMP:
372
      return isSetTimestamp();
351
      return isSetTimestamp();
373
    }
352
    }
Line 407... Line 386...
407
        return false;
386
        return false;
408
      if (this.item_id != that.item_id)
387
      if (this.item_id != that.item_id)
409
        return false;
388
        return false;
410
    }
389
    }
411
 
390
 
412
    boolean this_present_snippet = true && this.isSetSnippet();
-
 
413
    boolean that_present_snippet = true && that.isSetSnippet();
-
 
414
    if (this_present_snippet || that_present_snippet) {
-
 
415
      if (!(this_present_snippet && that_present_snippet))
-
 
416
        return false;
-
 
417
      if (!this.snippet.equals(that.snippet))
-
 
418
        return false;
-
 
419
    }
-
 
420
 
-
 
421
    boolean this_present_enabled = true;
391
    boolean this_present_enabled = true;
422
    boolean that_present_enabled = true;
392
    boolean that_present_enabled = true;
423
    if (this_present_enabled || that_present_enabled) {
393
    if (this_present_enabled || that_present_enabled) {
424
      if (!(this_present_enabled && that_present_enabled))
394
      if (!(this_present_enabled && that_present_enabled))
425
        return false;
395
        return false;
Line 466... Line 436...
466
    }
436
    }
467
    lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
437
    lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
468
    if (lastComparison != 0) {
438
    if (lastComparison != 0) {
469
      return lastComparison;
439
      return lastComparison;
470
    }
440
    }
471
    lastComparison = Boolean.valueOf(isSetSnippet()).compareTo(isSetSnippet());
-
 
472
    if (lastComparison != 0) {
-
 
473
      return lastComparison;
-
 
474
    }
-
 
475
    lastComparison = TBaseHelper.compareTo(snippet, typedOther.snippet);
-
 
476
    if (lastComparison != 0) {
-
 
477
      return lastComparison;
-
 
478
    }
-
 
479
    lastComparison = Boolean.valueOf(isSetEnabled()).compareTo(isSetEnabled());
441
    lastComparison = Boolean.valueOf(isSetEnabled()).compareTo(isSetEnabled());
480
    if (lastComparison != 0) {
442
    if (lastComparison != 0) {
481
      return lastComparison;
443
      return lastComparison;
482
    }
444
    }
483
    lastComparison = TBaseHelper.compareTo(enabled, typedOther.enabled);
445
    lastComparison = TBaseHelper.compareTo(enabled, typedOther.enabled);
Line 523... Line 485...
523
              setItem_idIsSet(true);
485
              setItem_idIsSet(true);
524
            } else { 
486
            } else { 
525
              TProtocolUtil.skip(iprot, field.type);
487
              TProtocolUtil.skip(iprot, field.type);
526
            }
488
            }
527
            break;
489
            break;
528
          case SNIPPET:
-
 
529
            if (field.type == TType.STRING) {
-
 
530
              this.snippet = iprot.readString();
-
 
531
            } else { 
-
 
532
              TProtocolUtil.skip(iprot, field.type);
-
 
533
            }
-
 
534
            break;
-
 
535
          case ENABLED:
490
          case ENABLED:
536
            if (field.type == TType.BOOL) {
491
            if (field.type == TType.BOOL) {
537
              this.enabled = iprot.readBool();
492
              this.enabled = iprot.readBool();
538
              setEnabledIsSet(true);
493
              setEnabledIsSet(true);
539
            } else { 
494
            } else { 
Line 564... Line 519...
564
    oprot.writeI64(this.id);
519
    oprot.writeI64(this.id);
565
    oprot.writeFieldEnd();
520
    oprot.writeFieldEnd();
566
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
521
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
567
    oprot.writeI64(this.item_id);
522
    oprot.writeI64(this.item_id);
568
    oprot.writeFieldEnd();
523
    oprot.writeFieldEnd();
569
    if (this.snippet != null) {
-
 
570
      oprot.writeFieldBegin(SNIPPET_FIELD_DESC);
-
 
571
      oprot.writeString(this.snippet);
-
 
572
      oprot.writeFieldEnd();
-
 
573
    }
-
 
574
    oprot.writeFieldBegin(ENABLED_FIELD_DESC);
524
    oprot.writeFieldBegin(ENABLED_FIELD_DESC);
575
    oprot.writeBool(this.enabled);
525
    oprot.writeBool(this.enabled);
576
    oprot.writeFieldEnd();
526
    oprot.writeFieldEnd();
577
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
527
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
578
    oprot.writeI64(this.timestamp);
528
    oprot.writeI64(this.timestamp);
Line 592... Line 542...
592
    if (!first) sb.append(", ");
542
    if (!first) sb.append(", ");
593
    sb.append("item_id:");
543
    sb.append("item_id:");
594
    sb.append(this.item_id);
544
    sb.append(this.item_id);
595
    first = false;
545
    first = false;
596
    if (!first) sb.append(", ");
546
    if (!first) sb.append(", ");
597
    sb.append("snippet:");
-
 
598
    if (this.snippet == null) {
-
 
599
      sb.append("null");
-
 
600
    } else {
-
 
601
      sb.append(this.snippet);
-
 
602
    }
-
 
603
    first = false;
-
 
604
    if (!first) sb.append(", ");
-
 
605
    sb.append("enabled:");
547
    sb.append("enabled:");
606
    sb.append(this.enabled);
548
    sb.append(this.enabled);
607
    first = false;
549
    first = false;
608
    if (!first) sb.append(", ");
550
    if (!first) sb.append(", ");
609
    sb.append("timestamp:");
551
    sb.append("timestamp:");