Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
123 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.user;
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
/**
27
 * dynamic user state
28
 * *
29
 */
30
public class UserState implements TBase<UserState._Fields>, java.io.Serializable, Cloneable, Comparable<UserState> {
31
  private static final TStruct STRUCT_DESC = new TStruct("UserState");
32
 
33
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
34
  private static final TField IS_EMAIL_VERIFIED_FIELD_DESC = new TField("isEmailVerified", TType.BOOL, (short)2);
35
  private static final TField LAST_LOGIN_FIELD_DESC = new TField("lastLogin", TType.I64, (short)3);
36
  private static final TField LAST_LOGOUT_FIELD_DESC = new TField("lastLogout", TType.I64, (short)4);
37
  private static final TField EMAIL_VERIFICATION_SENT_ON_FIELD_DESC = new TField("emailVerificationSentOn", TType.I64, (short)5);
38
  private static final TField SMS_VERIFICATION_SENT_ON_FIELD_DESC = new TField("smsVerificationSentOn", TType.I64, (short)6);
39
  private static final TField IS_SMSVERIFIED_FIELD_DESC = new TField("isSMSVerified", TType.BOOL, (short)7);
40
  private static final TField ACTIVE_SINCE_FIELD_DESC = new TField("activeSince", TType.I64, (short)8);
41
  private static final TField IS_LOGGED_IN_FIELD_DESC = new TField("isLoggedIn", TType.BOOL, (short)9);
42
  private static final TField IPS_FIELD_DESC = new TField("ips", TType.LIST, (short)10);
43
  private static final TField SHOPPING_CART_HANDLE_FIELD_DESC = new TField("shoppingCartHandle", TType.I64, (short)11);
130 ashish 44
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)12);
123 ashish 45
 
46
  private long userId;
47
  private boolean isEmailVerified;
48
  private long lastLogin;
49
  private long lastLogout;
50
  private long emailVerificationSentOn;
51
  private long smsVerificationSentOn;
52
  private boolean isSMSVerified;
53
  private long activeSince;
54
  private boolean isLoggedIn;
55
  private List<IPMap> ips;
56
  private long shoppingCartHandle;
130 ashish 57
  private AccountStatus status;
123 ashish 58
 
59
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
60
  public enum _Fields implements TFieldIdEnum {
61
    USER_ID((short)1, "userId"),
62
    IS_EMAIL_VERIFIED((short)2, "isEmailVerified"),
63
    LAST_LOGIN((short)3, "lastLogin"),
64
    LAST_LOGOUT((short)4, "lastLogout"),
65
    EMAIL_VERIFICATION_SENT_ON((short)5, "emailVerificationSentOn"),
66
    SMS_VERIFICATION_SENT_ON((short)6, "smsVerificationSentOn"),
67
    IS_SMSVERIFIED((short)7, "isSMSVerified"),
68
    ACTIVE_SINCE((short)8, "activeSince"),
69
    IS_LOGGED_IN((short)9, "isLoggedIn"),
70
    IPS((short)10, "ips"),
130 ashish 71
    SHOPPING_CART_HANDLE((short)11, "shoppingCartHandle"),
72
    /**
73
     * 
74
     * @see AccountStatus
75
     */
76
    STATUS((short)12, "status");
123 ashish 77
 
78
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
79
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
80
 
81
    static {
82
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
83
        byId.put((int)field._thriftId, field);
84
        byName.put(field.getFieldName(), field);
85
      }
86
    }
87
 
88
    /**
89
     * Find the _Fields constant that matches fieldId, or null if its not found.
90
     */
91
    public static _Fields findByThriftId(int fieldId) {
92
      return byId.get(fieldId);
93
    }
94
 
95
    /**
96
     * Find the _Fields constant that matches fieldId, throwing an exception
97
     * if it is not found.
98
     */
99
    public static _Fields findByThriftIdOrThrow(int fieldId) {
100
      _Fields fields = findByThriftId(fieldId);
101
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
102
      return fields;
103
    }
104
 
105
    /**
106
     * Find the _Fields constant that matches name, or null if its not found.
107
     */
108
    public static _Fields findByName(String name) {
109
      return byName.get(name);
110
    }
111
 
112
    private final short _thriftId;
113
    private final String _fieldName;
114
 
115
    _Fields(short thriftId, String fieldName) {
116
      _thriftId = thriftId;
117
      _fieldName = fieldName;
118
    }
119
 
120
    public short getThriftFieldId() {
121
      return _thriftId;
122
    }
123
 
124
    public String getFieldName() {
125
      return _fieldName;
126
    }
127
  }
128
 
129
  // isset id assignments
130
  private static final int __USERID_ISSET_ID = 0;
131
  private static final int __ISEMAILVERIFIED_ISSET_ID = 1;
132
  private static final int __LASTLOGIN_ISSET_ID = 2;
133
  private static final int __LASTLOGOUT_ISSET_ID = 3;
134
  private static final int __EMAILVERIFICATIONSENTON_ISSET_ID = 4;
135
  private static final int __SMSVERIFICATIONSENTON_ISSET_ID = 5;
136
  private static final int __ISSMSVERIFIED_ISSET_ID = 6;
137
  private static final int __ACTIVESINCE_ISSET_ID = 7;
138
  private static final int __ISLOGGEDIN_ISSET_ID = 8;
139
  private static final int __SHOPPINGCARTHANDLE_ISSET_ID = 9;
140
  private BitSet __isset_bit_vector = new BitSet(10);
141
 
142
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
143
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
144
        new FieldValueMetaData(TType.I64)));
145
    put(_Fields.IS_EMAIL_VERIFIED, new FieldMetaData("isEmailVerified", TFieldRequirementType.DEFAULT, 
146
        new FieldValueMetaData(TType.BOOL)));
147
    put(_Fields.LAST_LOGIN, new FieldMetaData("lastLogin", TFieldRequirementType.DEFAULT, 
148
        new FieldValueMetaData(TType.I64)));
149
    put(_Fields.LAST_LOGOUT, new FieldMetaData("lastLogout", TFieldRequirementType.DEFAULT, 
150
        new FieldValueMetaData(TType.I64)));
151
    put(_Fields.EMAIL_VERIFICATION_SENT_ON, new FieldMetaData("emailVerificationSentOn", TFieldRequirementType.DEFAULT, 
152
        new FieldValueMetaData(TType.I64)));
153
    put(_Fields.SMS_VERIFICATION_SENT_ON, new FieldMetaData("smsVerificationSentOn", TFieldRequirementType.DEFAULT, 
154
        new FieldValueMetaData(TType.I64)));
155
    put(_Fields.IS_SMSVERIFIED, new FieldMetaData("isSMSVerified", TFieldRequirementType.DEFAULT, 
156
        new FieldValueMetaData(TType.BOOL)));
157
    put(_Fields.ACTIVE_SINCE, new FieldMetaData("activeSince", TFieldRequirementType.DEFAULT, 
158
        new FieldValueMetaData(TType.I64)));
159
    put(_Fields.IS_LOGGED_IN, new FieldMetaData("isLoggedIn", TFieldRequirementType.DEFAULT, 
160
        new FieldValueMetaData(TType.BOOL)));
161
    put(_Fields.IPS, new FieldMetaData("ips", TFieldRequirementType.DEFAULT, 
162
        new ListMetaData(TType.LIST, 
163
            new StructMetaData(TType.STRUCT, IPMap.class))));
164
    put(_Fields.SHOPPING_CART_HANDLE, new FieldMetaData("shoppingCartHandle", TFieldRequirementType.DEFAULT, 
165
        new FieldValueMetaData(TType.I64)));
130 ashish 166
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
167
        new EnumMetaData(TType.ENUM, AccountStatus.class)));
123 ashish 168
  }});
169
 
170
  static {
171
    FieldMetaData.addStructMetaDataMap(UserState.class, metaDataMap);
172
  }
173
 
174
  public UserState() {
175
  }
176
 
177
  public UserState(
178
    long userId,
179
    boolean isEmailVerified,
180
    long lastLogin,
181
    long lastLogout,
182
    long emailVerificationSentOn,
183
    long smsVerificationSentOn,
184
    boolean isSMSVerified,
185
    long activeSince,
186
    boolean isLoggedIn,
187
    List<IPMap> ips,
130 ashish 188
    long shoppingCartHandle,
189
    AccountStatus status)
123 ashish 190
  {
191
    this();
192
    this.userId = userId;
193
    setUserIdIsSet(true);
194
    this.isEmailVerified = isEmailVerified;
195
    setIsEmailVerifiedIsSet(true);
196
    this.lastLogin = lastLogin;
197
    setLastLoginIsSet(true);
198
    this.lastLogout = lastLogout;
199
    setLastLogoutIsSet(true);
200
    this.emailVerificationSentOn = emailVerificationSentOn;
201
    setEmailVerificationSentOnIsSet(true);
202
    this.smsVerificationSentOn = smsVerificationSentOn;
203
    setSmsVerificationSentOnIsSet(true);
204
    this.isSMSVerified = isSMSVerified;
205
    setIsSMSVerifiedIsSet(true);
206
    this.activeSince = activeSince;
207
    setActiveSinceIsSet(true);
208
    this.isLoggedIn = isLoggedIn;
209
    setIsLoggedInIsSet(true);
210
    this.ips = ips;
211
    this.shoppingCartHandle = shoppingCartHandle;
212
    setShoppingCartHandleIsSet(true);
130 ashish 213
    this.status = status;
123 ashish 214
  }
215
 
216
  /**
217
   * Performs a deep copy on <i>other</i>.
218
   */
219
  public UserState(UserState other) {
220
    __isset_bit_vector.clear();
221
    __isset_bit_vector.or(other.__isset_bit_vector);
222
    this.userId = other.userId;
223
    this.isEmailVerified = other.isEmailVerified;
224
    this.lastLogin = other.lastLogin;
225
    this.lastLogout = other.lastLogout;
226
    this.emailVerificationSentOn = other.emailVerificationSentOn;
227
    this.smsVerificationSentOn = other.smsVerificationSentOn;
228
    this.isSMSVerified = other.isSMSVerified;
229
    this.activeSince = other.activeSince;
230
    this.isLoggedIn = other.isLoggedIn;
231
    if (other.isSetIps()) {
232
      List<IPMap> __this__ips = new ArrayList<IPMap>();
233
      for (IPMap other_element : other.ips) {
234
        __this__ips.add(new IPMap(other_element));
235
      }
236
      this.ips = __this__ips;
237
    }
238
    this.shoppingCartHandle = other.shoppingCartHandle;
130 ashish 239
    if (other.isSetStatus()) {
240
      this.status = other.status;
241
    }
123 ashish 242
  }
243
 
244
  public UserState deepCopy() {
245
    return new UserState(this);
246
  }
247
 
248
  @Deprecated
249
  public UserState clone() {
250
    return new UserState(this);
251
  }
252
 
253
  public long getUserId() {
254
    return this.userId;
255
  }
256
 
257
  public UserState setUserId(long userId) {
258
    this.userId = userId;
259
    setUserIdIsSet(true);
260
    return this;
261
  }
262
 
263
  public void unsetUserId() {
264
    __isset_bit_vector.clear(__USERID_ISSET_ID);
265
  }
266
 
267
  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
268
  public boolean isSetUserId() {
269
    return __isset_bit_vector.get(__USERID_ISSET_ID);
270
  }
271
 
272
  public void setUserIdIsSet(boolean value) {
273
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
274
  }
275
 
276
  public boolean isIsEmailVerified() {
277
    return this.isEmailVerified;
278
  }
279
 
280
  public UserState setIsEmailVerified(boolean isEmailVerified) {
281
    this.isEmailVerified = isEmailVerified;
282
    setIsEmailVerifiedIsSet(true);
283
    return this;
284
  }
285
 
286
  public void unsetIsEmailVerified() {
287
    __isset_bit_vector.clear(__ISEMAILVERIFIED_ISSET_ID);
288
  }
289
 
290
  /** Returns true if field isEmailVerified is set (has been asigned a value) and false otherwise */
291
  public boolean isSetIsEmailVerified() {
292
    return __isset_bit_vector.get(__ISEMAILVERIFIED_ISSET_ID);
293
  }
294
 
295
  public void setIsEmailVerifiedIsSet(boolean value) {
296
    __isset_bit_vector.set(__ISEMAILVERIFIED_ISSET_ID, value);
297
  }
298
 
299
  public long getLastLogin() {
300
    return this.lastLogin;
301
  }
302
 
303
  public UserState setLastLogin(long lastLogin) {
304
    this.lastLogin = lastLogin;
305
    setLastLoginIsSet(true);
306
    return this;
307
  }
308
 
309
  public void unsetLastLogin() {
310
    __isset_bit_vector.clear(__LASTLOGIN_ISSET_ID);
311
  }
312
 
313
  /** Returns true if field lastLogin is set (has been asigned a value) and false otherwise */
314
  public boolean isSetLastLogin() {
315
    return __isset_bit_vector.get(__LASTLOGIN_ISSET_ID);
316
  }
317
 
318
  public void setLastLoginIsSet(boolean value) {
319
    __isset_bit_vector.set(__LASTLOGIN_ISSET_ID, value);
320
  }
321
 
322
  public long getLastLogout() {
323
    return this.lastLogout;
324
  }
325
 
326
  public UserState setLastLogout(long lastLogout) {
327
    this.lastLogout = lastLogout;
328
    setLastLogoutIsSet(true);
329
    return this;
330
  }
331
 
332
  public void unsetLastLogout() {
333
    __isset_bit_vector.clear(__LASTLOGOUT_ISSET_ID);
334
  }
335
 
336
  /** Returns true if field lastLogout is set (has been asigned a value) and false otherwise */
337
  public boolean isSetLastLogout() {
338
    return __isset_bit_vector.get(__LASTLOGOUT_ISSET_ID);
339
  }
340
 
341
  public void setLastLogoutIsSet(boolean value) {
342
    __isset_bit_vector.set(__LASTLOGOUT_ISSET_ID, value);
343
  }
344
 
345
  public long getEmailVerificationSentOn() {
346
    return this.emailVerificationSentOn;
347
  }
348
 
349
  public UserState setEmailVerificationSentOn(long emailVerificationSentOn) {
350
    this.emailVerificationSentOn = emailVerificationSentOn;
351
    setEmailVerificationSentOnIsSet(true);
352
    return this;
353
  }
354
 
355
  public void unsetEmailVerificationSentOn() {
356
    __isset_bit_vector.clear(__EMAILVERIFICATIONSENTON_ISSET_ID);
357
  }
358
 
359
  /** Returns true if field emailVerificationSentOn is set (has been asigned a value) and false otherwise */
360
  public boolean isSetEmailVerificationSentOn() {
361
    return __isset_bit_vector.get(__EMAILVERIFICATIONSENTON_ISSET_ID);
362
  }
363
 
364
  public void setEmailVerificationSentOnIsSet(boolean value) {
365
    __isset_bit_vector.set(__EMAILVERIFICATIONSENTON_ISSET_ID, value);
366
  }
367
 
368
  public long getSmsVerificationSentOn() {
369
    return this.smsVerificationSentOn;
370
  }
371
 
372
  public UserState setSmsVerificationSentOn(long smsVerificationSentOn) {
373
    this.smsVerificationSentOn = smsVerificationSentOn;
374
    setSmsVerificationSentOnIsSet(true);
375
    return this;
376
  }
377
 
378
  public void unsetSmsVerificationSentOn() {
379
    __isset_bit_vector.clear(__SMSVERIFICATIONSENTON_ISSET_ID);
380
  }
381
 
382
  /** Returns true if field smsVerificationSentOn is set (has been asigned a value) and false otherwise */
383
  public boolean isSetSmsVerificationSentOn() {
384
    return __isset_bit_vector.get(__SMSVERIFICATIONSENTON_ISSET_ID);
385
  }
386
 
387
  public void setSmsVerificationSentOnIsSet(boolean value) {
388
    __isset_bit_vector.set(__SMSVERIFICATIONSENTON_ISSET_ID, value);
389
  }
390
 
391
  public boolean isIsSMSVerified() {
392
    return this.isSMSVerified;
393
  }
394
 
395
  public UserState setIsSMSVerified(boolean isSMSVerified) {
396
    this.isSMSVerified = isSMSVerified;
397
    setIsSMSVerifiedIsSet(true);
398
    return this;
399
  }
400
 
401
  public void unsetIsSMSVerified() {
402
    __isset_bit_vector.clear(__ISSMSVERIFIED_ISSET_ID);
403
  }
404
 
405
  /** Returns true if field isSMSVerified is set (has been asigned a value) and false otherwise */
406
  public boolean isSetIsSMSVerified() {
407
    return __isset_bit_vector.get(__ISSMSVERIFIED_ISSET_ID);
408
  }
409
 
410
  public void setIsSMSVerifiedIsSet(boolean value) {
411
    __isset_bit_vector.set(__ISSMSVERIFIED_ISSET_ID, value);
412
  }
413
 
414
  public long getActiveSince() {
415
    return this.activeSince;
416
  }
417
 
418
  public UserState setActiveSince(long activeSince) {
419
    this.activeSince = activeSince;
420
    setActiveSinceIsSet(true);
421
    return this;
422
  }
423
 
424
  public void unsetActiveSince() {
425
    __isset_bit_vector.clear(__ACTIVESINCE_ISSET_ID);
426
  }
427
 
428
  /** Returns true if field activeSince is set (has been asigned a value) and false otherwise */
429
  public boolean isSetActiveSince() {
430
    return __isset_bit_vector.get(__ACTIVESINCE_ISSET_ID);
431
  }
432
 
433
  public void setActiveSinceIsSet(boolean value) {
434
    __isset_bit_vector.set(__ACTIVESINCE_ISSET_ID, value);
435
  }
436
 
437
  public boolean isIsLoggedIn() {
438
    return this.isLoggedIn;
439
  }
440
 
441
  public UserState setIsLoggedIn(boolean isLoggedIn) {
442
    this.isLoggedIn = isLoggedIn;
443
    setIsLoggedInIsSet(true);
444
    return this;
445
  }
446
 
447
  public void unsetIsLoggedIn() {
448
    __isset_bit_vector.clear(__ISLOGGEDIN_ISSET_ID);
449
  }
450
 
451
  /** Returns true if field isLoggedIn is set (has been asigned a value) and false otherwise */
452
  public boolean isSetIsLoggedIn() {
453
    return __isset_bit_vector.get(__ISLOGGEDIN_ISSET_ID);
454
  }
455
 
456
  public void setIsLoggedInIsSet(boolean value) {
457
    __isset_bit_vector.set(__ISLOGGEDIN_ISSET_ID, value);
458
  }
459
 
460
  public int getIpsSize() {
461
    return (this.ips == null) ? 0 : this.ips.size();
462
  }
463
 
464
  public java.util.Iterator<IPMap> getIpsIterator() {
465
    return (this.ips == null) ? null : this.ips.iterator();
466
  }
467
 
468
  public void addToIps(IPMap elem) {
469
    if (this.ips == null) {
470
      this.ips = new ArrayList<IPMap>();
471
    }
472
    this.ips.add(elem);
473
  }
474
 
475
  public List<IPMap> getIps() {
476
    return this.ips;
477
  }
478
 
479
  public UserState setIps(List<IPMap> ips) {
480
    this.ips = ips;
481
    return this;
482
  }
483
 
484
  public void unsetIps() {
485
    this.ips = null;
486
  }
487
 
488
  /** Returns true if field ips is set (has been asigned a value) and false otherwise */
489
  public boolean isSetIps() {
490
    return this.ips != null;
491
  }
492
 
493
  public void setIpsIsSet(boolean value) {
494
    if (!value) {
495
      this.ips = null;
496
    }
497
  }
498
 
499
  public long getShoppingCartHandle() {
500
    return this.shoppingCartHandle;
501
  }
502
 
503
  public UserState setShoppingCartHandle(long shoppingCartHandle) {
504
    this.shoppingCartHandle = shoppingCartHandle;
505
    setShoppingCartHandleIsSet(true);
506
    return this;
507
  }
508
 
509
  public void unsetShoppingCartHandle() {
510
    __isset_bit_vector.clear(__SHOPPINGCARTHANDLE_ISSET_ID);
511
  }
512
 
513
  /** Returns true if field shoppingCartHandle is set (has been asigned a value) and false otherwise */
514
  public boolean isSetShoppingCartHandle() {
515
    return __isset_bit_vector.get(__SHOPPINGCARTHANDLE_ISSET_ID);
516
  }
517
 
518
  public void setShoppingCartHandleIsSet(boolean value) {
519
    __isset_bit_vector.set(__SHOPPINGCARTHANDLE_ISSET_ID, value);
520
  }
521
 
130 ashish 522
  /**
523
   * 
524
   * @see AccountStatus
525
   */
526
  public AccountStatus getStatus() {
527
    return this.status;
528
  }
529
 
530
  /**
531
   * 
532
   * @see AccountStatus
533
   */
534
  public UserState setStatus(AccountStatus status) {
535
    this.status = status;
536
    return this;
537
  }
538
 
539
  public void unsetStatus() {
540
    this.status = null;
541
  }
542
 
543
  /** Returns true if field status is set (has been asigned a value) and false otherwise */
544
  public boolean isSetStatus() {
545
    return this.status != null;
546
  }
547
 
548
  public void setStatusIsSet(boolean value) {
549
    if (!value) {
550
      this.status = null;
551
    }
552
  }
553
 
123 ashish 554
  public void setFieldValue(_Fields field, Object value) {
555
    switch (field) {
556
    case USER_ID:
557
      if (value == null) {
558
        unsetUserId();
559
      } else {
560
        setUserId((Long)value);
561
      }
562
      break;
563
 
564
    case IS_EMAIL_VERIFIED:
565
      if (value == null) {
566
        unsetIsEmailVerified();
567
      } else {
568
        setIsEmailVerified((Boolean)value);
569
      }
570
      break;
571
 
572
    case LAST_LOGIN:
573
      if (value == null) {
574
        unsetLastLogin();
575
      } else {
576
        setLastLogin((Long)value);
577
      }
578
      break;
579
 
580
    case LAST_LOGOUT:
581
      if (value == null) {
582
        unsetLastLogout();
583
      } else {
584
        setLastLogout((Long)value);
585
      }
586
      break;
587
 
588
    case EMAIL_VERIFICATION_SENT_ON:
589
      if (value == null) {
590
        unsetEmailVerificationSentOn();
591
      } else {
592
        setEmailVerificationSentOn((Long)value);
593
      }
594
      break;
595
 
596
    case SMS_VERIFICATION_SENT_ON:
597
      if (value == null) {
598
        unsetSmsVerificationSentOn();
599
      } else {
600
        setSmsVerificationSentOn((Long)value);
601
      }
602
      break;
603
 
604
    case IS_SMSVERIFIED:
605
      if (value == null) {
606
        unsetIsSMSVerified();
607
      } else {
608
        setIsSMSVerified((Boolean)value);
609
      }
610
      break;
611
 
612
    case ACTIVE_SINCE:
613
      if (value == null) {
614
        unsetActiveSince();
615
      } else {
616
        setActiveSince((Long)value);
617
      }
618
      break;
619
 
620
    case IS_LOGGED_IN:
621
      if (value == null) {
622
        unsetIsLoggedIn();
623
      } else {
624
        setIsLoggedIn((Boolean)value);
625
      }
626
      break;
627
 
628
    case IPS:
629
      if (value == null) {
630
        unsetIps();
631
      } else {
632
        setIps((List<IPMap>)value);
633
      }
634
      break;
635
 
636
    case SHOPPING_CART_HANDLE:
637
      if (value == null) {
638
        unsetShoppingCartHandle();
639
      } else {
640
        setShoppingCartHandle((Long)value);
641
      }
642
      break;
643
 
130 ashish 644
    case STATUS:
645
      if (value == null) {
646
        unsetStatus();
647
      } else {
648
        setStatus((AccountStatus)value);
649
      }
650
      break;
651
 
123 ashish 652
    }
653
  }
654
 
655
  public void setFieldValue(int fieldID, Object value) {
656
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
657
  }
658
 
659
  public Object getFieldValue(_Fields field) {
660
    switch (field) {
661
    case USER_ID:
662
      return new Long(getUserId());
663
 
664
    case IS_EMAIL_VERIFIED:
665
      return new Boolean(isIsEmailVerified());
666
 
667
    case LAST_LOGIN:
668
      return new Long(getLastLogin());
669
 
670
    case LAST_LOGOUT:
671
      return new Long(getLastLogout());
672
 
673
    case EMAIL_VERIFICATION_SENT_ON:
674
      return new Long(getEmailVerificationSentOn());
675
 
676
    case SMS_VERIFICATION_SENT_ON:
677
      return new Long(getSmsVerificationSentOn());
678
 
679
    case IS_SMSVERIFIED:
680
      return new Boolean(isIsSMSVerified());
681
 
682
    case ACTIVE_SINCE:
683
      return new Long(getActiveSince());
684
 
685
    case IS_LOGGED_IN:
686
      return new Boolean(isIsLoggedIn());
687
 
688
    case IPS:
689
      return getIps();
690
 
691
    case SHOPPING_CART_HANDLE:
692
      return new Long(getShoppingCartHandle());
693
 
130 ashish 694
    case STATUS:
695
      return getStatus();
696
 
123 ashish 697
    }
698
    throw new IllegalStateException();
699
  }
700
 
701
  public Object getFieldValue(int fieldId) {
702
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
703
  }
704
 
705
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
706
  public boolean isSet(_Fields field) {
707
    switch (field) {
708
    case USER_ID:
709
      return isSetUserId();
710
    case IS_EMAIL_VERIFIED:
711
      return isSetIsEmailVerified();
712
    case LAST_LOGIN:
713
      return isSetLastLogin();
714
    case LAST_LOGOUT:
715
      return isSetLastLogout();
716
    case EMAIL_VERIFICATION_SENT_ON:
717
      return isSetEmailVerificationSentOn();
718
    case SMS_VERIFICATION_SENT_ON:
719
      return isSetSmsVerificationSentOn();
720
    case IS_SMSVERIFIED:
721
      return isSetIsSMSVerified();
722
    case ACTIVE_SINCE:
723
      return isSetActiveSince();
724
    case IS_LOGGED_IN:
725
      return isSetIsLoggedIn();
726
    case IPS:
727
      return isSetIps();
728
    case SHOPPING_CART_HANDLE:
729
      return isSetShoppingCartHandle();
130 ashish 730
    case STATUS:
731
      return isSetStatus();
123 ashish 732
    }
733
    throw new IllegalStateException();
734
  }
735
 
736
  public boolean isSet(int fieldID) {
737
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
738
  }
739
 
740
  @Override
741
  public boolean equals(Object that) {
742
    if (that == null)
743
      return false;
744
    if (that instanceof UserState)
745
      return this.equals((UserState)that);
746
    return false;
747
  }
748
 
749
  public boolean equals(UserState that) {
750
    if (that == null)
751
      return false;
752
 
753
    boolean this_present_userId = true;
754
    boolean that_present_userId = true;
755
    if (this_present_userId || that_present_userId) {
756
      if (!(this_present_userId && that_present_userId))
757
        return false;
758
      if (this.userId != that.userId)
759
        return false;
760
    }
761
 
762
    boolean this_present_isEmailVerified = true;
763
    boolean that_present_isEmailVerified = true;
764
    if (this_present_isEmailVerified || that_present_isEmailVerified) {
765
      if (!(this_present_isEmailVerified && that_present_isEmailVerified))
766
        return false;
767
      if (this.isEmailVerified != that.isEmailVerified)
768
        return false;
769
    }
770
 
771
    boolean this_present_lastLogin = true;
772
    boolean that_present_lastLogin = true;
773
    if (this_present_lastLogin || that_present_lastLogin) {
774
      if (!(this_present_lastLogin && that_present_lastLogin))
775
        return false;
776
      if (this.lastLogin != that.lastLogin)
777
        return false;
778
    }
779
 
780
    boolean this_present_lastLogout = true;
781
    boolean that_present_lastLogout = true;
782
    if (this_present_lastLogout || that_present_lastLogout) {
783
      if (!(this_present_lastLogout && that_present_lastLogout))
784
        return false;
785
      if (this.lastLogout != that.lastLogout)
786
        return false;
787
    }
788
 
789
    boolean this_present_emailVerificationSentOn = true;
790
    boolean that_present_emailVerificationSentOn = true;
791
    if (this_present_emailVerificationSentOn || that_present_emailVerificationSentOn) {
792
      if (!(this_present_emailVerificationSentOn && that_present_emailVerificationSentOn))
793
        return false;
794
      if (this.emailVerificationSentOn != that.emailVerificationSentOn)
795
        return false;
796
    }
797
 
798
    boolean this_present_smsVerificationSentOn = true;
799
    boolean that_present_smsVerificationSentOn = true;
800
    if (this_present_smsVerificationSentOn || that_present_smsVerificationSentOn) {
801
      if (!(this_present_smsVerificationSentOn && that_present_smsVerificationSentOn))
802
        return false;
803
      if (this.smsVerificationSentOn != that.smsVerificationSentOn)
804
        return false;
805
    }
806
 
807
    boolean this_present_isSMSVerified = true;
808
    boolean that_present_isSMSVerified = true;
809
    if (this_present_isSMSVerified || that_present_isSMSVerified) {
810
      if (!(this_present_isSMSVerified && that_present_isSMSVerified))
811
        return false;
812
      if (this.isSMSVerified != that.isSMSVerified)
813
        return false;
814
    }
815
 
816
    boolean this_present_activeSince = true;
817
    boolean that_present_activeSince = true;
818
    if (this_present_activeSince || that_present_activeSince) {
819
      if (!(this_present_activeSince && that_present_activeSince))
820
        return false;
821
      if (this.activeSince != that.activeSince)
822
        return false;
823
    }
824
 
825
    boolean this_present_isLoggedIn = true;
826
    boolean that_present_isLoggedIn = true;
827
    if (this_present_isLoggedIn || that_present_isLoggedIn) {
828
      if (!(this_present_isLoggedIn && that_present_isLoggedIn))
829
        return false;
830
      if (this.isLoggedIn != that.isLoggedIn)
831
        return false;
832
    }
833
 
834
    boolean this_present_ips = true && this.isSetIps();
835
    boolean that_present_ips = true && that.isSetIps();
836
    if (this_present_ips || that_present_ips) {
837
      if (!(this_present_ips && that_present_ips))
838
        return false;
839
      if (!this.ips.equals(that.ips))
840
        return false;
841
    }
842
 
843
    boolean this_present_shoppingCartHandle = true;
844
    boolean that_present_shoppingCartHandle = true;
845
    if (this_present_shoppingCartHandle || that_present_shoppingCartHandle) {
846
      if (!(this_present_shoppingCartHandle && that_present_shoppingCartHandle))
847
        return false;
848
      if (this.shoppingCartHandle != that.shoppingCartHandle)
849
        return false;
850
    }
851
 
130 ashish 852
    boolean this_present_status = true && this.isSetStatus();
853
    boolean that_present_status = true && that.isSetStatus();
854
    if (this_present_status || that_present_status) {
855
      if (!(this_present_status && that_present_status))
856
        return false;
857
      if (!this.status.equals(that.status))
858
        return false;
859
    }
860
 
123 ashish 861
    return true;
862
  }
863
 
864
  @Override
865
  public int hashCode() {
866
    return 0;
867
  }
868
 
869
  public int compareTo(UserState other) {
870
    if (!getClass().equals(other.getClass())) {
871
      return getClass().getName().compareTo(other.getClass().getName());
872
    }
873
 
874
    int lastComparison = 0;
875
    UserState typedOther = (UserState)other;
876
 
877
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
878
    if (lastComparison != 0) {
879
      return lastComparison;
880
    }
881
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
882
    if (lastComparison != 0) {
883
      return lastComparison;
884
    }
885
    lastComparison = Boolean.valueOf(isSetIsEmailVerified()).compareTo(isSetIsEmailVerified());
886
    if (lastComparison != 0) {
887
      return lastComparison;
888
    }
889
    lastComparison = TBaseHelper.compareTo(isEmailVerified, typedOther.isEmailVerified);
890
    if (lastComparison != 0) {
891
      return lastComparison;
892
    }
893
    lastComparison = Boolean.valueOf(isSetLastLogin()).compareTo(isSetLastLogin());
894
    if (lastComparison != 0) {
895
      return lastComparison;
896
    }
897
    lastComparison = TBaseHelper.compareTo(lastLogin, typedOther.lastLogin);
898
    if (lastComparison != 0) {
899
      return lastComparison;
900
    }
901
    lastComparison = Boolean.valueOf(isSetLastLogout()).compareTo(isSetLastLogout());
902
    if (lastComparison != 0) {
903
      return lastComparison;
904
    }
905
    lastComparison = TBaseHelper.compareTo(lastLogout, typedOther.lastLogout);
906
    if (lastComparison != 0) {
907
      return lastComparison;
908
    }
909
    lastComparison = Boolean.valueOf(isSetEmailVerificationSentOn()).compareTo(isSetEmailVerificationSentOn());
910
    if (lastComparison != 0) {
911
      return lastComparison;
912
    }
913
    lastComparison = TBaseHelper.compareTo(emailVerificationSentOn, typedOther.emailVerificationSentOn);
914
    if (lastComparison != 0) {
915
      return lastComparison;
916
    }
917
    lastComparison = Boolean.valueOf(isSetSmsVerificationSentOn()).compareTo(isSetSmsVerificationSentOn());
918
    if (lastComparison != 0) {
919
      return lastComparison;
920
    }
921
    lastComparison = TBaseHelper.compareTo(smsVerificationSentOn, typedOther.smsVerificationSentOn);
922
    if (lastComparison != 0) {
923
      return lastComparison;
924
    }
925
    lastComparison = Boolean.valueOf(isSetIsSMSVerified()).compareTo(isSetIsSMSVerified());
926
    if (lastComparison != 0) {
927
      return lastComparison;
928
    }
929
    lastComparison = TBaseHelper.compareTo(isSMSVerified, typedOther.isSMSVerified);
930
    if (lastComparison != 0) {
931
      return lastComparison;
932
    }
933
    lastComparison = Boolean.valueOf(isSetActiveSince()).compareTo(isSetActiveSince());
934
    if (lastComparison != 0) {
935
      return lastComparison;
936
    }
937
    lastComparison = TBaseHelper.compareTo(activeSince, typedOther.activeSince);
938
    if (lastComparison != 0) {
939
      return lastComparison;
940
    }
941
    lastComparison = Boolean.valueOf(isSetIsLoggedIn()).compareTo(isSetIsLoggedIn());
942
    if (lastComparison != 0) {
943
      return lastComparison;
944
    }
945
    lastComparison = TBaseHelper.compareTo(isLoggedIn, typedOther.isLoggedIn);
946
    if (lastComparison != 0) {
947
      return lastComparison;
948
    }
949
    lastComparison = Boolean.valueOf(isSetIps()).compareTo(isSetIps());
950
    if (lastComparison != 0) {
951
      return lastComparison;
952
    }
953
    lastComparison = TBaseHelper.compareTo(ips, typedOther.ips);
954
    if (lastComparison != 0) {
955
      return lastComparison;
956
    }
957
    lastComparison = Boolean.valueOf(isSetShoppingCartHandle()).compareTo(isSetShoppingCartHandle());
958
    if (lastComparison != 0) {
959
      return lastComparison;
960
    }
961
    lastComparison = TBaseHelper.compareTo(shoppingCartHandle, typedOther.shoppingCartHandle);
962
    if (lastComparison != 0) {
963
      return lastComparison;
964
    }
130 ashish 965
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
966
    if (lastComparison != 0) {
967
      return lastComparison;
968
    }
969
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
970
    if (lastComparison != 0) {
971
      return lastComparison;
972
    }
123 ashish 973
    return 0;
974
  }
975
 
976
  public void read(TProtocol iprot) throws TException {
977
    TField field;
978
    iprot.readStructBegin();
979
    while (true)
980
    {
981
      field = iprot.readFieldBegin();
982
      if (field.type == TType.STOP) { 
983
        break;
984
      }
985
      _Fields fieldId = _Fields.findByThriftId(field.id);
986
      if (fieldId == null) {
987
        TProtocolUtil.skip(iprot, field.type);
988
      } else {
989
        switch (fieldId) {
990
          case USER_ID:
991
            if (field.type == TType.I64) {
992
              this.userId = iprot.readI64();
993
              setUserIdIsSet(true);
994
            } else { 
995
              TProtocolUtil.skip(iprot, field.type);
996
            }
997
            break;
998
          case IS_EMAIL_VERIFIED:
999
            if (field.type == TType.BOOL) {
1000
              this.isEmailVerified = iprot.readBool();
1001
              setIsEmailVerifiedIsSet(true);
1002
            } else { 
1003
              TProtocolUtil.skip(iprot, field.type);
1004
            }
1005
            break;
1006
          case LAST_LOGIN:
1007
            if (field.type == TType.I64) {
1008
              this.lastLogin = iprot.readI64();
1009
              setLastLoginIsSet(true);
1010
            } else { 
1011
              TProtocolUtil.skip(iprot, field.type);
1012
            }
1013
            break;
1014
          case LAST_LOGOUT:
1015
            if (field.type == TType.I64) {
1016
              this.lastLogout = iprot.readI64();
1017
              setLastLogoutIsSet(true);
1018
            } else { 
1019
              TProtocolUtil.skip(iprot, field.type);
1020
            }
1021
            break;
1022
          case EMAIL_VERIFICATION_SENT_ON:
1023
            if (field.type == TType.I64) {
1024
              this.emailVerificationSentOn = iprot.readI64();
1025
              setEmailVerificationSentOnIsSet(true);
1026
            } else { 
1027
              TProtocolUtil.skip(iprot, field.type);
1028
            }
1029
            break;
1030
          case SMS_VERIFICATION_SENT_ON:
1031
            if (field.type == TType.I64) {
1032
              this.smsVerificationSentOn = iprot.readI64();
1033
              setSmsVerificationSentOnIsSet(true);
1034
            } else { 
1035
              TProtocolUtil.skip(iprot, field.type);
1036
            }
1037
            break;
1038
          case IS_SMSVERIFIED:
1039
            if (field.type == TType.BOOL) {
1040
              this.isSMSVerified = iprot.readBool();
1041
              setIsSMSVerifiedIsSet(true);
1042
            } else { 
1043
              TProtocolUtil.skip(iprot, field.type);
1044
            }
1045
            break;
1046
          case ACTIVE_SINCE:
1047
            if (field.type == TType.I64) {
1048
              this.activeSince = iprot.readI64();
1049
              setActiveSinceIsSet(true);
1050
            } else { 
1051
              TProtocolUtil.skip(iprot, field.type);
1052
            }
1053
            break;
1054
          case IS_LOGGED_IN:
1055
            if (field.type == TType.BOOL) {
1056
              this.isLoggedIn = iprot.readBool();
1057
              setIsLoggedInIsSet(true);
1058
            } else { 
1059
              TProtocolUtil.skip(iprot, field.type);
1060
            }
1061
            break;
1062
          case IPS:
1063
            if (field.type == TType.LIST) {
1064
              {
130 ashish 1065
                TList _list8 = iprot.readListBegin();
1066
                this.ips = new ArrayList<IPMap>(_list8.size);
1067
                for (int _i9 = 0; _i9 < _list8.size; ++_i9)
123 ashish 1068
                {
130 ashish 1069
                  IPMap _elem10;
1070
                  _elem10 = new IPMap();
1071
                  _elem10.read(iprot);
1072
                  this.ips.add(_elem10);
123 ashish 1073
                }
1074
                iprot.readListEnd();
1075
              }
1076
            } else { 
1077
              TProtocolUtil.skip(iprot, field.type);
1078
            }
1079
            break;
1080
          case SHOPPING_CART_HANDLE:
1081
            if (field.type == TType.I64) {
1082
              this.shoppingCartHandle = iprot.readI64();
1083
              setShoppingCartHandleIsSet(true);
1084
            } else { 
1085
              TProtocolUtil.skip(iprot, field.type);
1086
            }
1087
            break;
130 ashish 1088
          case STATUS:
1089
            if (field.type == TType.I32) {
1090
              this.status = AccountStatus.findByValue(iprot.readI32());
1091
            } else { 
1092
              TProtocolUtil.skip(iprot, field.type);
1093
            }
1094
            break;
123 ashish 1095
        }
1096
        iprot.readFieldEnd();
1097
      }
1098
    }
1099
    iprot.readStructEnd();
1100
    validate();
1101
  }
1102
 
1103
  public void write(TProtocol oprot) throws TException {
1104
    validate();
1105
 
1106
    oprot.writeStructBegin(STRUCT_DESC);
1107
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
1108
    oprot.writeI64(this.userId);
1109
    oprot.writeFieldEnd();
1110
    oprot.writeFieldBegin(IS_EMAIL_VERIFIED_FIELD_DESC);
1111
    oprot.writeBool(this.isEmailVerified);
1112
    oprot.writeFieldEnd();
1113
    oprot.writeFieldBegin(LAST_LOGIN_FIELD_DESC);
1114
    oprot.writeI64(this.lastLogin);
1115
    oprot.writeFieldEnd();
1116
    oprot.writeFieldBegin(LAST_LOGOUT_FIELD_DESC);
1117
    oprot.writeI64(this.lastLogout);
1118
    oprot.writeFieldEnd();
1119
    oprot.writeFieldBegin(EMAIL_VERIFICATION_SENT_ON_FIELD_DESC);
1120
    oprot.writeI64(this.emailVerificationSentOn);
1121
    oprot.writeFieldEnd();
1122
    oprot.writeFieldBegin(SMS_VERIFICATION_SENT_ON_FIELD_DESC);
1123
    oprot.writeI64(this.smsVerificationSentOn);
1124
    oprot.writeFieldEnd();
1125
    oprot.writeFieldBegin(IS_SMSVERIFIED_FIELD_DESC);
1126
    oprot.writeBool(this.isSMSVerified);
1127
    oprot.writeFieldEnd();
1128
    oprot.writeFieldBegin(ACTIVE_SINCE_FIELD_DESC);
1129
    oprot.writeI64(this.activeSince);
1130
    oprot.writeFieldEnd();
1131
    oprot.writeFieldBegin(IS_LOGGED_IN_FIELD_DESC);
1132
    oprot.writeBool(this.isLoggedIn);
1133
    oprot.writeFieldEnd();
1134
    if (this.ips != null) {
1135
      oprot.writeFieldBegin(IPS_FIELD_DESC);
1136
      {
1137
        oprot.writeListBegin(new TList(TType.STRUCT, this.ips.size()));
130 ashish 1138
        for (IPMap _iter11 : this.ips)
123 ashish 1139
        {
130 ashish 1140
          _iter11.write(oprot);
123 ashish 1141
        }
1142
        oprot.writeListEnd();
1143
      }
1144
      oprot.writeFieldEnd();
1145
    }
1146
    oprot.writeFieldBegin(SHOPPING_CART_HANDLE_FIELD_DESC);
1147
    oprot.writeI64(this.shoppingCartHandle);
1148
    oprot.writeFieldEnd();
130 ashish 1149
    if (this.status != null) {
1150
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
1151
      oprot.writeI32(this.status.getValue());
1152
      oprot.writeFieldEnd();
1153
    }
123 ashish 1154
    oprot.writeFieldStop();
1155
    oprot.writeStructEnd();
1156
  }
1157
 
1158
  @Override
1159
  public String toString() {
1160
    StringBuilder sb = new StringBuilder("UserState(");
1161
    boolean first = true;
1162
 
1163
    sb.append("userId:");
1164
    sb.append(this.userId);
1165
    first = false;
1166
    if (!first) sb.append(", ");
1167
    sb.append("isEmailVerified:");
1168
    sb.append(this.isEmailVerified);
1169
    first = false;
1170
    if (!first) sb.append(", ");
1171
    sb.append("lastLogin:");
1172
    sb.append(this.lastLogin);
1173
    first = false;
1174
    if (!first) sb.append(", ");
1175
    sb.append("lastLogout:");
1176
    sb.append(this.lastLogout);
1177
    first = false;
1178
    if (!first) sb.append(", ");
1179
    sb.append("emailVerificationSentOn:");
1180
    sb.append(this.emailVerificationSentOn);
1181
    first = false;
1182
    if (!first) sb.append(", ");
1183
    sb.append("smsVerificationSentOn:");
1184
    sb.append(this.smsVerificationSentOn);
1185
    first = false;
1186
    if (!first) sb.append(", ");
1187
    sb.append("isSMSVerified:");
1188
    sb.append(this.isSMSVerified);
1189
    first = false;
1190
    if (!first) sb.append(", ");
1191
    sb.append("activeSince:");
1192
    sb.append(this.activeSince);
1193
    first = false;
1194
    if (!first) sb.append(", ");
1195
    sb.append("isLoggedIn:");
1196
    sb.append(this.isLoggedIn);
1197
    first = false;
1198
    if (!first) sb.append(", ");
1199
    sb.append("ips:");
1200
    if (this.ips == null) {
1201
      sb.append("null");
1202
    } else {
1203
      sb.append(this.ips);
1204
    }
1205
    first = false;
1206
    if (!first) sb.append(", ");
1207
    sb.append("shoppingCartHandle:");
1208
    sb.append(this.shoppingCartHandle);
1209
    first = false;
130 ashish 1210
    if (!first) sb.append(", ");
1211
    sb.append("status:");
1212
    if (this.status == null) {
1213
      sb.append("null");
1214
    } else {
1215
      String status_name = status.name();
1216
      if (status_name != null) {
1217
        sb.append(status_name);
1218
        sb.append(" (");
1219
      }
1220
      sb.append(this.status);
1221
      if (status_name != null) {
1222
        sb.append(")");
1223
      }
1224
    }
1225
    first = false;
123 ashish 1226
    sb.append(")");
1227
    return sb.toString();
1228
  }
1229
 
1230
  public void validate() throws TException {
1231
    // check for required fields
1232
  }
1233
 
1234
}
1235