Subversion Repositories SmartDukaan

Rev

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

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