Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
352 ashish 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
 
471 rajveer 26
/**
27
 * Helper service
28
 * created by @ashish
29
 * *
30
 */
352 ashish 31
public class Mail implements TBase<Mail._Fields>, java.io.Serializable, Cloneable, Comparable<Mail> {
32
  private static final TStruct STRUCT_DESC = new TStruct("Mail");
33
 
34
  private static final TField TO_FIELD_DESC = new TField("to", TType.LIST, (short)1);
35
  private static final TField SUBJECT_FIELD_DESC = new TField("subject", TType.STRING, (short)2);
36
  private static final TField DATA_FIELD_DESC = new TField("data", TType.STRING, (short)3);
37
  private static final TField SENDER_FIELD_DESC = new TField("sender", TType.STRING, (short)4);
38
  private static final TField ATTACHMENTS_FIELD_DESC = new TField("attachments", TType.LIST, (short)5);
39
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)6);
40
 
41
  private List<String> to;
42
  private String subject;
43
  private String data;
44
  private String sender;
45
  private List<String> attachments;
46
  private String password;
47
 
48
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
49
  public enum _Fields implements TFieldIdEnum {
50
    TO((short)1, "to"),
51
    SUBJECT((short)2, "subject"),
52
    DATA((short)3, "data"),
53
    SENDER((short)4, "sender"),
54
    ATTACHMENTS((short)5, "attachments"),
55
    PASSWORD((short)6, "password");
56
 
57
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
58
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
59
 
60
    static {
61
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
62
        byId.put((int)field._thriftId, field);
63
        byName.put(field.getFieldName(), field);
64
      }
65
    }
66
 
67
    /**
68
     * Find the _Fields constant that matches fieldId, or null if its not found.
69
     */
70
    public static _Fields findByThriftId(int fieldId) {
71
      return byId.get(fieldId);
72
    }
73
 
74
    /**
75
     * Find the _Fields constant that matches fieldId, throwing an exception
76
     * if it is not found.
77
     */
78
    public static _Fields findByThriftIdOrThrow(int fieldId) {
79
      _Fields fields = findByThriftId(fieldId);
80
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
81
      return fields;
82
    }
83
 
84
    /**
85
     * Find the _Fields constant that matches name, or null if its not found.
86
     */
87
    public static _Fields findByName(String name) {
88
      return byName.get(name);
89
    }
90
 
91
    private final short _thriftId;
92
    private final String _fieldName;
93
 
94
    _Fields(short thriftId, String fieldName) {
95
      _thriftId = thriftId;
96
      _fieldName = fieldName;
97
    }
98
 
99
    public short getThriftFieldId() {
100
      return _thriftId;
101
    }
102
 
103
    public String getFieldName() {
104
      return _fieldName;
105
    }
106
  }
107
 
108
  // isset id assignments
109
 
110
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
111
    put(_Fields.TO, new FieldMetaData("to", TFieldRequirementType.DEFAULT, 
112
        new ListMetaData(TType.LIST, 
113
            new FieldValueMetaData(TType.STRING))));
114
    put(_Fields.SUBJECT, new FieldMetaData("subject", TFieldRequirementType.DEFAULT, 
115
        new FieldValueMetaData(TType.STRING)));
116
    put(_Fields.DATA, new FieldMetaData("data", TFieldRequirementType.DEFAULT, 
117
        new FieldValueMetaData(TType.STRING)));
118
    put(_Fields.SENDER, new FieldMetaData("sender", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.STRING)));
120
    put(_Fields.ATTACHMENTS, new FieldMetaData("attachments", TFieldRequirementType.DEFAULT, 
121
        new ListMetaData(TType.LIST, 
122
            new FieldValueMetaData(TType.STRING))));
123
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
124
        new FieldValueMetaData(TType.STRING)));
125
  }});
126
 
127
  static {
128
    FieldMetaData.addStructMetaDataMap(Mail.class, metaDataMap);
129
  }
130
 
131
  public Mail() {
132
  }
133
 
134
  public Mail(
135
    List<String> to,
136
    String subject,
137
    String data,
138
    String sender,
139
    List<String> attachments,
140
    String password)
141
  {
142
    this();
143
    this.to = to;
144
    this.subject = subject;
145
    this.data = data;
146
    this.sender = sender;
147
    this.attachments = attachments;
148
    this.password = password;
149
  }
150
 
151
  /**
152
   * Performs a deep copy on <i>other</i>.
153
   */
154
  public Mail(Mail other) {
155
    if (other.isSetTo()) {
156
      List<String> __this__to = new ArrayList<String>();
157
      for (String other_element : other.to) {
158
        __this__to.add(other_element);
159
      }
160
      this.to = __this__to;
161
    }
162
    if (other.isSetSubject()) {
163
      this.subject = other.subject;
164
    }
165
    if (other.isSetData()) {
166
      this.data = other.data;
167
    }
168
    if (other.isSetSender()) {
169
      this.sender = other.sender;
170
    }
171
    if (other.isSetAttachments()) {
172
      List<String> __this__attachments = new ArrayList<String>();
173
      for (String other_element : other.attachments) {
174
        __this__attachments.add(other_element);
175
      }
176
      this.attachments = __this__attachments;
177
    }
178
    if (other.isSetPassword()) {
179
      this.password = other.password;
180
    }
181
  }
182
 
183
  public Mail deepCopy() {
184
    return new Mail(this);
185
  }
186
 
187
  @Deprecated
188
  public Mail clone() {
189
    return new Mail(this);
190
  }
191
 
192
  public int getToSize() {
193
    return (this.to == null) ? 0 : this.to.size();
194
  }
195
 
196
  public java.util.Iterator<String> getToIterator() {
197
    return (this.to == null) ? null : this.to.iterator();
198
  }
199
 
200
  public void addToTo(String elem) {
201
    if (this.to == null) {
202
      this.to = new ArrayList<String>();
203
    }
204
    this.to.add(elem);
205
  }
206
 
207
  public List<String> getTo() {
208
    return this.to;
209
  }
210
 
211
  public Mail setTo(List<String> to) {
212
    this.to = to;
213
    return this;
214
  }
215
 
216
  public void unsetTo() {
217
    this.to = null;
218
  }
219
 
220
  /** Returns true if field to is set (has been asigned a value) and false otherwise */
221
  public boolean isSetTo() {
222
    return this.to != null;
223
  }
224
 
225
  public void setToIsSet(boolean value) {
226
    if (!value) {
227
      this.to = null;
228
    }
229
  }
230
 
231
  public String getSubject() {
232
    return this.subject;
233
  }
234
 
235
  public Mail setSubject(String subject) {
236
    this.subject = subject;
237
    return this;
238
  }
239
 
240
  public void unsetSubject() {
241
    this.subject = null;
242
  }
243
 
244
  /** Returns true if field subject is set (has been asigned a value) and false otherwise */
245
  public boolean isSetSubject() {
246
    return this.subject != null;
247
  }
248
 
249
  public void setSubjectIsSet(boolean value) {
250
    if (!value) {
251
      this.subject = null;
252
    }
253
  }
254
 
255
  public String getData() {
256
    return this.data;
257
  }
258
 
259
  public Mail setData(String data) {
260
    this.data = data;
261
    return this;
262
  }
263
 
264
  public void unsetData() {
265
    this.data = null;
266
  }
267
 
268
  /** Returns true if field data is set (has been asigned a value) and false otherwise */
269
  public boolean isSetData() {
270
    return this.data != null;
271
  }
272
 
273
  public void setDataIsSet(boolean value) {
274
    if (!value) {
275
      this.data = null;
276
    }
277
  }
278
 
279
  public String getSender() {
280
    return this.sender;
281
  }
282
 
283
  public Mail setSender(String sender) {
284
    this.sender = sender;
285
    return this;
286
  }
287
 
288
  public void unsetSender() {
289
    this.sender = null;
290
  }
291
 
292
  /** Returns true if field sender is set (has been asigned a value) and false otherwise */
293
  public boolean isSetSender() {
294
    return this.sender != null;
295
  }
296
 
297
  public void setSenderIsSet(boolean value) {
298
    if (!value) {
299
      this.sender = null;
300
    }
301
  }
302
 
303
  public int getAttachmentsSize() {
304
    return (this.attachments == null) ? 0 : this.attachments.size();
305
  }
306
 
307
  public java.util.Iterator<String> getAttachmentsIterator() {
308
    return (this.attachments == null) ? null : this.attachments.iterator();
309
  }
310
 
311
  public void addToAttachments(String elem) {
312
    if (this.attachments == null) {
313
      this.attachments = new ArrayList<String>();
314
    }
315
    this.attachments.add(elem);
316
  }
317
 
318
  public List<String> getAttachments() {
319
    return this.attachments;
320
  }
321
 
322
  public Mail setAttachments(List<String> attachments) {
323
    this.attachments = attachments;
324
    return this;
325
  }
326
 
327
  public void unsetAttachments() {
328
    this.attachments = null;
329
  }
330
 
331
  /** Returns true if field attachments is set (has been asigned a value) and false otherwise */
332
  public boolean isSetAttachments() {
333
    return this.attachments != null;
334
  }
335
 
336
  public void setAttachmentsIsSet(boolean value) {
337
    if (!value) {
338
      this.attachments = null;
339
    }
340
  }
341
 
342
  public String getPassword() {
343
    return this.password;
344
  }
345
 
346
  public Mail setPassword(String password) {
347
    this.password = password;
348
    return this;
349
  }
350
 
351
  public void unsetPassword() {
352
    this.password = null;
353
  }
354
 
355
  /** Returns true if field password is set (has been asigned a value) and false otherwise */
356
  public boolean isSetPassword() {
357
    return this.password != null;
358
  }
359
 
360
  public void setPasswordIsSet(boolean value) {
361
    if (!value) {
362
      this.password = null;
363
    }
364
  }
365
 
366
  public void setFieldValue(_Fields field, Object value) {
367
    switch (field) {
368
    case TO:
369
      if (value == null) {
370
        unsetTo();
371
      } else {
372
        setTo((List<String>)value);
373
      }
374
      break;
375
 
376
    case SUBJECT:
377
      if (value == null) {
378
        unsetSubject();
379
      } else {
380
        setSubject((String)value);
381
      }
382
      break;
383
 
384
    case DATA:
385
      if (value == null) {
386
        unsetData();
387
      } else {
388
        setData((String)value);
389
      }
390
      break;
391
 
392
    case SENDER:
393
      if (value == null) {
394
        unsetSender();
395
      } else {
396
        setSender((String)value);
397
      }
398
      break;
399
 
400
    case ATTACHMENTS:
401
      if (value == null) {
402
        unsetAttachments();
403
      } else {
404
        setAttachments((List<String>)value);
405
      }
406
      break;
407
 
408
    case PASSWORD:
409
      if (value == null) {
410
        unsetPassword();
411
      } else {
412
        setPassword((String)value);
413
      }
414
      break;
415
 
416
    }
417
  }
418
 
419
  public void setFieldValue(int fieldID, Object value) {
420
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
421
  }
422
 
423
  public Object getFieldValue(_Fields field) {
424
    switch (field) {
425
    case TO:
426
      return getTo();
427
 
428
    case SUBJECT:
429
      return getSubject();
430
 
431
    case DATA:
432
      return getData();
433
 
434
    case SENDER:
435
      return getSender();
436
 
437
    case ATTACHMENTS:
438
      return getAttachments();
439
 
440
    case PASSWORD:
441
      return getPassword();
442
 
443
    }
444
    throw new IllegalStateException();
445
  }
446
 
447
  public Object getFieldValue(int fieldId) {
448
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
449
  }
450
 
451
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
452
  public boolean isSet(_Fields field) {
453
    switch (field) {
454
    case TO:
455
      return isSetTo();
456
    case SUBJECT:
457
      return isSetSubject();
458
    case DATA:
459
      return isSetData();
460
    case SENDER:
461
      return isSetSender();
462
    case ATTACHMENTS:
463
      return isSetAttachments();
464
    case PASSWORD:
465
      return isSetPassword();
466
    }
467
    throw new IllegalStateException();
468
  }
469
 
470
  public boolean isSet(int fieldID) {
471
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
472
  }
473
 
474
  @Override
475
  public boolean equals(Object that) {
476
    if (that == null)
477
      return false;
478
    if (that instanceof Mail)
479
      return this.equals((Mail)that);
480
    return false;
481
  }
482
 
483
  public boolean equals(Mail that) {
484
    if (that == null)
485
      return false;
486
 
487
    boolean this_present_to = true && this.isSetTo();
488
    boolean that_present_to = true && that.isSetTo();
489
    if (this_present_to || that_present_to) {
490
      if (!(this_present_to && that_present_to))
491
        return false;
492
      if (!this.to.equals(that.to))
493
        return false;
494
    }
495
 
496
    boolean this_present_subject = true && this.isSetSubject();
497
    boolean that_present_subject = true && that.isSetSubject();
498
    if (this_present_subject || that_present_subject) {
499
      if (!(this_present_subject && that_present_subject))
500
        return false;
501
      if (!this.subject.equals(that.subject))
502
        return false;
503
    }
504
 
505
    boolean this_present_data = true && this.isSetData();
506
    boolean that_present_data = true && that.isSetData();
507
    if (this_present_data || that_present_data) {
508
      if (!(this_present_data && that_present_data))
509
        return false;
510
      if (!this.data.equals(that.data))
511
        return false;
512
    }
513
 
514
    boolean this_present_sender = true && this.isSetSender();
515
    boolean that_present_sender = true && that.isSetSender();
516
    if (this_present_sender || that_present_sender) {
517
      if (!(this_present_sender && that_present_sender))
518
        return false;
519
      if (!this.sender.equals(that.sender))
520
        return false;
521
    }
522
 
523
    boolean this_present_attachments = true && this.isSetAttachments();
524
    boolean that_present_attachments = true && that.isSetAttachments();
525
    if (this_present_attachments || that_present_attachments) {
526
      if (!(this_present_attachments && that_present_attachments))
527
        return false;
528
      if (!this.attachments.equals(that.attachments))
529
        return false;
530
    }
531
 
532
    boolean this_present_password = true && this.isSetPassword();
533
    boolean that_present_password = true && that.isSetPassword();
534
    if (this_present_password || that_present_password) {
535
      if (!(this_present_password && that_present_password))
536
        return false;
537
      if (!this.password.equals(that.password))
538
        return false;
539
    }
540
 
541
    return true;
542
  }
543
 
544
  @Override
545
  public int hashCode() {
546
    return 0;
547
  }
548
 
549
  public int compareTo(Mail other) {
550
    if (!getClass().equals(other.getClass())) {
551
      return getClass().getName().compareTo(other.getClass().getName());
552
    }
553
 
554
    int lastComparison = 0;
555
    Mail typedOther = (Mail)other;
556
 
557
    lastComparison = Boolean.valueOf(isSetTo()).compareTo(isSetTo());
558
    if (lastComparison != 0) {
559
      return lastComparison;
560
    }
561
    lastComparison = TBaseHelper.compareTo(to, typedOther.to);
562
    if (lastComparison != 0) {
563
      return lastComparison;
564
    }
565
    lastComparison = Boolean.valueOf(isSetSubject()).compareTo(isSetSubject());
566
    if (lastComparison != 0) {
567
      return lastComparison;
568
    }
569
    lastComparison = TBaseHelper.compareTo(subject, typedOther.subject);
570
    if (lastComparison != 0) {
571
      return lastComparison;
572
    }
573
    lastComparison = Boolean.valueOf(isSetData()).compareTo(isSetData());
574
    if (lastComparison != 0) {
575
      return lastComparison;
576
    }
577
    lastComparison = TBaseHelper.compareTo(data, typedOther.data);
578
    if (lastComparison != 0) {
579
      return lastComparison;
580
    }
581
    lastComparison = Boolean.valueOf(isSetSender()).compareTo(isSetSender());
582
    if (lastComparison != 0) {
583
      return lastComparison;
584
    }
585
    lastComparison = TBaseHelper.compareTo(sender, typedOther.sender);
586
    if (lastComparison != 0) {
587
      return lastComparison;
588
    }
589
    lastComparison = Boolean.valueOf(isSetAttachments()).compareTo(isSetAttachments());
590
    if (lastComparison != 0) {
591
      return lastComparison;
592
    }
593
    lastComparison = TBaseHelper.compareTo(attachments, typedOther.attachments);
594
    if (lastComparison != 0) {
595
      return lastComparison;
596
    }
597
    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(isSetPassword());
598
    if (lastComparison != 0) {
599
      return lastComparison;
600
    }
601
    lastComparison = TBaseHelper.compareTo(password, typedOther.password);
602
    if (lastComparison != 0) {
603
      return lastComparison;
604
    }
605
    return 0;
606
  }
607
 
608
  public void read(TProtocol iprot) throws TException {
609
    TField field;
610
    iprot.readStructBegin();
611
    while (true)
612
    {
613
      field = iprot.readFieldBegin();
614
      if (field.type == TType.STOP) { 
615
        break;
616
      }
617
      _Fields fieldId = _Fields.findByThriftId(field.id);
618
      if (fieldId == null) {
619
        TProtocolUtil.skip(iprot, field.type);
620
      } else {
621
        switch (fieldId) {
622
          case TO:
623
            if (field.type == TType.LIST) {
624
              {
625
                TList _list0 = iprot.readListBegin();
626
                this.to = new ArrayList<String>(_list0.size);
627
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
628
                {
629
                  String _elem2;
630
                  _elem2 = iprot.readString();
631
                  this.to.add(_elem2);
632
                }
633
                iprot.readListEnd();
634
              }
635
            } else { 
636
              TProtocolUtil.skip(iprot, field.type);
637
            }
638
            break;
639
          case SUBJECT:
640
            if (field.type == TType.STRING) {
641
              this.subject = iprot.readString();
642
            } else { 
643
              TProtocolUtil.skip(iprot, field.type);
644
            }
645
            break;
646
          case DATA:
647
            if (field.type == TType.STRING) {
648
              this.data = iprot.readString();
649
            } else { 
650
              TProtocolUtil.skip(iprot, field.type);
651
            }
652
            break;
653
          case SENDER:
654
            if (field.type == TType.STRING) {
655
              this.sender = iprot.readString();
656
            } else { 
657
              TProtocolUtil.skip(iprot, field.type);
658
            }
659
            break;
660
          case ATTACHMENTS:
661
            if (field.type == TType.LIST) {
662
              {
663
                TList _list3 = iprot.readListBegin();
664
                this.attachments = new ArrayList<String>(_list3.size);
665
                for (int _i4 = 0; _i4 < _list3.size; ++_i4)
666
                {
667
                  String _elem5;
668
                  _elem5 = iprot.readString();
669
                  this.attachments.add(_elem5);
670
                }
671
                iprot.readListEnd();
672
              }
673
            } else { 
674
              TProtocolUtil.skip(iprot, field.type);
675
            }
676
            break;
677
          case PASSWORD:
678
            if (field.type == TType.STRING) {
679
              this.password = iprot.readString();
680
            } else { 
681
              TProtocolUtil.skip(iprot, field.type);
682
            }
683
            break;
684
        }
685
        iprot.readFieldEnd();
686
      }
687
    }
688
    iprot.readStructEnd();
689
    validate();
690
  }
691
 
692
  public void write(TProtocol oprot) throws TException {
693
    validate();
694
 
695
    oprot.writeStructBegin(STRUCT_DESC);
696
    if (this.to != null) {
697
      oprot.writeFieldBegin(TO_FIELD_DESC);
698
      {
699
        oprot.writeListBegin(new TList(TType.STRING, this.to.size()));
700
        for (String _iter6 : this.to)
701
        {
702
          oprot.writeString(_iter6);
703
        }
704
        oprot.writeListEnd();
705
      }
706
      oprot.writeFieldEnd();
707
    }
708
    if (this.subject != null) {
709
      oprot.writeFieldBegin(SUBJECT_FIELD_DESC);
710
      oprot.writeString(this.subject);
711
      oprot.writeFieldEnd();
712
    }
713
    if (this.data != null) {
714
      oprot.writeFieldBegin(DATA_FIELD_DESC);
715
      oprot.writeString(this.data);
716
      oprot.writeFieldEnd();
717
    }
718
    if (this.sender != null) {
719
      oprot.writeFieldBegin(SENDER_FIELD_DESC);
720
      oprot.writeString(this.sender);
721
      oprot.writeFieldEnd();
722
    }
723
    if (this.attachments != null) {
724
      oprot.writeFieldBegin(ATTACHMENTS_FIELD_DESC);
725
      {
726
        oprot.writeListBegin(new TList(TType.STRING, this.attachments.size()));
727
        for (String _iter7 : this.attachments)
728
        {
729
          oprot.writeString(_iter7);
730
        }
731
        oprot.writeListEnd();
732
      }
733
      oprot.writeFieldEnd();
734
    }
735
    if (this.password != null) {
736
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
737
      oprot.writeString(this.password);
738
      oprot.writeFieldEnd();
739
    }
740
    oprot.writeFieldStop();
741
    oprot.writeStructEnd();
742
  }
743
 
744
  @Override
745
  public String toString() {
746
    StringBuilder sb = new StringBuilder("Mail(");
747
    boolean first = true;
748
 
749
    sb.append("to:");
750
    if (this.to == null) {
751
      sb.append("null");
752
    } else {
753
      sb.append(this.to);
754
    }
755
    first = false;
756
    if (!first) sb.append(", ");
757
    sb.append("subject:");
758
    if (this.subject == null) {
759
      sb.append("null");
760
    } else {
761
      sb.append(this.subject);
762
    }
763
    first = false;
764
    if (!first) sb.append(", ");
765
    sb.append("data:");
766
    if (this.data == null) {
767
      sb.append("null");
768
    } else {
769
      sb.append(this.data);
770
    }
771
    first = false;
772
    if (!first) sb.append(", ");
773
    sb.append("sender:");
774
    if (this.sender == null) {
775
      sb.append("null");
776
    } else {
777
      sb.append(this.sender);
778
    }
779
    first = false;
780
    if (!first) sb.append(", ");
781
    sb.append("attachments:");
782
    if (this.attachments == null) {
783
      sb.append("null");
784
    } else {
785
      sb.append(this.attachments);
786
    }
787
    first = false;
788
    if (!first) sb.append(", ");
789
    sb.append("password:");
790
    if (this.password == null) {
791
      sb.append("null");
792
    } else {
793
      sb.append(this.password);
794
    }
795
    first = false;
796
    sb.append(")");
797
    return sb.toString();
798
  }
799
 
800
  public void validate() throws TException {
801
    // check for required fields
802
  }
803
 
804
}
805