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