Subversion Repositories SmartDukaan

Rev

Rev 3168 | Go to most recent revision | Details | 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)));
112
    put(_Fields.MANAGER_ID, new FieldMetaData("managerId", TFieldRequirementType.DEFAULT, 
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
    long managerId,
130
    String password)
131
  {
132
    this();
133
    this.id = id;
134
    setIdIsSet(true);
135
    this.name = name;
136
    this.emailId = emailId;
137
    this.managerId = managerId;
138
    setManagerIdIsSet(true);
139
    this.password = password;
140
  }
141
 
142
  /**
143
   * Performs a deep copy on <i>other</i>.
144
   */
145
  public Agent(Agent other) {
146
    __isset_bit_vector.clear();
147
    __isset_bit_vector.or(other.__isset_bit_vector);
148
    this.id = other.id;
149
    if (other.isSetName()) {
150
      this.name = other.name;
151
    }
152
    if (other.isSetEmailId()) {
153
      this.emailId = other.emailId;
154
    }
155
    this.managerId = other.managerId;
156
    if (other.isSetPassword()) {
157
      this.password = other.password;
158
    }
159
  }
160
 
161
  public Agent deepCopy() {
162
    return new Agent(this);
163
  }
164
 
165
  @Deprecated
166
  public Agent clone() {
167
    return new Agent(this);
168
  }
169
 
170
  public long getId() {
171
    return this.id;
172
  }
173
 
174
  public Agent setId(long id) {
175
    this.id = id;
176
    setIdIsSet(true);
177
    return this;
178
  }
179
 
180
  public void unsetId() {
181
    __isset_bit_vector.clear(__ID_ISSET_ID);
182
  }
183
 
184
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
185
  public boolean isSetId() {
186
    return __isset_bit_vector.get(__ID_ISSET_ID);
187
  }
188
 
189
  public void setIdIsSet(boolean value) {
190
    __isset_bit_vector.set(__ID_ISSET_ID, value);
191
  }
192
 
193
  public String getName() {
194
    return this.name;
195
  }
196
 
197
  public Agent setName(String name) {
198
    this.name = name;
199
    return this;
200
  }
201
 
202
  public void unsetName() {
203
    this.name = null;
204
  }
205
 
206
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
207
  public boolean isSetName() {
208
    return this.name != null;
209
  }
210
 
211
  public void setNameIsSet(boolean value) {
212
    if (!value) {
213
      this.name = null;
214
    }
215
  }
216
 
217
  public String getEmailId() {
218
    return this.emailId;
219
  }
220
 
221
  public Agent setEmailId(String emailId) {
222
    this.emailId = emailId;
223
    return this;
224
  }
225
 
226
  public void unsetEmailId() {
227
    this.emailId = null;
228
  }
229
 
230
  /** Returns true if field emailId is set (has been asigned a value) and false otherwise */
231
  public boolean isSetEmailId() {
232
    return this.emailId != null;
233
  }
234
 
235
  public void setEmailIdIsSet(boolean value) {
236
    if (!value) {
237
      this.emailId = null;
238
    }
239
  }
240
 
241
  public long getManagerId() {
242
    return this.managerId;
243
  }
244
 
245
  public Agent setManagerId(long managerId) {
246
    this.managerId = managerId;
247
    setManagerIdIsSet(true);
248
    return this;
249
  }
250
 
251
  public void unsetManagerId() {
252
    __isset_bit_vector.clear(__MANAGERID_ISSET_ID);
253
  }
254
 
255
  /** Returns true if field managerId is set (has been asigned a value) and false otherwise */
256
  public boolean isSetManagerId() {
257
    return __isset_bit_vector.get(__MANAGERID_ISSET_ID);
258
  }
259
 
260
  public void setManagerIdIsSet(boolean value) {
261
    __isset_bit_vector.set(__MANAGERID_ISSET_ID, value);
262
  }
263
 
264
  public String getPassword() {
265
    return this.password;
266
  }
267
 
268
  public Agent setPassword(String password) {
269
    this.password = password;
270
    return this;
271
  }
272
 
273
  public void unsetPassword() {
274
    this.password = null;
275
  }
276
 
277
  /** Returns true if field password is set (has been asigned a value) and false otherwise */
278
  public boolean isSetPassword() {
279
    return this.password != null;
280
  }
281
 
282
  public void setPasswordIsSet(boolean value) {
283
    if (!value) {
284
      this.password = null;
285
    }
286
  }
287
 
288
  public void setFieldValue(_Fields field, Object value) {
289
    switch (field) {
290
    case ID:
291
      if (value == null) {
292
        unsetId();
293
      } else {
294
        setId((Long)value);
295
      }
296
      break;
297
 
298
    case NAME:
299
      if (value == null) {
300
        unsetName();
301
      } else {
302
        setName((String)value);
303
      }
304
      break;
305
 
306
    case EMAIL_ID:
307
      if (value == null) {
308
        unsetEmailId();
309
      } else {
310
        setEmailId((String)value);
311
      }
312
      break;
313
 
314
    case MANAGER_ID:
315
      if (value == null) {
316
        unsetManagerId();
317
      } else {
318
        setManagerId((Long)value);
319
      }
320
      break;
321
 
322
    case PASSWORD:
323
      if (value == null) {
324
        unsetPassword();
325
      } else {
326
        setPassword((String)value);
327
      }
328
      break;
329
 
330
    }
331
  }
332
 
333
  public void setFieldValue(int fieldID, Object value) {
334
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
335
  }
336
 
337
  public Object getFieldValue(_Fields field) {
338
    switch (field) {
339
    case ID:
340
      return new Long(getId());
341
 
342
    case NAME:
343
      return getName();
344
 
345
    case EMAIL_ID:
346
      return getEmailId();
347
 
348
    case MANAGER_ID:
349
      return new Long(getManagerId());
350
 
351
    case PASSWORD:
352
      return getPassword();
353
 
354
    }
355
    throw new IllegalStateException();
356
  }
357
 
358
  public Object getFieldValue(int fieldId) {
359
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
360
  }
361
 
362
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
363
  public boolean isSet(_Fields field) {
364
    switch (field) {
365
    case ID:
366
      return isSetId();
367
    case NAME:
368
      return isSetName();
369
    case EMAIL_ID:
370
      return isSetEmailId();
371
    case MANAGER_ID:
372
      return isSetManagerId();
373
    case PASSWORD:
374
      return isSetPassword();
375
    }
376
    throw new IllegalStateException();
377
  }
378
 
379
  public boolean isSet(int fieldID) {
380
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
381
  }
382
 
383
  @Override
384
  public boolean equals(Object that) {
385
    if (that == null)
386
      return false;
387
    if (that instanceof Agent)
388
      return this.equals((Agent)that);
389
    return false;
390
  }
391
 
392
  public boolean equals(Agent that) {
393
    if (that == null)
394
      return false;
395
 
396
    boolean this_present_id = true;
397
    boolean that_present_id = true;
398
    if (this_present_id || that_present_id) {
399
      if (!(this_present_id && that_present_id))
400
        return false;
401
      if (this.id != that.id)
402
        return false;
403
    }
404
 
405
    boolean this_present_name = true && this.isSetName();
406
    boolean that_present_name = true && that.isSetName();
407
    if (this_present_name || that_present_name) {
408
      if (!(this_present_name && that_present_name))
409
        return false;
410
      if (!this.name.equals(that.name))
411
        return false;
412
    }
413
 
414
    boolean this_present_emailId = true && this.isSetEmailId();
415
    boolean that_present_emailId = true && that.isSetEmailId();
416
    if (this_present_emailId || that_present_emailId) {
417
      if (!(this_present_emailId && that_present_emailId))
418
        return false;
419
      if (!this.emailId.equals(that.emailId))
420
        return false;
421
    }
422
 
423
    boolean this_present_managerId = true;
424
    boolean that_present_managerId = true;
425
    if (this_present_managerId || that_present_managerId) {
426
      if (!(this_present_managerId && that_present_managerId))
427
        return false;
428
      if (this.managerId != that.managerId)
429
        return false;
430
    }
431
 
432
    boolean this_present_password = true && this.isSetPassword();
433
    boolean that_present_password = true && that.isSetPassword();
434
    if (this_present_password || that_present_password) {
435
      if (!(this_present_password && that_present_password))
436
        return false;
437
      if (!this.password.equals(that.password))
438
        return false;
439
    }
440
 
441
    return true;
442
  }
443
 
444
  @Override
445
  public int hashCode() {
446
    return 0;
447
  }
448
 
449
  public int compareTo(Agent other) {
450
    if (!getClass().equals(other.getClass())) {
451
      return getClass().getName().compareTo(other.getClass().getName());
452
    }
453
 
454
    int lastComparison = 0;
455
    Agent typedOther = (Agent)other;
456
 
457
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
458
    if (lastComparison != 0) {
459
      return lastComparison;
460
    }
461
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
462
    if (lastComparison != 0) {
463
      return lastComparison;
464
    }
465
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
466
    if (lastComparison != 0) {
467
      return lastComparison;
468
    }
469
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
470
    if (lastComparison != 0) {
471
      return lastComparison;
472
    }
473
    lastComparison = Boolean.valueOf(isSetEmailId()).compareTo(isSetEmailId());
474
    if (lastComparison != 0) {
475
      return lastComparison;
476
    }
477
    lastComparison = TBaseHelper.compareTo(emailId, typedOther.emailId);
478
    if (lastComparison != 0) {
479
      return lastComparison;
480
    }
481
    lastComparison = Boolean.valueOf(isSetManagerId()).compareTo(isSetManagerId());
482
    if (lastComparison != 0) {
483
      return lastComparison;
484
    }
485
    lastComparison = TBaseHelper.compareTo(managerId, typedOther.managerId);
486
    if (lastComparison != 0) {
487
      return lastComparison;
488
    }
489
    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(isSetPassword());
490
    if (lastComparison != 0) {
491
      return lastComparison;
492
    }
493
    lastComparison = TBaseHelper.compareTo(password, typedOther.password);
494
    if (lastComparison != 0) {
495
      return lastComparison;
496
    }
497
    return 0;
498
  }
499
 
500
  public void read(TProtocol iprot) throws TException {
501
    TField field;
502
    iprot.readStructBegin();
503
    while (true)
504
    {
505
      field = iprot.readFieldBegin();
506
      if (field.type == TType.STOP) { 
507
        break;
508
      }
509
      _Fields fieldId = _Fields.findByThriftId(field.id);
510
      if (fieldId == null) {
511
        TProtocolUtil.skip(iprot, field.type);
512
      } else {
513
        switch (fieldId) {
514
          case ID:
515
            if (field.type == TType.I64) {
516
              this.id = iprot.readI64();
517
              setIdIsSet(true);
518
            } else { 
519
              TProtocolUtil.skip(iprot, field.type);
520
            }
521
            break;
522
          case NAME:
523
            if (field.type == TType.STRING) {
524
              this.name = iprot.readString();
525
            } else { 
526
              TProtocolUtil.skip(iprot, field.type);
527
            }
528
            break;
529
          case EMAIL_ID:
530
            if (field.type == TType.STRING) {
531
              this.emailId = iprot.readString();
532
            } else { 
533
              TProtocolUtil.skip(iprot, field.type);
534
            }
535
            break;
536
          case MANAGER_ID:
537
            if (field.type == TType.I64) {
538
              this.managerId = iprot.readI64();
539
              setManagerIdIsSet(true);
540
            } else { 
541
              TProtocolUtil.skip(iprot, field.type);
542
            }
543
            break;
544
          case PASSWORD:
545
            if (field.type == TType.STRING) {
546
              this.password = iprot.readString();
547
            } else { 
548
              TProtocolUtil.skip(iprot, field.type);
549
            }
550
            break;
551
        }
552
        iprot.readFieldEnd();
553
      }
554
    }
555
    iprot.readStructEnd();
556
    validate();
557
  }
558
 
559
  public void write(TProtocol oprot) throws TException {
560
    validate();
561
 
562
    oprot.writeStructBegin(STRUCT_DESC);
563
    oprot.writeFieldBegin(ID_FIELD_DESC);
564
    oprot.writeI64(this.id);
565
    oprot.writeFieldEnd();
566
    if (this.name != null) {
567
      oprot.writeFieldBegin(NAME_FIELD_DESC);
568
      oprot.writeString(this.name);
569
      oprot.writeFieldEnd();
570
    }
571
    if (this.emailId != null) {
572
      oprot.writeFieldBegin(EMAIL_ID_FIELD_DESC);
573
      oprot.writeString(this.emailId);
574
      oprot.writeFieldEnd();
575
    }
576
    oprot.writeFieldBegin(MANAGER_ID_FIELD_DESC);
577
    oprot.writeI64(this.managerId);
578
    oprot.writeFieldEnd();
579
    if (this.password != null) {
580
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
581
      oprot.writeString(this.password);
582
      oprot.writeFieldEnd();
583
    }
584
    oprot.writeFieldStop();
585
    oprot.writeStructEnd();
586
  }
587
 
588
  @Override
589
  public String toString() {
590
    StringBuilder sb = new StringBuilder("Agent(");
591
    boolean first = true;
592
 
593
    sb.append("id:");
594
    sb.append(this.id);
595
    first = false;
596
    if (!first) sb.append(", ");
597
    sb.append("name:");
598
    if (this.name == null) {
599
      sb.append("null");
600
    } else {
601
      sb.append(this.name);
602
    }
603
    first = false;
604
    if (!first) sb.append(", ");
605
    sb.append("emailId:");
606
    if (this.emailId == null) {
607
      sb.append("null");
608
    } else {
609
      sb.append(this.emailId);
610
    }
611
    first = false;
612
    if (!first) sb.append(", ");
613
    sb.append("managerId:");
614
    sb.append(this.managerId);
615
    first = false;
616
    if (!first) sb.append(", ");
617
    sb.append("password:");
618
    if (this.password == null) {
619
      sb.append("null");
620
    } else {
621
      sb.append(this.password);
622
    }
623
    first = false;
624
    sb.append(")");
625
    return sb.toString();
626
  }
627
 
628
  public void validate() throws TException {
629
    // check for required fields
630
  }
631
 
632
}
633