Subversion Repositories SmartDukaan

Rev

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