Subversion Repositories SmartDukaan

Rev

Rev 2443 | Rev 3430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2443 Rev 2779
Line 27... Line 27...
27
  private static final TStruct STRUCT_DESC = new TStruct("DashboardUser");
27
  private static final TStruct STRUCT_DESC = new TStruct("DashboardUser");
28
 
28
 
29
  private static final TField USERNAME_FIELD_DESC = new TField("username", TType.STRING, (short)1);
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);
30
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)2);
31
  private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)3);
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);
32
  private static final TField ROLE_FIELD_DESC = new TField("role", TType.I32, (short)4);
33
 
33
 
34
  private String username;
34
  private String username;
35
  private String password;
35
  private String password;
36
  private long warehouseId;
36
  private long warehouseId;
37
  private boolean admin;
37
  private Role role;
38
 
38
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
40
  public enum _Fields implements TFieldIdEnum {
41
    USERNAME((short)1, "username"),
41
    USERNAME((short)1, "username"),
42
    PASSWORD((short)2, "password"),
42
    PASSWORD((short)2, "password"),
43
    WAREHOUSE_ID((short)3, "warehouseId"),
43
    WAREHOUSE_ID((short)3, "warehouseId"),
-
 
44
    /**
-
 
45
     * 
-
 
46
     * @see Role
-
 
47
     */
44
    ADMIN((short)4, "admin");
48
    ROLE((short)4, "role");
45
 
49
 
46
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
50
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
52
 
49
    static {
53
    static {
Line 94... Line 98...
94
    }
98
    }
95
  }
99
  }
96
 
100
 
97
  // isset id assignments
101
  // isset id assignments
98
  private static final int __WAREHOUSEID_ISSET_ID = 0;
102
  private static final int __WAREHOUSEID_ISSET_ID = 0;
99
  private static final int __ADMIN_ISSET_ID = 1;
-
 
100
  private BitSet __isset_bit_vector = new BitSet(2);
103
  private BitSet __isset_bit_vector = new BitSet(1);
101
 
104
 
102
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
105
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
103
    put(_Fields.USERNAME, new FieldMetaData("username", TFieldRequirementType.DEFAULT, 
106
    put(_Fields.USERNAME, new FieldMetaData("username", TFieldRequirementType.DEFAULT, 
104
        new FieldValueMetaData(TType.STRING)));
107
        new FieldValueMetaData(TType.STRING)));
105
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
108
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
106
        new FieldValueMetaData(TType.STRING)));
109
        new FieldValueMetaData(TType.STRING)));
107
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
110
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT, 
108
        new FieldValueMetaData(TType.I64)));
111
        new FieldValueMetaData(TType.I64)));
109
    put(_Fields.ADMIN, new FieldMetaData("admin", TFieldRequirementType.DEFAULT, 
112
    put(_Fields.ROLE, new FieldMetaData("role", TFieldRequirementType.DEFAULT, 
110
        new FieldValueMetaData(TType.BOOL)));
113
        new EnumMetaData(TType.ENUM, Role.class)));
111
  }});
114
  }});
112
 
115
 
113
  static {
116
  static {
114
    FieldMetaData.addStructMetaDataMap(DashboardUser.class, metaDataMap);
117
    FieldMetaData.addStructMetaDataMap(DashboardUser.class, metaDataMap);
115
  }
118
  }
Line 119... Line 122...
119
 
122
 
120
  public DashboardUser(
123
  public DashboardUser(
121
    String username,
124
    String username,
122
    String password,
125
    String password,
123
    long warehouseId,
126
    long warehouseId,
124
    boolean admin)
127
    Role role)
125
  {
128
  {
126
    this();
129
    this();
127
    this.username = username;
130
    this.username = username;
128
    this.password = password;
131
    this.password = password;
129
    this.warehouseId = warehouseId;
132
    this.warehouseId = warehouseId;
130
    setWarehouseIdIsSet(true);
133
    setWarehouseIdIsSet(true);
131
    this.admin = admin;
134
    this.role = role;
132
    setAdminIsSet(true);
-
 
133
  }
135
  }
134
 
136
 
135
  /**
137
  /**
136
   * Performs a deep copy on <i>other</i>.
138
   * Performs a deep copy on <i>other</i>.
137
   */
139
   */
Line 143... Line 145...
143
    }
145
    }
144
    if (other.isSetPassword()) {
146
    if (other.isSetPassword()) {
145
      this.password = other.password;
147
      this.password = other.password;
146
    }
148
    }
147
    this.warehouseId = other.warehouseId;
149
    this.warehouseId = other.warehouseId;
-
 
150
    if (other.isSetRole()) {
148
    this.admin = other.admin;
151
      this.role = other.role;
-
 
152
    }
149
  }
153
  }
150
 
154
 
151
  public DashboardUser deepCopy() {
155
  public DashboardUser deepCopy() {
152
    return new DashboardUser(this);
156
    return new DashboardUser(this);
153
  }
157
  }
Line 226... Line 230...
226
 
230
 
227
  public void setWarehouseIdIsSet(boolean value) {
231
  public void setWarehouseIdIsSet(boolean value) {
228
    __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
232
    __isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
229
  }
233
  }
230
 
234
 
-
 
235
  /**
-
 
236
   * 
-
 
237
   * @see Role
-
 
238
   */
231
  public boolean isAdmin() {
239
  public Role getRole() {
232
    return this.admin;
240
    return this.role;
233
  }
241
  }
234
 
242
 
-
 
243
  /**
-
 
244
   * 
-
 
245
   * @see Role
-
 
246
   */
235
  public DashboardUser setAdmin(boolean admin) {
247
  public DashboardUser setRole(Role role) {
236
    this.admin = admin;
248
    this.role = role;
237
    setAdminIsSet(true);
-
 
238
    return this;
249
    return this;
239
  }
250
  }
240
 
251
 
241
  public void unsetAdmin() {
252
  public void unsetRole() {
242
    __isset_bit_vector.clear(__ADMIN_ISSET_ID);
253
    this.role = null;
243
  }
254
  }
244
 
255
 
245
  /** Returns true if field admin is set (has been asigned a value) and false otherwise */
256
  /** Returns true if field role is set (has been asigned a value) and false otherwise */
246
  public boolean isSetAdmin() {
257
  public boolean isSetRole() {
247
    return __isset_bit_vector.get(__ADMIN_ISSET_ID);
258
    return this.role != null;
248
  }
259
  }
249
 
260
 
250
  public void setAdminIsSet(boolean value) {
261
  public void setRoleIsSet(boolean value) {
-
 
262
    if (!value) {
251
    __isset_bit_vector.set(__ADMIN_ISSET_ID, value);
263
      this.role = null;
-
 
264
    }
252
  }
265
  }
253
 
266
 
254
  public void setFieldValue(_Fields field, Object value) {
267
  public void setFieldValue(_Fields field, Object value) {
255
    switch (field) {
268
    switch (field) {
256
    case USERNAME:
269
    case USERNAME:
Line 275... Line 288...
275
      } else {
288
      } else {
276
        setWarehouseId((Long)value);
289
        setWarehouseId((Long)value);
277
      }
290
      }
278
      break;
291
      break;
279
 
292
 
280
    case ADMIN:
293
    case ROLE:
281
      if (value == null) {
294
      if (value == null) {
282
        unsetAdmin();
295
        unsetRole();
283
      } else {
296
      } else {
284
        setAdmin((Boolean)value);
297
        setRole((Role)value);
285
      }
298
      }
286
      break;
299
      break;
287
 
300
 
288
    }
301
    }
289
  }
302
  }
Line 301... Line 314...
301
      return getPassword();
314
      return getPassword();
302
 
315
 
303
    case WAREHOUSE_ID:
316
    case WAREHOUSE_ID:
304
      return new Long(getWarehouseId());
317
      return new Long(getWarehouseId());
305
 
318
 
306
    case ADMIN:
319
    case ROLE:
307
      return new Boolean(isAdmin());
320
      return getRole();
308
 
321
 
309
    }
322
    }
310
    throw new IllegalStateException();
323
    throw new IllegalStateException();
311
  }
324
  }
312
 
325
 
Line 321... Line 334...
321
      return isSetUsername();
334
      return isSetUsername();
322
    case PASSWORD:
335
    case PASSWORD:
323
      return isSetPassword();
336
      return isSetPassword();
324
    case WAREHOUSE_ID:
337
    case WAREHOUSE_ID:
325
      return isSetWarehouseId();
338
      return isSetWarehouseId();
326
    case ADMIN:
339
    case ROLE:
327
      return isSetAdmin();
340
      return isSetRole();
328
    }
341
    }
329
    throw new IllegalStateException();
342
    throw new IllegalStateException();
330
  }
343
  }
331
 
344
 
332
  public boolean isSet(int fieldID) {
345
  public boolean isSet(int fieldID) {
Line 371... Line 384...
371
        return false;
384
        return false;
372
      if (this.warehouseId != that.warehouseId)
385
      if (this.warehouseId != that.warehouseId)
373
        return false;
386
        return false;
374
    }
387
    }
375
 
388
 
376
    boolean this_present_admin = true;
389
    boolean this_present_role = true && this.isSetRole();
377
    boolean that_present_admin = true;
390
    boolean that_present_role = true && that.isSetRole();
378
    if (this_present_admin || that_present_admin) {
391
    if (this_present_role || that_present_role) {
379
      if (!(this_present_admin && that_present_admin))
392
      if (!(this_present_role && that_present_role))
380
        return false;
393
        return false;
381
      if (this.admin != that.admin)
394
      if (!this.role.equals(that.role))
382
        return false;
395
        return false;
383
    }
396
    }
384
 
397
 
385
    return true;
398
    return true;
386
  }
399
  }
Line 420... Line 433...
420
    }
433
    }
421
    lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
434
    lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
422
    if (lastComparison != 0) {
435
    if (lastComparison != 0) {
423
      return lastComparison;
436
      return lastComparison;
424
    }
437
    }
425
    lastComparison = Boolean.valueOf(isSetAdmin()).compareTo(isSetAdmin());
438
    lastComparison = Boolean.valueOf(isSetRole()).compareTo(isSetRole());
426
    if (lastComparison != 0) {
439
    if (lastComparison != 0) {
427
      return lastComparison;
440
      return lastComparison;
428
    }
441
    }
429
    lastComparison = TBaseHelper.compareTo(admin, typedOther.admin);
442
    lastComparison = TBaseHelper.compareTo(role, typedOther.role);
430
    if (lastComparison != 0) {
443
    if (lastComparison != 0) {
431
      return lastComparison;
444
      return lastComparison;
432
    }
445
    }
433
    return 0;
446
    return 0;
434
  }
447
  }
Line 467... Line 480...
467
              setWarehouseIdIsSet(true);
480
              setWarehouseIdIsSet(true);
468
            } else { 
481
            } else { 
469
              TProtocolUtil.skip(iprot, field.type);
482
              TProtocolUtil.skip(iprot, field.type);
470
            }
483
            }
471
            break;
484
            break;
472
          case ADMIN:
485
          case ROLE:
473
            if (field.type == TType.BOOL) {
486
            if (field.type == TType.I32) {
474
              this.admin = iprot.readBool();
487
              this.role = Role.findByValue(iprot.readI32());
475
              setAdminIsSet(true);
-
 
476
            } else { 
488
            } else { 
477
              TProtocolUtil.skip(iprot, field.type);
489
              TProtocolUtil.skip(iprot, field.type);
478
            }
490
            }
479
            break;
491
            break;
480
        }
492
        }
Line 500... Line 512...
500
      oprot.writeFieldEnd();
512
      oprot.writeFieldEnd();
501
    }
513
    }
502
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
514
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
503
    oprot.writeI64(this.warehouseId);
515
    oprot.writeI64(this.warehouseId);
504
    oprot.writeFieldEnd();
516
    oprot.writeFieldEnd();
-
 
517
    if (this.role != null) {
505
    oprot.writeFieldBegin(ADMIN_FIELD_DESC);
518
      oprot.writeFieldBegin(ROLE_FIELD_DESC);
506
    oprot.writeBool(this.admin);
519
      oprot.writeI32(this.role.getValue());
507
    oprot.writeFieldEnd();
520
      oprot.writeFieldEnd();
-
 
521
    }
508
    oprot.writeFieldStop();
522
    oprot.writeFieldStop();
509
    oprot.writeStructEnd();
523
    oprot.writeStructEnd();
510
  }
524
  }
511
 
525
 
512
  @Override
526
  @Override
Line 532... Line 546...
532
    if (!first) sb.append(", ");
546
    if (!first) sb.append(", ");
533
    sb.append("warehouseId:");
547
    sb.append("warehouseId:");
534
    sb.append(this.warehouseId);
548
    sb.append(this.warehouseId);
535
    first = false;
549
    first = false;
536
    if (!first) sb.append(", ");
550
    if (!first) sb.append(", ");
537
    sb.append("admin:");
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
      }
538
    sb.append(this.admin);
560
      sb.append(this.role);
-
 
561
      if (role_name != null) {
-
 
562
        sb.append(")");
-
 
563
      }
-
 
564
    }
539
    first = false;
565
    first = false;
540
    sb.append(")");
566
    sb.append(")");
541
    return sb.toString();
567
    return sb.toString();
542
  }
568
  }
543
 
569