Subversion Repositories SmartDukaan

Rev

Rev 2443 | Rev 3430 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
506 rajveer 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.utils;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class DashboardUser implements TBase<DashboardUser._Fields>, java.io.Serializable, Cloneable, Comparable<DashboardUser> {
27
  private static final TStruct STRUCT_DESC = new TStruct("DashboardUser");
28
 
29
  private static final TField USERNAME_FIELD_DESC = new TField("username", TType.STRING, (short)1);
30
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)2);
2443 chandransh 31
  private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)3);
2779 chandransh 32
  private static final TField ROLE_FIELD_DESC = new TField("role", TType.I32, (short)4);
506 rajveer 33
 
34
  private String username;
35
  private String password;
2443 chandransh 36
  private long warehouseId;
2779 chandransh 37
  private Role role;
506 rajveer 38
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
41
    USERNAME((short)1, "username"),
42
    PASSWORD((short)2, "password"),
2443 chandransh 43
    WAREHOUSE_ID((short)3, "warehouseId"),
2779 chandransh 44
    /**
45
     * 
46
     * @see Role
47
     */
48
    ROLE((short)4, "role");
506 rajveer 49
 
50
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
51
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
52
 
53
    static {
54
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
55
        byId.put((int)field._thriftId, field);
56
        byName.put(field.getFieldName(), field);
57
      }
58
    }
59
 
60
    /**
61
     * Find the _Fields constant that matches fieldId, or null if its not found.
62
     */
63
    public static _Fields findByThriftId(int fieldId) {
64
      return byId.get(fieldId);
65
    }
66
 
67
    /**
68
     * Find the _Fields constant that matches fieldId, throwing an exception
69
     * if it is not found.
70
     */
71
    public static _Fields findByThriftIdOrThrow(int fieldId) {
72
      _Fields fields = findByThriftId(fieldId);
73
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
74
      return fields;
75
    }
76
 
77
    /**
78
     * Find the _Fields constant that matches name, or null if its not found.
79
     */
80
    public static _Fields findByName(String name) {
81
      return byName.get(name);
82
    }
83
 
84
    private final short _thriftId;
85
    private final String _fieldName;
86
 
87
    _Fields(short thriftId, String fieldName) {
88
      _thriftId = thriftId;
89
      _fieldName = fieldName;
90
    }
91
 
92
    public short getThriftFieldId() {
93
      return _thriftId;
94
    }
95
 
96
    public String getFieldName() {
97
      return _fieldName;
98
    }
99
  }
100
 
101
  // isset id assignments
2443 chandransh 102
  private static final int __WAREHOUSEID_ISSET_ID = 0;
2779 chandransh 103
  private BitSet __isset_bit_vector = new BitSet(1);
506 rajveer 104
 
105
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
106
    put(_Fields.USERNAME, new FieldMetaData("username", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.STRING)));
108
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.STRING)));
2443 chandransh 110
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
506 rajveer 111
        new FieldValueMetaData(TType.I64)));
2779 chandransh 112
    put(_Fields.ROLE, new FieldMetaData("role", TFieldRequirementType.DEFAULT, 
113
        new EnumMetaData(TType.ENUM, Role.class)));
506 rajveer 114
  }});
115
 
116
  static {
117
    FieldMetaData.addStructMetaDataMap(DashboardUser.class, metaDataMap);
118
  }
119
 
120
  public DashboardUser() {
121
  }
122
 
123
  public DashboardUser(
124
    String username,
125
    String password,
2443 chandransh 126
    long warehouseId,
2779 chandransh 127
    Role role)
506 rajveer 128
  {
129
    this();
130
    this.username = username;
131
    this.password = password;
2443 chandransh 132
    this.warehouseId = warehouseId;
133
    setWarehouseIdIsSet(true);
2779 chandransh 134
    this.role = role;
506 rajveer 135
  }
136
 
137
  /**
138
   * Performs a deep copy on <i>other</i>.
139
   */
140
  public DashboardUser(DashboardUser other) {
141
    __isset_bit_vector.clear();
142
    __isset_bit_vector.or(other.__isset_bit_vector);
143
    if (other.isSetUsername()) {
144
      this.username = other.username;
145
    }
146
    if (other.isSetPassword()) {
147
      this.password = other.password;
148
    }
2443 chandransh 149
    this.warehouseId = other.warehouseId;
2779 chandransh 150
    if (other.isSetRole()) {
151
      this.role = other.role;
152
    }
506 rajveer 153
  }
154
 
155
  public DashboardUser deepCopy() {
156
    return new DashboardUser(this);
157
  }
158
 
159
  @Deprecated
160
  public DashboardUser clone() {
161
    return new DashboardUser(this);
162
  }
163
 
164
  public String getUsername() {
165
    return this.username;
166
  }
167
 
168
  public DashboardUser setUsername(String username) {
169
    this.username = username;
170
    return this;
171
  }
172
 
173
  public void unsetUsername() {
174
    this.username = null;
175
  }
176
 
177
  /** Returns true if field username is set (has been asigned a value) and false otherwise */
178
  public boolean isSetUsername() {
179
    return this.username != null;
180
  }
181
 
182
  public void setUsernameIsSet(boolean value) {
183
    if (!value) {
184
      this.username = null;
185
    }
186
  }
187
 
188
  public String getPassword() {
189
    return this.password;
190
  }
191
 
192
  public DashboardUser setPassword(String password) {
193
    this.password = password;
194
    return this;
195
  }
196
 
197
  public void unsetPassword() {
198
    this.password = null;
199
  }
200
 
201
  /** Returns true if field password is set (has been asigned a value) and false otherwise */
202
  public boolean isSetPassword() {
203
    return this.password != null;
204
  }
205
 
206
  public void setPasswordIsSet(boolean value) {
207
    if (!value) {
208
      this.password = null;
209
    }
210
  }
211
 
2443 chandransh 212
  public long getWarehouseId() {
213
    return this.warehouseId;
506 rajveer 214
  }
215
 
2443 chandransh 216
  public DashboardUser setWarehouseId(long warehouseId) {
217
    this.warehouseId = warehouseId;
218
    setWarehouseIdIsSet(true);
506 rajveer 219
    return this;
220
  }
221
 
2443 chandransh 222
  public void unsetWarehouseId() {
223
    __isset_bit_vector.clear(__WAREHOUSEID_ISSET_ID);
506 rajveer 224
  }
225
 
2443 chandransh 226
  /** Returns true if field warehouseId is set (has been asigned a value) and false otherwise */
227
  public boolean isSetWarehouseId() {
228
    return __isset_bit_vector.get(__WAREHOUSEID_ISSET_ID);
506 rajveer 229
  }
230
 
2443 chandransh 231
  public void setWarehouseIdIsSet(boolean value) {
232
    __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
506 rajveer 233
  }
234
 
2779 chandransh 235
  /**
236
   * 
237
   * @see Role
238
   */
239
  public Role getRole() {
240
    return this.role;
506 rajveer 241
  }
242
 
2779 chandransh 243
  /**
244
   * 
245
   * @see Role
246
   */
247
  public DashboardUser setRole(Role role) {
248
    this.role = role;
506 rajveer 249
    return this;
250
  }
251
 
2779 chandransh 252
  public void unsetRole() {
253
    this.role = null;
506 rajveer 254
  }
255
 
2779 chandransh 256
  /** Returns true if field role is set (has been asigned a value) and false otherwise */
257
  public boolean isSetRole() {
258
    return this.role != null;
506 rajveer 259
  }
260
 
2779 chandransh 261
  public void setRoleIsSet(boolean value) {
262
    if (!value) {
263
      this.role = null;
264
    }
506 rajveer 265
  }
266
 
267
  public void setFieldValue(_Fields field, Object value) {
268
    switch (field) {
269
    case USERNAME:
270
      if (value == null) {
271
        unsetUsername();
272
      } else {
273
        setUsername((String)value);
274
      }
275
      break;
276
 
277
    case PASSWORD:
278
      if (value == null) {
279
        unsetPassword();
280
      } else {
281
        setPassword((String)value);
282
      }
283
      break;
284
 
2443 chandransh 285
    case WAREHOUSE_ID:
506 rajveer 286
      if (value == null) {
2443 chandransh 287
        unsetWarehouseId();
506 rajveer 288
      } else {
2443 chandransh 289
        setWarehouseId((Long)value);
506 rajveer 290
      }
291
      break;
292
 
2779 chandransh 293
    case ROLE:
506 rajveer 294
      if (value == null) {
2779 chandransh 295
        unsetRole();
506 rajveer 296
      } else {
2779 chandransh 297
        setRole((Role)value);
506 rajveer 298
      }
299
      break;
300
 
301
    }
302
  }
303
 
304
  public void setFieldValue(int fieldID, Object value) {
305
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
306
  }
307
 
308
  public Object getFieldValue(_Fields field) {
309
    switch (field) {
310
    case USERNAME:
311
      return getUsername();
312
 
313
    case PASSWORD:
314
      return getPassword();
315
 
2443 chandransh 316
    case WAREHOUSE_ID:
317
      return new Long(getWarehouseId());
506 rajveer 318
 
2779 chandransh 319
    case ROLE:
320
      return getRole();
506 rajveer 321
 
322
    }
323
    throw new IllegalStateException();
324
  }
325
 
326
  public Object getFieldValue(int fieldId) {
327
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
328
  }
329
 
330
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
331
  public boolean isSet(_Fields field) {
332
    switch (field) {
333
    case USERNAME:
334
      return isSetUsername();
335
    case PASSWORD:
336
      return isSetPassword();
2443 chandransh 337
    case WAREHOUSE_ID:
338
      return isSetWarehouseId();
2779 chandransh 339
    case ROLE:
340
      return isSetRole();
506 rajveer 341
    }
342
    throw new IllegalStateException();
343
  }
344
 
345
  public boolean isSet(int fieldID) {
346
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
347
  }
348
 
349
  @Override
350
  public boolean equals(Object that) {
351
    if (that == null)
352
      return false;
353
    if (that instanceof DashboardUser)
354
      return this.equals((DashboardUser)that);
355
    return false;
356
  }
357
 
358
  public boolean equals(DashboardUser that) {
359
    if (that == null)
360
      return false;
361
 
362
    boolean this_present_username = true && this.isSetUsername();
363
    boolean that_present_username = true && that.isSetUsername();
364
    if (this_present_username || that_present_username) {
365
      if (!(this_present_username && that_present_username))
366
        return false;
367
      if (!this.username.equals(that.username))
368
        return false;
369
    }
370
 
371
    boolean this_present_password = true && this.isSetPassword();
372
    boolean that_present_password = true && that.isSetPassword();
373
    if (this_present_password || that_present_password) {
374
      if (!(this_present_password && that_present_password))
375
        return false;
376
      if (!this.password.equals(that.password))
377
        return false;
378
    }
379
 
2443 chandransh 380
    boolean this_present_warehouseId = true;
381
    boolean that_present_warehouseId = true;
382
    if (this_present_warehouseId || that_present_warehouseId) {
383
      if (!(this_present_warehouseId && that_present_warehouseId))
506 rajveer 384
        return false;
2443 chandransh 385
      if (this.warehouseId != that.warehouseId)
506 rajveer 386
        return false;
387
    }
388
 
2779 chandransh 389
    boolean this_present_role = true && this.isSetRole();
390
    boolean that_present_role = true && that.isSetRole();
391
    if (this_present_role || that_present_role) {
392
      if (!(this_present_role && that_present_role))
506 rajveer 393
        return false;
2779 chandransh 394
      if (!this.role.equals(that.role))
506 rajveer 395
        return false;
396
    }
397
 
398
    return true;
399
  }
400
 
401
  @Override
402
  public int hashCode() {
403
    return 0;
404
  }
405
 
406
  public int compareTo(DashboardUser other) {
407
    if (!getClass().equals(other.getClass())) {
408
      return getClass().getName().compareTo(other.getClass().getName());
409
    }
410
 
411
    int lastComparison = 0;
412
    DashboardUser typedOther = (DashboardUser)other;
413
 
414
    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(isSetUsername());
415
    if (lastComparison != 0) {
416
      return lastComparison;
417
    }
418
    lastComparison = TBaseHelper.compareTo(username, typedOther.username);
419
    if (lastComparison != 0) {
420
      return lastComparison;
421
    }
422
    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(isSetPassword());
423
    if (lastComparison != 0) {
424
      return lastComparison;
425
    }
426
    lastComparison = TBaseHelper.compareTo(password, typedOther.password);
427
    if (lastComparison != 0) {
428
      return lastComparison;
429
    }
2443 chandransh 430
    lastComparison = Boolean.valueOf(isSetWarehouseId()).compareTo(isSetWarehouseId());
506 rajveer 431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
2443 chandransh 434
    lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
506 rajveer 435
    if (lastComparison != 0) {
436
      return lastComparison;
437
    }
2779 chandransh 438
    lastComparison = Boolean.valueOf(isSetRole()).compareTo(isSetRole());
506 rajveer 439
    if (lastComparison != 0) {
440
      return lastComparison;
441
    }
2779 chandransh 442
    lastComparison = TBaseHelper.compareTo(role, typedOther.role);
506 rajveer 443
    if (lastComparison != 0) {
444
      return lastComparison;
445
    }
446
    return 0;
447
  }
448
 
449
  public void read(TProtocol iprot) throws TException {
450
    TField field;
451
    iprot.readStructBegin();
452
    while (true)
453
    {
454
      field = iprot.readFieldBegin();
455
      if (field.type == TType.STOP) { 
456
        break;
457
      }
458
      _Fields fieldId = _Fields.findByThriftId(field.id);
459
      if (fieldId == null) {
460
        TProtocolUtil.skip(iprot, field.type);
461
      } else {
462
        switch (fieldId) {
463
          case USERNAME:
464
            if (field.type == TType.STRING) {
465
              this.username = iprot.readString();
466
            } else { 
467
              TProtocolUtil.skip(iprot, field.type);
468
            }
469
            break;
470
          case PASSWORD:
471
            if (field.type == TType.STRING) {
472
              this.password = iprot.readString();
473
            } else { 
474
              TProtocolUtil.skip(iprot, field.type);
475
            }
476
            break;
2443 chandransh 477
          case WAREHOUSE_ID:
506 rajveer 478
            if (field.type == TType.I64) {
2443 chandransh 479
              this.warehouseId = iprot.readI64();
480
              setWarehouseIdIsSet(true);
506 rajveer 481
            } else { 
482
              TProtocolUtil.skip(iprot, field.type);
483
            }
484
            break;
2779 chandransh 485
          case ROLE:
486
            if (field.type == TType.I32) {
487
              this.role = Role.findByValue(iprot.readI32());
506 rajveer 488
            } else { 
489
              TProtocolUtil.skip(iprot, field.type);
490
            }
491
            break;
492
        }
493
        iprot.readFieldEnd();
494
      }
495
    }
496
    iprot.readStructEnd();
497
    validate();
498
  }
499
 
500
  public void write(TProtocol oprot) throws TException {
501
    validate();
502
 
503
    oprot.writeStructBegin(STRUCT_DESC);
504
    if (this.username != null) {
505
      oprot.writeFieldBegin(USERNAME_FIELD_DESC);
506
      oprot.writeString(this.username);
507
      oprot.writeFieldEnd();
508
    }
509
    if (this.password != null) {
510
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
511
      oprot.writeString(this.password);
512
      oprot.writeFieldEnd();
513
    }
2443 chandransh 514
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
515
    oprot.writeI64(this.warehouseId);
506 rajveer 516
    oprot.writeFieldEnd();
2779 chandransh 517
    if (this.role != null) {
518
      oprot.writeFieldBegin(ROLE_FIELD_DESC);
519
      oprot.writeI32(this.role.getValue());
520
      oprot.writeFieldEnd();
521
    }
506 rajveer 522
    oprot.writeFieldStop();
523
    oprot.writeStructEnd();
524
  }
525
 
526
  @Override
527
  public String toString() {
528
    StringBuilder sb = new StringBuilder("DashboardUser(");
529
    boolean first = true;
530
 
531
    sb.append("username:");
532
    if (this.username == null) {
533
      sb.append("null");
534
    } else {
535
      sb.append(this.username);
536
    }
537
    first = false;
538
    if (!first) sb.append(", ");
539
    sb.append("password:");
540
    if (this.password == null) {
541
      sb.append("null");
542
    } else {
543
      sb.append(this.password);
544
    }
545
    first = false;
546
    if (!first) sb.append(", ");
2443 chandransh 547
    sb.append("warehouseId:");
548
    sb.append(this.warehouseId);
506 rajveer 549
    first = false;
550
    if (!first) sb.append(", ");
2779 chandransh 551
    sb.append("role:");
552
    if (this.role == null) {
553
      sb.append("null");
554
    } else {
555
      String role_name = role.name();
556
      if (role_name != null) {
557
        sb.append(role_name);
558
        sb.append(" (");
559
      }
560
      sb.append(this.role);
561
      if (role_name != null) {
562
        sb.append(")");
563
      }
564
    }
506 rajveer 565
    first = false;
566
    sb.append(")");
567
    return sb.toString();
568
  }
569
 
570
  public void validate() throws TException {
571
    // check for required fields
572
  }
573
 
574
}
575