Subversion Repositories SmartDukaan

Rev

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

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