Subversion Repositories SmartDukaan

Rev

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

Rev 2515 Rev 3044
Line 21... Line 21...
21
 
21
 
22
import org.apache.thrift.*;
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
24
import org.apache.thrift.protocol.*;
25
 
25
 
26
public class Provider implements TBase<Provider._Fields>, java.io.Serializable, Cloneable, Comparable<Provider> {
26
public class Provider implements TBase<Provider._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("Provider");
27
  private static final TStruct STRUCT_DESC = new TStruct("Provider");
28
 
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
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);
30
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
31
  private static final TField ACCOUNT_NO_FIELD_DESC = new TField("accountNo", TType.STRING, (short)3);
-
 
32
  private static final TField EMAIL_FIELD_DESC = new TField("email", TType.STRING, (short)4);
31
  private static final TField DETAILS_FIELD_DESC = new TField("details", TType.MAP, (short)3);
33
 
32
 
34
  private long id;
33
  private long id;
35
  private String name;
34
  private String name;
36
  private String accountNo;
-
 
37
  private String email;
35
  private Map<DeliveryType,ProviderDetails> details;
38
 
36
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
38
  public enum _Fields implements TFieldIdEnum {
41
    ID((short)1, "id"),
39
    ID((short)1, "id"),
42
    NAME((short)2, "name"),
40
    NAME((short)2, "name"),
43
    ACCOUNT_NO((short)3, "accountNo"),
-
 
44
    EMAIL((short)4, "email");
41
    DETAILS((short)3, "details");
45
 
42
 
46
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
45
 
49
    static {
46
    static {
Line 101... Line 98...
101
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
98
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
102
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
99
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
103
        new FieldValueMetaData(TType.I64)));
100
        new FieldValueMetaData(TType.I64)));
104
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
101
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.STRING)));
102
        new FieldValueMetaData(TType.STRING)));
106
    put(_Fields.ACCOUNT_NO, new FieldMetaData("accountNo", TFieldRequirementType.DEFAULT, 
103
    put(_Fields.DETAILS, new FieldMetaData("details", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.STRING)));
104
        new MapMetaData(TType.MAP, 
108
    put(_Fields.EMAIL, new FieldMetaData("email", TFieldRequirementType.DEFAULT, 
105
            new EnumMetaData(TType.ENUM, DeliveryType.class), 
109
        new FieldValueMetaData(TType.STRING)));
106
            new StructMetaData(TType.STRUCT, ProviderDetails.class))));
110
  }});
107
  }});
111
 
108
 
112
  static {
109
  static {
113
    FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
110
    FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
114
  }
111
  }
Line 117... Line 114...
117
  }
114
  }
118
 
115
 
119
  public Provider(
116
  public Provider(
120
    long id,
117
    long id,
121
    String name,
118
    String name,
122
    String accountNo,
-
 
123
    String email)
119
    Map<DeliveryType,ProviderDetails> details)
124
  {
120
  {
125
    this();
121
    this();
126
    this.id = id;
122
    this.id = id;
127
    setIdIsSet(true);
123
    setIdIsSet(true);
128
    this.name = name;
124
    this.name = name;
129
    this.accountNo = accountNo;
-
 
130
    this.email = email;
125
    this.details = details;
131
  }
126
  }
132
 
127
 
133
  /**
128
  /**
134
   * Performs a deep copy on <i>other</i>.
129
   * Performs a deep copy on <i>other</i>.
135
   */
130
   */
Line 138... Line 133...
138
    __isset_bit_vector.or(other.__isset_bit_vector);
133
    __isset_bit_vector.or(other.__isset_bit_vector);
139
    this.id = other.id;
134
    this.id = other.id;
140
    if (other.isSetName()) {
135
    if (other.isSetName()) {
141
      this.name = other.name;
136
      this.name = other.name;
142
    }
137
    }
143
    if (other.isSetAccountNo()) {
138
    if (other.isSetDetails()) {
-
 
139
      Map<DeliveryType,ProviderDetails> __this__details = new HashMap<DeliveryType,ProviderDetails>();
-
 
140
      for (Map.Entry<DeliveryType, ProviderDetails> other_element : other.details.entrySet()) {
-
 
141
 
-
 
142
        DeliveryType other_element_key = other_element.getKey();
-
 
143
        ProviderDetails other_element_value = other_element.getValue();
-
 
144
 
144
      this.accountNo = other.accountNo;
145
        DeliveryType __this__details_copy_key = other_element_key;
-
 
146
 
-
 
147
        ProviderDetails __this__details_copy_value = new ProviderDetails(other_element_value);
-
 
148
 
-
 
149
        __this__details.put(__this__details_copy_key, __this__details_copy_value);
145
    }
150
      }
146
    if (other.isSetEmail()) {
-
 
147
      this.email = other.email;
151
      this.details = __this__details;
148
    }
152
    }
149
  }
153
  }
150
 
154
 
151
  public Provider deepCopy() {
155
  public Provider deepCopy() {
152
    return new Provider(this);
156
    return new Provider(this);
Line 202... Line 206...
202
    if (!value) {
206
    if (!value) {
203
      this.name = null;
207
      this.name = null;
204
    }
208
    }
205
  }
209
  }
206
 
210
 
207
  public String getAccountNo() {
211
  public int getDetailsSize() {
208
    return this.accountNo;
-
 
209
  }
-
 
210
 
-
 
211
  public Provider setAccountNo(String accountNo) {
-
 
212
    this.accountNo = accountNo;
-
 
213
    return this;
-
 
214
  }
-
 
215
 
-
 
216
  public void unsetAccountNo() {
-
 
217
    this.accountNo = null;
-
 
218
  }
-
 
219
 
-
 
220
  /** Returns true if field accountNo is set (has been asigned a value) and false otherwise */
-
 
221
  public boolean isSetAccountNo() {
-
 
222
    return this.accountNo != null;
212
    return (this.details == null) ? 0 : this.details.size();
223
  }
213
  }
224
 
214
 
225
  public void setAccountNoIsSet(boolean value) {
215
  public void putToDetails(DeliveryType key, ProviderDetails val) {
226
    if (!value) {
216
    if (this.details == null) {
227
      this.accountNo = null;
217
      this.details = new HashMap<DeliveryType,ProviderDetails>();
228
    }
218
    }
-
 
219
    this.details.put(key, val);
229
  }
220
  }
230
 
221
 
231
  public String getEmail() {
222
  public Map<DeliveryType,ProviderDetails> getDetails() {
232
    return this.email;
223
    return this.details;
233
  }
224
  }
234
 
225
 
235
  public Provider setEmail(String email) {
226
  public Provider setDetails(Map<DeliveryType,ProviderDetails> details) {
236
    this.email = email;
227
    this.details = details;
237
    return this;
228
    return this;
238
  }
229
  }
239
 
230
 
240
  public void unsetEmail() {
231
  public void unsetDetails() {
241
    this.email = null;
232
    this.details = null;
242
  }
233
  }
243
 
234
 
244
  /** Returns true if field email is set (has been asigned a value) and false otherwise */
235
  /** Returns true if field details is set (has been asigned a value) and false otherwise */
245
  public boolean isSetEmail() {
236
  public boolean isSetDetails() {
246
    return this.email != null;
237
    return this.details != null;
247
  }
238
  }
248
 
239
 
249
  public void setEmailIsSet(boolean value) {
240
  public void setDetailsIsSet(boolean value) {
250
    if (!value) {
241
    if (!value) {
251
      this.email = null;
242
      this.details = null;
252
    }
243
    }
253
  }
244
  }
254
 
245
 
255
  public void setFieldValue(_Fields field, Object value) {
246
  public void setFieldValue(_Fields field, Object value) {
256
    switch (field) {
247
    switch (field) {
Line 268... Line 259...
268
      } else {
259
      } else {
269
        setName((String)value);
260
        setName((String)value);
270
      }
261
      }
271
      break;
262
      break;
272
 
263
 
273
    case ACCOUNT_NO:
-
 
274
      if (value == null) {
-
 
275
        unsetAccountNo();
-
 
276
      } else {
-
 
277
        setAccountNo((String)value);
-
 
278
      }
-
 
279
      break;
-
 
280
 
-
 
281
    case EMAIL:
264
    case DETAILS:
282
      if (value == null) {
265
      if (value == null) {
283
        unsetEmail();
266
        unsetDetails();
284
      } else {
267
      } else {
285
        setEmail((String)value);
268
        setDetails((Map<DeliveryType,ProviderDetails>)value);
286
      }
269
      }
287
      break;
270
      break;
288
 
271
 
289
    }
272
    }
290
  }
273
  }
Line 299... Line 282...
299
      return new Long(getId());
282
      return new Long(getId());
300
 
283
 
301
    case NAME:
284
    case NAME:
302
      return getName();
285
      return getName();
303
 
286
 
304
    case ACCOUNT_NO:
-
 
305
      return getAccountNo();
-
 
306
 
-
 
307
    case EMAIL:
287
    case DETAILS:
308
      return getEmail();
288
      return getDetails();
309
 
289
 
310
    }
290
    }
311
    throw new IllegalStateException();
291
    throw new IllegalStateException();
312
  }
292
  }
313
 
293
 
Line 320... Line 300...
320
    switch (field) {
300
    switch (field) {
321
    case ID:
301
    case ID:
322
      return isSetId();
302
      return isSetId();
323
    case NAME:
303
    case NAME:
324
      return isSetName();
304
      return isSetName();
325
    case ACCOUNT_NO:
-
 
326
      return isSetAccountNo();
-
 
327
    case EMAIL:
305
    case DETAILS:
328
      return isSetEmail();
306
      return isSetDetails();
329
    }
307
    }
330
    throw new IllegalStateException();
308
    throw new IllegalStateException();
331
  }
309
  }
332
 
310
 
333
  public boolean isSet(int fieldID) {
311
  public boolean isSet(int fieldID) {
Line 363... Line 341...
363
        return false;
341
        return false;
364
      if (!this.name.equals(that.name))
342
      if (!this.name.equals(that.name))
365
        return false;
343
        return false;
366
    }
344
    }
367
 
345
 
368
    boolean this_present_accountNo = true && this.isSetAccountNo();
346
    boolean this_present_details = true && this.isSetDetails();
369
    boolean that_present_accountNo = true && that.isSetAccountNo();
347
    boolean that_present_details = true && that.isSetDetails();
370
    if (this_present_accountNo || that_present_accountNo) {
348
    if (this_present_details || that_present_details) {
371
      if (!(this_present_accountNo && that_present_accountNo))
349
      if (!(this_present_details && that_present_details))
372
        return false;
350
        return false;
373
      if (!this.accountNo.equals(that.accountNo))
-
 
374
        return false;
-
 
375
    }
-
 
376
 
-
 
377
    boolean this_present_email = true && this.isSetEmail();
-
 
378
    boolean that_present_email = true && that.isSetEmail();
-
 
379
    if (this_present_email || that_present_email) {
-
 
380
      if (!(this_present_email && that_present_email))
-
 
381
        return false;
-
 
382
      if (!this.email.equals(that.email))
351
      if (!this.details.equals(that.details))
383
        return false;
352
        return false;
384
    }
353
    }
385
 
354
 
386
    return true;
355
    return true;
387
  }
356
  }
Line 389... Line 358...
389
  @Override
358
  @Override
390
  public int hashCode() {
359
  public int hashCode() {
391
    return 0;
360
    return 0;
392
  }
361
  }
393
 
362
 
394
  public int compareTo(Provider other) {
-
 
395
    if (!getClass().equals(other.getClass())) {
-
 
396
      return getClass().getName().compareTo(other.getClass().getName());
-
 
397
    }
-
 
398
 
-
 
399
    int lastComparison = 0;
-
 
400
    Provider typedOther = (Provider)other;
-
 
401
 
-
 
402
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
-
 
403
    if (lastComparison != 0) {
-
 
404
      return lastComparison;
-
 
405
    }
-
 
406
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
-
 
407
    if (lastComparison != 0) {
-
 
408
      return lastComparison;
-
 
409
    }
-
 
410
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
-
 
411
    if (lastComparison != 0) {
-
 
412
      return lastComparison;
-
 
413
    }
-
 
414
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
-
 
415
    if (lastComparison != 0) {
-
 
416
      return lastComparison;
-
 
417
    }
-
 
418
    lastComparison = Boolean.valueOf(isSetAccountNo()).compareTo(isSetAccountNo());
-
 
419
    if (lastComparison != 0) {
-
 
420
      return lastComparison;
-
 
421
    }
-
 
422
    lastComparison = TBaseHelper.compareTo(accountNo, typedOther.accountNo);
-
 
423
    if (lastComparison != 0) {
-
 
424
      return lastComparison;
-
 
425
    }
-
 
426
    lastComparison = Boolean.valueOf(isSetEmail()).compareTo(isSetEmail());
-
 
427
    if (lastComparison != 0) {
-
 
428
      return lastComparison;
-
 
429
    }
-
 
430
    lastComparison = TBaseHelper.compareTo(email, typedOther.email);
-
 
431
    if (lastComparison != 0) {
-
 
432
      return lastComparison;
-
 
433
    }
-
 
434
    return 0;
-
 
435
  }
-
 
436
 
-
 
437
  public void read(TProtocol iprot) throws TException {
363
  public void read(TProtocol iprot) throws TException {
438
    TField field;
364
    TField field;
439
    iprot.readStructBegin();
365
    iprot.readStructBegin();
440
    while (true)
366
    while (true)
441
    {
367
    {
Line 461... Line 387...
461
              this.name = iprot.readString();
387
              this.name = iprot.readString();
462
            } else { 
388
            } else { 
463
              TProtocolUtil.skip(iprot, field.type);
389
              TProtocolUtil.skip(iprot, field.type);
464
            }
390
            }
465
            break;
391
            break;
466
          case ACCOUNT_NO:
392
          case DETAILS:
467
            if (field.type == TType.STRING) {
393
            if (field.type == TType.MAP) {
-
 
394
              {
468
              this.accountNo = iprot.readString();
395
                TMap _map0 = iprot.readMapBegin();
-
 
396
                this.details = new HashMap<DeliveryType,ProviderDetails>(2*_map0.size);
-
 
397
                for (int _i1 = 0; _i1 < _map0.size; ++_i1)
469
            } else { 
398
                {
470
              TProtocolUtil.skip(iprot, field.type);
399
                  DeliveryType _key2;
471
            }
400
                  ProviderDetails _val3;
-
 
401
                  _key2 = DeliveryType.findByValue(iprot.readI32());
472
            break;
402
                  _val3 = new ProviderDetails();
473
          case EMAIL:
403
                  _val3.read(iprot);
474
            if (field.type == TType.STRING) {
404
                  this.details.put(_key2, _val3);
-
 
405
                }
475
              this.email = iprot.readString();
406
                iprot.readMapEnd();
-
 
407
              }
476
            } else { 
408
            } else { 
477
              TProtocolUtil.skip(iprot, field.type);
409
              TProtocolUtil.skip(iprot, field.type);
478
            }
410
            }
479
            break;
411
            break;
480
        }
412
        }
Line 495... Line 427...
495
    if (this.name != null) {
427
    if (this.name != null) {
496
      oprot.writeFieldBegin(NAME_FIELD_DESC);
428
      oprot.writeFieldBegin(NAME_FIELD_DESC);
497
      oprot.writeString(this.name);
429
      oprot.writeString(this.name);
498
      oprot.writeFieldEnd();
430
      oprot.writeFieldEnd();
499
    }
431
    }
500
    if (this.accountNo != null) {
432
    if (this.details != null) {
501
      oprot.writeFieldBegin(ACCOUNT_NO_FIELD_DESC);
433
      oprot.writeFieldBegin(DETAILS_FIELD_DESC);
-
 
434
      {
502
      oprot.writeString(this.accountNo);
435
        oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, this.details.size()));
503
      oprot.writeFieldEnd();
436
        for (Map.Entry<DeliveryType, ProviderDetails> _iter4 : this.details.entrySet())
504
    }
437
        {
505
    if (this.email != null) {
438
          oprot.writeI32(_iter4.getKey().getValue());
506
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
439
          _iter4.getValue().write(oprot);
-
 
440
        }
507
      oprot.writeString(this.email);
441
        oprot.writeMapEnd();
-
 
442
      }
508
      oprot.writeFieldEnd();
443
      oprot.writeFieldEnd();
509
    }
444
    }
510
    oprot.writeFieldStop();
445
    oprot.writeFieldStop();
511
    oprot.writeStructEnd();
446
    oprot.writeStructEnd();
512
  }
447
  }
Line 526... Line 461...
526
    } else {
461
    } else {
527
      sb.append(this.name);
462
      sb.append(this.name);
528
    }
463
    }
529
    first = false;
464
    first = false;
530
    if (!first) sb.append(", ");
465
    if (!first) sb.append(", ");
531
    sb.append("accountNo:");
-
 
532
    if (this.accountNo == null) {
-
 
533
      sb.append("null");
-
 
534
    } else {
-
 
535
      sb.append(this.accountNo);
-
 
536
    }
-
 
537
    first = false;
-
 
538
    if (!first) sb.append(", ");
-
 
539
    sb.append("email:");
466
    sb.append("details:");
540
    if (this.email == null) {
467
    if (this.details == null) {
541
      sb.append("null");
468
      sb.append("null");
542
    } else {
469
    } else {
543
      sb.append(this.email);
470
      sb.append(this.details);
544
    }
471
    }
545
    first = false;
472
    first = false;
546
    sb.append(")");
473
    sb.append(")");
547
    return sb.toString();
474
    return sb.toString();
548
  }
475
  }