Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
1982 varun.gupt 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.model.v1.user;
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 PromotionService {
27
 
28
  /**
29
   * Promotion Service
30
   */
3374 rajveer 31
  public interface Iface extends in.shop2020.generic.GenericService.Iface {
1982 varun.gupt 32
 
33
    /**
34
     * For closing the open session in sqlalchemy
35
     */
36
    public void closeSession() throws TException;
37
 
38
    public void createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn) throws PromotionException, TException;
39
 
40
    public List<Promotion> getAllPromotions() throws PromotionException, TException;
41
 
42
    public Promotion getPromotionById(long promotionId) throws PromotionException, TException;
43
 
44
    public void generateCouponsForPromotion(long promotionId, String couponCode) throws PromotionException, TException;
45
 
46
    public Cart applyCoupon(String couponCode, long cartId) throws PromotionException, TException;
47
 
48
    public void trackCouponUsage(String couponCode, long transactionId, long userId) throws PromotionException, TException;
49
 
50
    public long getCouponUsageCountByUser(String couponCode, long userId) throws PromotionException, TException;
51
 
52
  }
53
 
3374 rajveer 54
  public static class Client extends in.shop2020.generic.GenericService.Client implements Iface {
1982 varun.gupt 55
    public Client(TProtocol prot)
56
    {
57
      this(prot, prot);
58
    }
59
 
60
    public Client(TProtocol iprot, TProtocol oprot)
61
    {
3374 rajveer 62
      super(iprot, oprot);
1982 varun.gupt 63
    }
64
 
65
    public void closeSession() throws TException
66
    {
67
      send_closeSession();
68
      recv_closeSession();
69
    }
70
 
71
    public void send_closeSession() throws TException
72
    {
73
      oprot_.writeMessageBegin(new TMessage("closeSession", TMessageType.CALL, seqid_));
74
      closeSession_args args = new closeSession_args();
75
      args.write(oprot_);
76
      oprot_.writeMessageEnd();
77
      oprot_.getTransport().flush();
78
    }
79
 
80
    public void recv_closeSession() throws TException
81
    {
82
      TMessage msg = iprot_.readMessageBegin();
83
      if (msg.type == TMessageType.EXCEPTION) {
84
        TApplicationException x = TApplicationException.read(iprot_);
85
        iprot_.readMessageEnd();
86
        throw x;
87
      }
88
      closeSession_result result = new closeSession_result();
89
      result.read(iprot_);
90
      iprot_.readMessageEnd();
91
      return;
92
    }
93
 
94
    public void createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn) throws PromotionException, TException
95
    {
96
      send_createPromotion(name, ruleExecutionSrc, startOn, endOn);
97
      recv_createPromotion();
98
    }
99
 
100
    public void send_createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn) throws TException
101
    {
102
      oprot_.writeMessageBegin(new TMessage("createPromotion", TMessageType.CALL, seqid_));
103
      createPromotion_args args = new createPromotion_args();
104
      args.name = name;
105
      args.ruleExecutionSrc = ruleExecutionSrc;
106
      args.startOn = startOn;
107
      args.endOn = endOn;
108
      args.write(oprot_);
109
      oprot_.writeMessageEnd();
110
      oprot_.getTransport().flush();
111
    }
112
 
113
    public void recv_createPromotion() throws PromotionException, TException
114
    {
115
      TMessage msg = iprot_.readMessageBegin();
116
      if (msg.type == TMessageType.EXCEPTION) {
117
        TApplicationException x = TApplicationException.read(iprot_);
118
        iprot_.readMessageEnd();
119
        throw x;
120
      }
121
      createPromotion_result result = new createPromotion_result();
122
      result.read(iprot_);
123
      iprot_.readMessageEnd();
124
      if (result.pex != null) {
125
        throw result.pex;
126
      }
127
      return;
128
    }
129
 
130
    public List<Promotion> getAllPromotions() throws PromotionException, TException
131
    {
132
      send_getAllPromotions();
133
      return recv_getAllPromotions();
134
    }
135
 
136
    public void send_getAllPromotions() throws TException
137
    {
138
      oprot_.writeMessageBegin(new TMessage("getAllPromotions", TMessageType.CALL, seqid_));
139
      getAllPromotions_args args = new getAllPromotions_args();
140
      args.write(oprot_);
141
      oprot_.writeMessageEnd();
142
      oprot_.getTransport().flush();
143
    }
144
 
145
    public List<Promotion> recv_getAllPromotions() throws PromotionException, TException
146
    {
147
      TMessage msg = iprot_.readMessageBegin();
148
      if (msg.type == TMessageType.EXCEPTION) {
149
        TApplicationException x = TApplicationException.read(iprot_);
150
        iprot_.readMessageEnd();
151
        throw x;
152
      }
153
      getAllPromotions_result result = new getAllPromotions_result();
154
      result.read(iprot_);
155
      iprot_.readMessageEnd();
156
      if (result.isSetSuccess()) {
157
        return result.success;
158
      }
159
      if (result.pex != null) {
160
        throw result.pex;
161
      }
162
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getAllPromotions failed: unknown result");
163
    }
164
 
165
    public Promotion getPromotionById(long promotionId) throws PromotionException, TException
166
    {
167
      send_getPromotionById(promotionId);
168
      return recv_getPromotionById();
169
    }
170
 
171
    public void send_getPromotionById(long promotionId) throws TException
172
    {
173
      oprot_.writeMessageBegin(new TMessage("getPromotionById", TMessageType.CALL, seqid_));
174
      getPromotionById_args args = new getPromotionById_args();
175
      args.promotionId = promotionId;
176
      args.write(oprot_);
177
      oprot_.writeMessageEnd();
178
      oprot_.getTransport().flush();
179
    }
180
 
181
    public Promotion recv_getPromotionById() throws PromotionException, TException
182
    {
183
      TMessage msg = iprot_.readMessageBegin();
184
      if (msg.type == TMessageType.EXCEPTION) {
185
        TApplicationException x = TApplicationException.read(iprot_);
186
        iprot_.readMessageEnd();
187
        throw x;
188
      }
189
      getPromotionById_result result = new getPromotionById_result();
190
      result.read(iprot_);
191
      iprot_.readMessageEnd();
192
      if (result.isSetSuccess()) {
193
        return result.success;
194
      }
195
      if (result.pex != null) {
196
        throw result.pex;
197
      }
198
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPromotionById failed: unknown result");
199
    }
200
 
201
    public void generateCouponsForPromotion(long promotionId, String couponCode) throws PromotionException, TException
202
    {
203
      send_generateCouponsForPromotion(promotionId, couponCode);
204
      recv_generateCouponsForPromotion();
205
    }
206
 
207
    public void send_generateCouponsForPromotion(long promotionId, String couponCode) throws TException
208
    {
209
      oprot_.writeMessageBegin(new TMessage("generateCouponsForPromotion", TMessageType.CALL, seqid_));
210
      generateCouponsForPromotion_args args = new generateCouponsForPromotion_args();
211
      args.promotionId = promotionId;
212
      args.couponCode = couponCode;
213
      args.write(oprot_);
214
      oprot_.writeMessageEnd();
215
      oprot_.getTransport().flush();
216
    }
217
 
218
    public void recv_generateCouponsForPromotion() throws PromotionException, TException
219
    {
220
      TMessage msg = iprot_.readMessageBegin();
221
      if (msg.type == TMessageType.EXCEPTION) {
222
        TApplicationException x = TApplicationException.read(iprot_);
223
        iprot_.readMessageEnd();
224
        throw x;
225
      }
226
      generateCouponsForPromotion_result result = new generateCouponsForPromotion_result();
227
      result.read(iprot_);
228
      iprot_.readMessageEnd();
229
      if (result.pex != null) {
230
        throw result.pex;
231
      }
232
      return;
233
    }
234
 
235
    public Cart applyCoupon(String couponCode, long cartId) throws PromotionException, TException
236
    {
237
      send_applyCoupon(couponCode, cartId);
238
      return recv_applyCoupon();
239
    }
240
 
241
    public void send_applyCoupon(String couponCode, long cartId) throws TException
242
    {
243
      oprot_.writeMessageBegin(new TMessage("applyCoupon", TMessageType.CALL, seqid_));
244
      applyCoupon_args args = new applyCoupon_args();
245
      args.couponCode = couponCode;
246
      args.cartId = cartId;
247
      args.write(oprot_);
248
      oprot_.writeMessageEnd();
249
      oprot_.getTransport().flush();
250
    }
251
 
252
    public Cart recv_applyCoupon() throws PromotionException, TException
253
    {
254
      TMessage msg = iprot_.readMessageBegin();
255
      if (msg.type == TMessageType.EXCEPTION) {
256
        TApplicationException x = TApplicationException.read(iprot_);
257
        iprot_.readMessageEnd();
258
        throw x;
259
      }
260
      applyCoupon_result result = new applyCoupon_result();
261
      result.read(iprot_);
262
      iprot_.readMessageEnd();
263
      if (result.isSetSuccess()) {
264
        return result.success;
265
      }
266
      if (result.pex != null) {
267
        throw result.pex;
268
      }
269
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "applyCoupon failed: unknown result");
270
    }
271
 
272
    public void trackCouponUsage(String couponCode, long transactionId, long userId) throws PromotionException, TException
273
    {
274
      send_trackCouponUsage(couponCode, transactionId, userId);
275
      recv_trackCouponUsage();
276
    }
277
 
278
    public void send_trackCouponUsage(String couponCode, long transactionId, long userId) throws TException
279
    {
280
      oprot_.writeMessageBegin(new TMessage("trackCouponUsage", TMessageType.CALL, seqid_));
281
      trackCouponUsage_args args = new trackCouponUsage_args();
282
      args.couponCode = couponCode;
283
      args.transactionId = transactionId;
284
      args.userId = userId;
285
      args.write(oprot_);
286
      oprot_.writeMessageEnd();
287
      oprot_.getTransport().flush();
288
    }
289
 
290
    public void recv_trackCouponUsage() throws PromotionException, TException
291
    {
292
      TMessage msg = iprot_.readMessageBegin();
293
      if (msg.type == TMessageType.EXCEPTION) {
294
        TApplicationException x = TApplicationException.read(iprot_);
295
        iprot_.readMessageEnd();
296
        throw x;
297
      }
298
      trackCouponUsage_result result = new trackCouponUsage_result();
299
      result.read(iprot_);
300
      iprot_.readMessageEnd();
301
      if (result.pex != null) {
302
        throw result.pex;
303
      }
304
      return;
305
    }
306
 
307
    public long getCouponUsageCountByUser(String couponCode, long userId) throws PromotionException, TException
308
    {
309
      send_getCouponUsageCountByUser(couponCode, userId);
310
      return recv_getCouponUsageCountByUser();
311
    }
312
 
313
    public void send_getCouponUsageCountByUser(String couponCode, long userId) throws TException
314
    {
315
      oprot_.writeMessageBegin(new TMessage("getCouponUsageCountByUser", TMessageType.CALL, seqid_));
316
      getCouponUsageCountByUser_args args = new getCouponUsageCountByUser_args();
317
      args.couponCode = couponCode;
318
      args.userId = userId;
319
      args.write(oprot_);
320
      oprot_.writeMessageEnd();
321
      oprot_.getTransport().flush();
322
    }
323
 
324
    public long recv_getCouponUsageCountByUser() throws PromotionException, TException
325
    {
326
      TMessage msg = iprot_.readMessageBegin();
327
      if (msg.type == TMessageType.EXCEPTION) {
328
        TApplicationException x = TApplicationException.read(iprot_);
329
        iprot_.readMessageEnd();
330
        throw x;
331
      }
332
      getCouponUsageCountByUser_result result = new getCouponUsageCountByUser_result();
333
      result.read(iprot_);
334
      iprot_.readMessageEnd();
335
      if (result.isSetSuccess()) {
336
        return result.success;
337
      }
338
      if (result.pex != null) {
339
        throw result.pex;
340
      }
341
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");
342
    }
343
 
344
  }
3374 rajveer 345
  public static class Processor extends in.shop2020.generic.GenericService.Processor implements TProcessor {
1982 varun.gupt 346
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
347
    public Processor(Iface iface)
348
    {
3374 rajveer 349
      super(iface);
1982 varun.gupt 350
      iface_ = iface;
351
      processMap_.put("closeSession", new closeSession());
352
      processMap_.put("createPromotion", new createPromotion());
353
      processMap_.put("getAllPromotions", new getAllPromotions());
354
      processMap_.put("getPromotionById", new getPromotionById());
355
      processMap_.put("generateCouponsForPromotion", new generateCouponsForPromotion());
356
      processMap_.put("applyCoupon", new applyCoupon());
357
      processMap_.put("trackCouponUsage", new trackCouponUsage());
358
      processMap_.put("getCouponUsageCountByUser", new getCouponUsageCountByUser());
359
    }
360
 
361
    private Iface iface_;
362
 
363
    public boolean process(TProtocol iprot, TProtocol oprot) throws TException
364
    {
365
      TMessage msg = iprot.readMessageBegin();
366
      ProcessFunction fn = processMap_.get(msg.name);
367
      if (fn == null) {
368
        TProtocolUtil.skip(iprot, TType.STRUCT);
369
        iprot.readMessageEnd();
370
        TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
371
        oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
372
        x.write(oprot);
373
        oprot.writeMessageEnd();
374
        oprot.getTransport().flush();
375
        return true;
376
      }
377
      fn.process(msg.seqid, iprot, oprot);
378
      return true;
379
    }
380
 
381
    private class closeSession implements ProcessFunction {
382
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
383
      {
384
        closeSession_args args = new closeSession_args();
385
        args.read(iprot);
386
        iprot.readMessageEnd();
387
        closeSession_result result = new closeSession_result();
388
        iface_.closeSession();
389
        oprot.writeMessageBegin(new TMessage("closeSession", TMessageType.REPLY, seqid));
390
        result.write(oprot);
391
        oprot.writeMessageEnd();
392
        oprot.getTransport().flush();
393
      }
394
 
395
    }
396
 
397
    private class createPromotion implements ProcessFunction {
398
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
399
      {
400
        createPromotion_args args = new createPromotion_args();
401
        args.read(iprot);
402
        iprot.readMessageEnd();
403
        createPromotion_result result = new createPromotion_result();
404
        try {
405
          iface_.createPromotion(args.name, args.ruleExecutionSrc, args.startOn, args.endOn);
406
        } catch (PromotionException pex) {
407
          result.pex = pex;
408
        } catch (Throwable th) {
409
          LOGGER.error("Internal error processing createPromotion", th);
410
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing createPromotion");
411
          oprot.writeMessageBegin(new TMessage("createPromotion", TMessageType.EXCEPTION, seqid));
412
          x.write(oprot);
413
          oprot.writeMessageEnd();
414
          oprot.getTransport().flush();
415
          return;
416
        }
417
        oprot.writeMessageBegin(new TMessage("createPromotion", TMessageType.REPLY, seqid));
418
        result.write(oprot);
419
        oprot.writeMessageEnd();
420
        oprot.getTransport().flush();
421
      }
422
 
423
    }
424
 
425
    private class getAllPromotions implements ProcessFunction {
426
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
427
      {
428
        getAllPromotions_args args = new getAllPromotions_args();
429
        args.read(iprot);
430
        iprot.readMessageEnd();
431
        getAllPromotions_result result = new getAllPromotions_result();
432
        try {
433
          result.success = iface_.getAllPromotions();
434
        } catch (PromotionException pex) {
435
          result.pex = pex;
436
        } catch (Throwable th) {
437
          LOGGER.error("Internal error processing getAllPromotions", th);
438
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getAllPromotions");
439
          oprot.writeMessageBegin(new TMessage("getAllPromotions", TMessageType.EXCEPTION, seqid));
440
          x.write(oprot);
441
          oprot.writeMessageEnd();
442
          oprot.getTransport().flush();
443
          return;
444
        }
445
        oprot.writeMessageBegin(new TMessage("getAllPromotions", TMessageType.REPLY, seqid));
446
        result.write(oprot);
447
        oprot.writeMessageEnd();
448
        oprot.getTransport().flush();
449
      }
450
 
451
    }
452
 
453
    private class getPromotionById implements ProcessFunction {
454
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
455
      {
456
        getPromotionById_args args = new getPromotionById_args();
457
        args.read(iprot);
458
        iprot.readMessageEnd();
459
        getPromotionById_result result = new getPromotionById_result();
460
        try {
461
          result.success = iface_.getPromotionById(args.promotionId);
462
        } catch (PromotionException pex) {
463
          result.pex = pex;
464
        } catch (Throwable th) {
465
          LOGGER.error("Internal error processing getPromotionById", th);
466
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPromotionById");
467
          oprot.writeMessageBegin(new TMessage("getPromotionById", TMessageType.EXCEPTION, seqid));
468
          x.write(oprot);
469
          oprot.writeMessageEnd();
470
          oprot.getTransport().flush();
471
          return;
472
        }
473
        oprot.writeMessageBegin(new TMessage("getPromotionById", TMessageType.REPLY, seqid));
474
        result.write(oprot);
475
        oprot.writeMessageEnd();
476
        oprot.getTransport().flush();
477
      }
478
 
479
    }
480
 
481
    private class generateCouponsForPromotion implements ProcessFunction {
482
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
483
      {
484
        generateCouponsForPromotion_args args = new generateCouponsForPromotion_args();
485
        args.read(iprot);
486
        iprot.readMessageEnd();
487
        generateCouponsForPromotion_result result = new generateCouponsForPromotion_result();
488
        try {
489
          iface_.generateCouponsForPromotion(args.promotionId, args.couponCode);
490
        } catch (PromotionException pex) {
491
          result.pex = pex;
492
        } catch (Throwable th) {
493
          LOGGER.error("Internal error processing generateCouponsForPromotion", th);
494
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing generateCouponsForPromotion");
495
          oprot.writeMessageBegin(new TMessage("generateCouponsForPromotion", TMessageType.EXCEPTION, seqid));
496
          x.write(oprot);
497
          oprot.writeMessageEnd();
498
          oprot.getTransport().flush();
499
          return;
500
        }
501
        oprot.writeMessageBegin(new TMessage("generateCouponsForPromotion", TMessageType.REPLY, seqid));
502
        result.write(oprot);
503
        oprot.writeMessageEnd();
504
        oprot.getTransport().flush();
505
      }
506
 
507
    }
508
 
509
    private class applyCoupon implements ProcessFunction {
510
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
511
      {
512
        applyCoupon_args args = new applyCoupon_args();
513
        args.read(iprot);
514
        iprot.readMessageEnd();
515
        applyCoupon_result result = new applyCoupon_result();
516
        try {
517
          result.success = iface_.applyCoupon(args.couponCode, args.cartId);
518
        } catch (PromotionException pex) {
519
          result.pex = pex;
520
        } catch (Throwable th) {
521
          LOGGER.error("Internal error processing applyCoupon", th);
522
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing applyCoupon");
523
          oprot.writeMessageBegin(new TMessage("applyCoupon", TMessageType.EXCEPTION, seqid));
524
          x.write(oprot);
525
          oprot.writeMessageEnd();
526
          oprot.getTransport().flush();
527
          return;
528
        }
529
        oprot.writeMessageBegin(new TMessage("applyCoupon", TMessageType.REPLY, seqid));
530
        result.write(oprot);
531
        oprot.writeMessageEnd();
532
        oprot.getTransport().flush();
533
      }
534
 
535
    }
536
 
537
    private class trackCouponUsage implements ProcessFunction {
538
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
539
      {
540
        trackCouponUsage_args args = new trackCouponUsage_args();
541
        args.read(iprot);
542
        iprot.readMessageEnd();
543
        trackCouponUsage_result result = new trackCouponUsage_result();
544
        try {
545
          iface_.trackCouponUsage(args.couponCode, args.transactionId, args.userId);
546
        } catch (PromotionException pex) {
547
          result.pex = pex;
548
        } catch (Throwable th) {
549
          LOGGER.error("Internal error processing trackCouponUsage", th);
550
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing trackCouponUsage");
551
          oprot.writeMessageBegin(new TMessage("trackCouponUsage", TMessageType.EXCEPTION, seqid));
552
          x.write(oprot);
553
          oprot.writeMessageEnd();
554
          oprot.getTransport().flush();
555
          return;
556
        }
557
        oprot.writeMessageBegin(new TMessage("trackCouponUsage", TMessageType.REPLY, seqid));
558
        result.write(oprot);
559
        oprot.writeMessageEnd();
560
        oprot.getTransport().flush();
561
      }
562
 
563
    }
564
 
565
    private class getCouponUsageCountByUser implements ProcessFunction {
566
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
567
      {
568
        getCouponUsageCountByUser_args args = new getCouponUsageCountByUser_args();
569
        args.read(iprot);
570
        iprot.readMessageEnd();
571
        getCouponUsageCountByUser_result result = new getCouponUsageCountByUser_result();
572
        try {
573
          result.success = iface_.getCouponUsageCountByUser(args.couponCode, args.userId);
574
          result.setSuccessIsSet(true);
575
        } catch (PromotionException pex) {
576
          result.pex = pex;
577
        } catch (Throwable th) {
578
          LOGGER.error("Internal error processing getCouponUsageCountByUser", th);
579
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getCouponUsageCountByUser");
580
          oprot.writeMessageBegin(new TMessage("getCouponUsageCountByUser", TMessageType.EXCEPTION, seqid));
581
          x.write(oprot);
582
          oprot.writeMessageEnd();
583
          oprot.getTransport().flush();
584
          return;
585
        }
586
        oprot.writeMessageBegin(new TMessage("getCouponUsageCountByUser", TMessageType.REPLY, seqid));
587
        result.write(oprot);
588
        oprot.writeMessageEnd();
589
        oprot.getTransport().flush();
590
      }
591
 
592
    }
593
 
594
  }
595
 
596
  public static class closeSession_args implements TBase<closeSession_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_args>   {
597
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_args");
598
 
599
 
600
 
601
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
602
    public enum _Fields implements TFieldIdEnum {
603
;
604
 
605
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
606
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
607
 
608
      static {
609
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
610
          byId.put((int)field._thriftId, field);
611
          byName.put(field.getFieldName(), field);
612
        }
613
      }
614
 
615
      /**
616
       * Find the _Fields constant that matches fieldId, or null if its not found.
617
       */
618
      public static _Fields findByThriftId(int fieldId) {
619
        return byId.get(fieldId);
620
      }
621
 
622
      /**
623
       * Find the _Fields constant that matches fieldId, throwing an exception
624
       * if it is not found.
625
       */
626
      public static _Fields findByThriftIdOrThrow(int fieldId) {
627
        _Fields fields = findByThriftId(fieldId);
628
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
629
        return fields;
630
      }
631
 
632
      /**
633
       * Find the _Fields constant that matches name, or null if its not found.
634
       */
635
      public static _Fields findByName(String name) {
636
        return byName.get(name);
637
      }
638
 
639
      private final short _thriftId;
640
      private final String _fieldName;
641
 
642
      _Fields(short thriftId, String fieldName) {
643
        _thriftId = thriftId;
644
        _fieldName = fieldName;
645
      }
646
 
647
      public short getThriftFieldId() {
648
        return _thriftId;
649
      }
650
 
651
      public String getFieldName() {
652
        return _fieldName;
653
      }
654
    }
655
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
656
    }});
657
 
658
    static {
659
      FieldMetaData.addStructMetaDataMap(closeSession_args.class, metaDataMap);
660
    }
661
 
662
    public closeSession_args() {
663
    }
664
 
665
    /**
666
     * Performs a deep copy on <i>other</i>.
667
     */
668
    public closeSession_args(closeSession_args other) {
669
    }
670
 
671
    public closeSession_args deepCopy() {
672
      return new closeSession_args(this);
673
    }
674
 
675
    @Deprecated
676
    public closeSession_args clone() {
677
      return new closeSession_args(this);
678
    }
679
 
680
    public void setFieldValue(_Fields field, Object value) {
681
      switch (field) {
682
      }
683
    }
684
 
685
    public void setFieldValue(int fieldID, Object value) {
686
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
687
    }
688
 
689
    public Object getFieldValue(_Fields field) {
690
      switch (field) {
691
      }
692
      throw new IllegalStateException();
693
    }
694
 
695
    public Object getFieldValue(int fieldId) {
696
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
697
    }
698
 
699
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
700
    public boolean isSet(_Fields field) {
701
      switch (field) {
702
      }
703
      throw new IllegalStateException();
704
    }
705
 
706
    public boolean isSet(int fieldID) {
707
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
708
    }
709
 
710
    @Override
711
    public boolean equals(Object that) {
712
      if (that == null)
713
        return false;
714
      if (that instanceof closeSession_args)
715
        return this.equals((closeSession_args)that);
716
      return false;
717
    }
718
 
719
    public boolean equals(closeSession_args that) {
720
      if (that == null)
721
        return false;
722
 
723
      return true;
724
    }
725
 
726
    @Override
727
    public int hashCode() {
728
      return 0;
729
    }
730
 
731
    public int compareTo(closeSession_args other) {
732
      if (!getClass().equals(other.getClass())) {
733
        return getClass().getName().compareTo(other.getClass().getName());
734
      }
735
 
736
      int lastComparison = 0;
737
      closeSession_args typedOther = (closeSession_args)other;
738
 
739
      return 0;
740
    }
741
 
742
    public void read(TProtocol iprot) throws TException {
743
      TField field;
744
      iprot.readStructBegin();
745
      while (true)
746
      {
747
        field = iprot.readFieldBegin();
748
        if (field.type == TType.STOP) { 
749
          break;
750
        }
751
        _Fields fieldId = _Fields.findByThriftId(field.id);
752
        if (fieldId == null) {
753
          TProtocolUtil.skip(iprot, field.type);
754
        } else {
755
          switch (fieldId) {
756
          }
757
          iprot.readFieldEnd();
758
        }
759
      }
760
      iprot.readStructEnd();
761
      validate();
762
    }
763
 
764
    public void write(TProtocol oprot) throws TException {
765
      validate();
766
 
767
      oprot.writeStructBegin(STRUCT_DESC);
768
      oprot.writeFieldStop();
769
      oprot.writeStructEnd();
770
    }
771
 
772
    @Override
773
    public String toString() {
774
      StringBuilder sb = new StringBuilder("closeSession_args(");
775
      boolean first = true;
776
 
777
      sb.append(")");
778
      return sb.toString();
779
    }
780
 
781
    public void validate() throws TException {
782
      // check for required fields
783
    }
784
 
785
  }
786
 
787
  public static class closeSession_result implements TBase<closeSession_result._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_result>   {
788
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_result");
789
 
790
 
791
 
792
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
793
    public enum _Fields implements TFieldIdEnum {
794
;
795
 
796
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
797
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
798
 
799
      static {
800
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
801
          byId.put((int)field._thriftId, field);
802
          byName.put(field.getFieldName(), field);
803
        }
804
      }
805
 
806
      /**
807
       * Find the _Fields constant that matches fieldId, or null if its not found.
808
       */
809
      public static _Fields findByThriftId(int fieldId) {
810
        return byId.get(fieldId);
811
      }
812
 
813
      /**
814
       * Find the _Fields constant that matches fieldId, throwing an exception
815
       * if it is not found.
816
       */
817
      public static _Fields findByThriftIdOrThrow(int fieldId) {
818
        _Fields fields = findByThriftId(fieldId);
819
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
820
        return fields;
821
      }
822
 
823
      /**
824
       * Find the _Fields constant that matches name, or null if its not found.
825
       */
826
      public static _Fields findByName(String name) {
827
        return byName.get(name);
828
      }
829
 
830
      private final short _thriftId;
831
      private final String _fieldName;
832
 
833
      _Fields(short thriftId, String fieldName) {
834
        _thriftId = thriftId;
835
        _fieldName = fieldName;
836
      }
837
 
838
      public short getThriftFieldId() {
839
        return _thriftId;
840
      }
841
 
842
      public String getFieldName() {
843
        return _fieldName;
844
      }
845
    }
846
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
847
    }});
848
 
849
    static {
850
      FieldMetaData.addStructMetaDataMap(closeSession_result.class, metaDataMap);
851
    }
852
 
853
    public closeSession_result() {
854
    }
855
 
856
    /**
857
     * Performs a deep copy on <i>other</i>.
858
     */
859
    public closeSession_result(closeSession_result other) {
860
    }
861
 
862
    public closeSession_result deepCopy() {
863
      return new closeSession_result(this);
864
    }
865
 
866
    @Deprecated
867
    public closeSession_result clone() {
868
      return new closeSession_result(this);
869
    }
870
 
871
    public void setFieldValue(_Fields field, Object value) {
872
      switch (field) {
873
      }
874
    }
875
 
876
    public void setFieldValue(int fieldID, Object value) {
877
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
878
    }
879
 
880
    public Object getFieldValue(_Fields field) {
881
      switch (field) {
882
      }
883
      throw new IllegalStateException();
884
    }
885
 
886
    public Object getFieldValue(int fieldId) {
887
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
888
    }
889
 
890
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
891
    public boolean isSet(_Fields field) {
892
      switch (field) {
893
      }
894
      throw new IllegalStateException();
895
    }
896
 
897
    public boolean isSet(int fieldID) {
898
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
899
    }
900
 
901
    @Override
902
    public boolean equals(Object that) {
903
      if (that == null)
904
        return false;
905
      if (that instanceof closeSession_result)
906
        return this.equals((closeSession_result)that);
907
      return false;
908
    }
909
 
910
    public boolean equals(closeSession_result that) {
911
      if (that == null)
912
        return false;
913
 
914
      return true;
915
    }
916
 
917
    @Override
918
    public int hashCode() {
919
      return 0;
920
    }
921
 
922
    public int compareTo(closeSession_result other) {
923
      if (!getClass().equals(other.getClass())) {
924
        return getClass().getName().compareTo(other.getClass().getName());
925
      }
926
 
927
      int lastComparison = 0;
928
      closeSession_result typedOther = (closeSession_result)other;
929
 
930
      return 0;
931
    }
932
 
933
    public void read(TProtocol iprot) throws TException {
934
      TField field;
935
      iprot.readStructBegin();
936
      while (true)
937
      {
938
        field = iprot.readFieldBegin();
939
        if (field.type == TType.STOP) { 
940
          break;
941
        }
942
        _Fields fieldId = _Fields.findByThriftId(field.id);
943
        if (fieldId == null) {
944
          TProtocolUtil.skip(iprot, field.type);
945
        } else {
946
          switch (fieldId) {
947
          }
948
          iprot.readFieldEnd();
949
        }
950
      }
951
      iprot.readStructEnd();
952
      validate();
953
    }
954
 
955
    public void write(TProtocol oprot) throws TException {
956
      oprot.writeStructBegin(STRUCT_DESC);
957
 
958
      oprot.writeFieldStop();
959
      oprot.writeStructEnd();
960
    }
961
 
962
    @Override
963
    public String toString() {
964
      StringBuilder sb = new StringBuilder("closeSession_result(");
965
      boolean first = true;
966
 
967
      sb.append(")");
968
      return sb.toString();
969
    }
970
 
971
    public void validate() throws TException {
972
      // check for required fields
973
    }
974
 
975
  }
976
 
977
  public static class createPromotion_args implements TBase<createPromotion_args._Fields>, java.io.Serializable, Cloneable, Comparable<createPromotion_args>   {
978
    private static final TStruct STRUCT_DESC = new TStruct("createPromotion_args");
979
 
980
    private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
981
    private static final TField RULE_EXECUTION_SRC_FIELD_DESC = new TField("ruleExecutionSrc", TType.STRING, (short)2);
982
    private static final TField START_ON_FIELD_DESC = new TField("startOn", TType.I64, (short)3);
983
    private static final TField END_ON_FIELD_DESC = new TField("endOn", TType.I64, (short)4);
984
 
985
    private String name;
986
    private String ruleExecutionSrc;
987
    private long startOn;
988
    private long endOn;
989
 
990
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
991
    public enum _Fields implements TFieldIdEnum {
992
      NAME((short)1, "name"),
993
      RULE_EXECUTION_SRC((short)2, "ruleExecutionSrc"),
994
      START_ON((short)3, "startOn"),
995
      END_ON((short)4, "endOn");
996
 
997
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
998
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
999
 
1000
      static {
1001
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
1002
          byId.put((int)field._thriftId, field);
1003
          byName.put(field.getFieldName(), field);
1004
        }
1005
      }
1006
 
1007
      /**
1008
       * Find the _Fields constant that matches fieldId, or null if its not found.
1009
       */
1010
      public static _Fields findByThriftId(int fieldId) {
1011
        return byId.get(fieldId);
1012
      }
1013
 
1014
      /**
1015
       * Find the _Fields constant that matches fieldId, throwing an exception
1016
       * if it is not found.
1017
       */
1018
      public static _Fields findByThriftIdOrThrow(int fieldId) {
1019
        _Fields fields = findByThriftId(fieldId);
1020
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
1021
        return fields;
1022
      }
1023
 
1024
      /**
1025
       * Find the _Fields constant that matches name, or null if its not found.
1026
       */
1027
      public static _Fields findByName(String name) {
1028
        return byName.get(name);
1029
      }
1030
 
1031
      private final short _thriftId;
1032
      private final String _fieldName;
1033
 
1034
      _Fields(short thriftId, String fieldName) {
1035
        _thriftId = thriftId;
1036
        _fieldName = fieldName;
1037
      }
1038
 
1039
      public short getThriftFieldId() {
1040
        return _thriftId;
1041
      }
1042
 
1043
      public String getFieldName() {
1044
        return _fieldName;
1045
      }
1046
    }
1047
 
1048
    // isset id assignments
1049
    private static final int __STARTON_ISSET_ID = 0;
1050
    private static final int __ENDON_ISSET_ID = 1;
1051
    private BitSet __isset_bit_vector = new BitSet(2);
1052
 
1053
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
1054
      put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
1055
          new FieldValueMetaData(TType.STRING)));
1056
      put(_Fields.RULE_EXECUTION_SRC, new FieldMetaData("ruleExecutionSrc", TFieldRequirementType.DEFAULT, 
1057
          new FieldValueMetaData(TType.STRING)));
1058
      put(_Fields.START_ON, new FieldMetaData("startOn", TFieldRequirementType.DEFAULT, 
1059
          new FieldValueMetaData(TType.I64)));
1060
      put(_Fields.END_ON, new FieldMetaData("endOn", TFieldRequirementType.DEFAULT, 
1061
          new FieldValueMetaData(TType.I64)));
1062
    }});
1063
 
1064
    static {
1065
      FieldMetaData.addStructMetaDataMap(createPromotion_args.class, metaDataMap);
1066
    }
1067
 
1068
    public createPromotion_args() {
1069
    }
1070
 
1071
    public createPromotion_args(
1072
      String name,
1073
      String ruleExecutionSrc,
1074
      long startOn,
1075
      long endOn)
1076
    {
1077
      this();
1078
      this.name = name;
1079
      this.ruleExecutionSrc = ruleExecutionSrc;
1080
      this.startOn = startOn;
1081
      setStartOnIsSet(true);
1082
      this.endOn = endOn;
1083
      setEndOnIsSet(true);
1084
    }
1085
 
1086
    /**
1087
     * Performs a deep copy on <i>other</i>.
1088
     */
1089
    public createPromotion_args(createPromotion_args other) {
1090
      __isset_bit_vector.clear();
1091
      __isset_bit_vector.or(other.__isset_bit_vector);
1092
      if (other.isSetName()) {
1093
        this.name = other.name;
1094
      }
1095
      if (other.isSetRuleExecutionSrc()) {
1096
        this.ruleExecutionSrc = other.ruleExecutionSrc;
1097
      }
1098
      this.startOn = other.startOn;
1099
      this.endOn = other.endOn;
1100
    }
1101
 
1102
    public createPromotion_args deepCopy() {
1103
      return new createPromotion_args(this);
1104
    }
1105
 
1106
    @Deprecated
1107
    public createPromotion_args clone() {
1108
      return new createPromotion_args(this);
1109
    }
1110
 
1111
    public String getName() {
1112
      return this.name;
1113
    }
1114
 
1115
    public createPromotion_args setName(String name) {
1116
      this.name = name;
1117
      return this;
1118
    }
1119
 
1120
    public void unsetName() {
1121
      this.name = null;
1122
    }
1123
 
1124
    /** Returns true if field name is set (has been asigned a value) and false otherwise */
1125
    public boolean isSetName() {
1126
      return this.name != null;
1127
    }
1128
 
1129
    public void setNameIsSet(boolean value) {
1130
      if (!value) {
1131
        this.name = null;
1132
      }
1133
    }
1134
 
1135
    public String getRuleExecutionSrc() {
1136
      return this.ruleExecutionSrc;
1137
    }
1138
 
1139
    public createPromotion_args setRuleExecutionSrc(String ruleExecutionSrc) {
1140
      this.ruleExecutionSrc = ruleExecutionSrc;
1141
      return this;
1142
    }
1143
 
1144
    public void unsetRuleExecutionSrc() {
1145
      this.ruleExecutionSrc = null;
1146
    }
1147
 
1148
    /** Returns true if field ruleExecutionSrc is set (has been asigned a value) and false otherwise */
1149
    public boolean isSetRuleExecutionSrc() {
1150
      return this.ruleExecutionSrc != null;
1151
    }
1152
 
1153
    public void setRuleExecutionSrcIsSet(boolean value) {
1154
      if (!value) {
1155
        this.ruleExecutionSrc = null;
1156
      }
1157
    }
1158
 
1159
    public long getStartOn() {
1160
      return this.startOn;
1161
    }
1162
 
1163
    public createPromotion_args setStartOn(long startOn) {
1164
      this.startOn = startOn;
1165
      setStartOnIsSet(true);
1166
      return this;
1167
    }
1168
 
1169
    public void unsetStartOn() {
1170
      __isset_bit_vector.clear(__STARTON_ISSET_ID);
1171
    }
1172
 
1173
    /** Returns true if field startOn is set (has been asigned a value) and false otherwise */
1174
    public boolean isSetStartOn() {
1175
      return __isset_bit_vector.get(__STARTON_ISSET_ID);
1176
    }
1177
 
1178
    public void setStartOnIsSet(boolean value) {
1179
      __isset_bit_vector.set(__STARTON_ISSET_ID, value);
1180
    }
1181
 
1182
    public long getEndOn() {
1183
      return this.endOn;
1184
    }
1185
 
1186
    public createPromotion_args setEndOn(long endOn) {
1187
      this.endOn = endOn;
1188
      setEndOnIsSet(true);
1189
      return this;
1190
    }
1191
 
1192
    public void unsetEndOn() {
1193
      __isset_bit_vector.clear(__ENDON_ISSET_ID);
1194
    }
1195
 
1196
    /** Returns true if field endOn is set (has been asigned a value) and false otherwise */
1197
    public boolean isSetEndOn() {
1198
      return __isset_bit_vector.get(__ENDON_ISSET_ID);
1199
    }
1200
 
1201
    public void setEndOnIsSet(boolean value) {
1202
      __isset_bit_vector.set(__ENDON_ISSET_ID, value);
1203
    }
1204
 
1205
    public void setFieldValue(_Fields field, Object value) {
1206
      switch (field) {
1207
      case NAME:
1208
        if (value == null) {
1209
          unsetName();
1210
        } else {
1211
          setName((String)value);
1212
        }
1213
        break;
1214
 
1215
      case RULE_EXECUTION_SRC:
1216
        if (value == null) {
1217
          unsetRuleExecutionSrc();
1218
        } else {
1219
          setRuleExecutionSrc((String)value);
1220
        }
1221
        break;
1222
 
1223
      case START_ON:
1224
        if (value == null) {
1225
          unsetStartOn();
1226
        } else {
1227
          setStartOn((Long)value);
1228
        }
1229
        break;
1230
 
1231
      case END_ON:
1232
        if (value == null) {
1233
          unsetEndOn();
1234
        } else {
1235
          setEndOn((Long)value);
1236
        }
1237
        break;
1238
 
1239
      }
1240
    }
1241
 
1242
    public void setFieldValue(int fieldID, Object value) {
1243
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
1244
    }
1245
 
1246
    public Object getFieldValue(_Fields field) {
1247
      switch (field) {
1248
      case NAME:
1249
        return getName();
1250
 
1251
      case RULE_EXECUTION_SRC:
1252
        return getRuleExecutionSrc();
1253
 
1254
      case START_ON:
1255
        return new Long(getStartOn());
1256
 
1257
      case END_ON:
1258
        return new Long(getEndOn());
1259
 
1260
      }
1261
      throw new IllegalStateException();
1262
    }
1263
 
1264
    public Object getFieldValue(int fieldId) {
1265
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
1266
    }
1267
 
1268
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
1269
    public boolean isSet(_Fields field) {
1270
      switch (field) {
1271
      case NAME:
1272
        return isSetName();
1273
      case RULE_EXECUTION_SRC:
1274
        return isSetRuleExecutionSrc();
1275
      case START_ON:
1276
        return isSetStartOn();
1277
      case END_ON:
1278
        return isSetEndOn();
1279
      }
1280
      throw new IllegalStateException();
1281
    }
1282
 
1283
    public boolean isSet(int fieldID) {
1284
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
1285
    }
1286
 
1287
    @Override
1288
    public boolean equals(Object that) {
1289
      if (that == null)
1290
        return false;
1291
      if (that instanceof createPromotion_args)
1292
        return this.equals((createPromotion_args)that);
1293
      return false;
1294
    }
1295
 
1296
    public boolean equals(createPromotion_args that) {
1297
      if (that == null)
1298
        return false;
1299
 
1300
      boolean this_present_name = true && this.isSetName();
1301
      boolean that_present_name = true && that.isSetName();
1302
      if (this_present_name || that_present_name) {
1303
        if (!(this_present_name && that_present_name))
1304
          return false;
1305
        if (!this.name.equals(that.name))
1306
          return false;
1307
      }
1308
 
1309
      boolean this_present_ruleExecutionSrc = true && this.isSetRuleExecutionSrc();
1310
      boolean that_present_ruleExecutionSrc = true && that.isSetRuleExecutionSrc();
1311
      if (this_present_ruleExecutionSrc || that_present_ruleExecutionSrc) {
1312
        if (!(this_present_ruleExecutionSrc && that_present_ruleExecutionSrc))
1313
          return false;
1314
        if (!this.ruleExecutionSrc.equals(that.ruleExecutionSrc))
1315
          return false;
1316
      }
1317
 
1318
      boolean this_present_startOn = true;
1319
      boolean that_present_startOn = true;
1320
      if (this_present_startOn || that_present_startOn) {
1321
        if (!(this_present_startOn && that_present_startOn))
1322
          return false;
1323
        if (this.startOn != that.startOn)
1324
          return false;
1325
      }
1326
 
1327
      boolean this_present_endOn = true;
1328
      boolean that_present_endOn = true;
1329
      if (this_present_endOn || that_present_endOn) {
1330
        if (!(this_present_endOn && that_present_endOn))
1331
          return false;
1332
        if (this.endOn != that.endOn)
1333
          return false;
1334
      }
1335
 
1336
      return true;
1337
    }
1338
 
1339
    @Override
1340
    public int hashCode() {
1341
      return 0;
1342
    }
1343
 
1344
    public int compareTo(createPromotion_args other) {
1345
      if (!getClass().equals(other.getClass())) {
1346
        return getClass().getName().compareTo(other.getClass().getName());
1347
      }
1348
 
1349
      int lastComparison = 0;
1350
      createPromotion_args typedOther = (createPromotion_args)other;
1351
 
1352
      lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
1353
      if (lastComparison != 0) {
1354
        return lastComparison;
1355
      }
1356
      lastComparison = TBaseHelper.compareTo(name, typedOther.name);
1357
      if (lastComparison != 0) {
1358
        return lastComparison;
1359
      }
1360
      lastComparison = Boolean.valueOf(isSetRuleExecutionSrc()).compareTo(isSetRuleExecutionSrc());
1361
      if (lastComparison != 0) {
1362
        return lastComparison;
1363
      }
1364
      lastComparison = TBaseHelper.compareTo(ruleExecutionSrc, typedOther.ruleExecutionSrc);
1365
      if (lastComparison != 0) {
1366
        return lastComparison;
1367
      }
1368
      lastComparison = Boolean.valueOf(isSetStartOn()).compareTo(isSetStartOn());
1369
      if (lastComparison != 0) {
1370
        return lastComparison;
1371
      }
1372
      lastComparison = TBaseHelper.compareTo(startOn, typedOther.startOn);
1373
      if (lastComparison != 0) {
1374
        return lastComparison;
1375
      }
1376
      lastComparison = Boolean.valueOf(isSetEndOn()).compareTo(isSetEndOn());
1377
      if (lastComparison != 0) {
1378
        return lastComparison;
1379
      }
1380
      lastComparison = TBaseHelper.compareTo(endOn, typedOther.endOn);
1381
      if (lastComparison != 0) {
1382
        return lastComparison;
1383
      }
1384
      return 0;
1385
    }
1386
 
1387
    public void read(TProtocol iprot) throws TException {
1388
      TField field;
1389
      iprot.readStructBegin();
1390
      while (true)
1391
      {
1392
        field = iprot.readFieldBegin();
1393
        if (field.type == TType.STOP) { 
1394
          break;
1395
        }
1396
        _Fields fieldId = _Fields.findByThriftId(field.id);
1397
        if (fieldId == null) {
1398
          TProtocolUtil.skip(iprot, field.type);
1399
        } else {
1400
          switch (fieldId) {
1401
            case NAME:
1402
              if (field.type == TType.STRING) {
1403
                this.name = iprot.readString();
1404
              } else { 
1405
                TProtocolUtil.skip(iprot, field.type);
1406
              }
1407
              break;
1408
            case RULE_EXECUTION_SRC:
1409
              if (field.type == TType.STRING) {
1410
                this.ruleExecutionSrc = iprot.readString();
1411
              } else { 
1412
                TProtocolUtil.skip(iprot, field.type);
1413
              }
1414
              break;
1415
            case START_ON:
1416
              if (field.type == TType.I64) {
1417
                this.startOn = iprot.readI64();
1418
                setStartOnIsSet(true);
1419
              } else { 
1420
                TProtocolUtil.skip(iprot, field.type);
1421
              }
1422
              break;
1423
            case END_ON:
1424
              if (field.type == TType.I64) {
1425
                this.endOn = iprot.readI64();
1426
                setEndOnIsSet(true);
1427
              } else { 
1428
                TProtocolUtil.skip(iprot, field.type);
1429
              }
1430
              break;
1431
          }
1432
          iprot.readFieldEnd();
1433
        }
1434
      }
1435
      iprot.readStructEnd();
1436
      validate();
1437
    }
1438
 
1439
    public void write(TProtocol oprot) throws TException {
1440
      validate();
1441
 
1442
      oprot.writeStructBegin(STRUCT_DESC);
1443
      if (this.name != null) {
1444
        oprot.writeFieldBegin(NAME_FIELD_DESC);
1445
        oprot.writeString(this.name);
1446
        oprot.writeFieldEnd();
1447
      }
1448
      if (this.ruleExecutionSrc != null) {
1449
        oprot.writeFieldBegin(RULE_EXECUTION_SRC_FIELD_DESC);
1450
        oprot.writeString(this.ruleExecutionSrc);
1451
        oprot.writeFieldEnd();
1452
      }
1453
      oprot.writeFieldBegin(START_ON_FIELD_DESC);
1454
      oprot.writeI64(this.startOn);
1455
      oprot.writeFieldEnd();
1456
      oprot.writeFieldBegin(END_ON_FIELD_DESC);
1457
      oprot.writeI64(this.endOn);
1458
      oprot.writeFieldEnd();
1459
      oprot.writeFieldStop();
1460
      oprot.writeStructEnd();
1461
    }
1462
 
1463
    @Override
1464
    public String toString() {
1465
      StringBuilder sb = new StringBuilder("createPromotion_args(");
1466
      boolean first = true;
1467
 
1468
      sb.append("name:");
1469
      if (this.name == null) {
1470
        sb.append("null");
1471
      } else {
1472
        sb.append(this.name);
1473
      }
1474
      first = false;
1475
      if (!first) sb.append(", ");
1476
      sb.append("ruleExecutionSrc:");
1477
      if (this.ruleExecutionSrc == null) {
1478
        sb.append("null");
1479
      } else {
1480
        sb.append(this.ruleExecutionSrc);
1481
      }
1482
      first = false;
1483
      if (!first) sb.append(", ");
1484
      sb.append("startOn:");
1485
      sb.append(this.startOn);
1486
      first = false;
1487
      if (!first) sb.append(", ");
1488
      sb.append("endOn:");
1489
      sb.append(this.endOn);
1490
      first = false;
1491
      sb.append(")");
1492
      return sb.toString();
1493
    }
1494
 
1495
    public void validate() throws TException {
1496
      // check for required fields
1497
    }
1498
 
1499
  }
1500
 
1501
  public static class createPromotion_result implements TBase<createPromotion_result._Fields>, java.io.Serializable, Cloneable, Comparable<createPromotion_result>   {
1502
    private static final TStruct STRUCT_DESC = new TStruct("createPromotion_result");
1503
 
1504
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
1505
 
1506
    private PromotionException pex;
1507
 
1508
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
1509
    public enum _Fields implements TFieldIdEnum {
1510
      PEX((short)1, "pex");
1511
 
1512
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
1513
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
1514
 
1515
      static {
1516
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
1517
          byId.put((int)field._thriftId, field);
1518
          byName.put(field.getFieldName(), field);
1519
        }
1520
      }
1521
 
1522
      /**
1523
       * Find the _Fields constant that matches fieldId, or null if its not found.
1524
       */
1525
      public static _Fields findByThriftId(int fieldId) {
1526
        return byId.get(fieldId);
1527
      }
1528
 
1529
      /**
1530
       * Find the _Fields constant that matches fieldId, throwing an exception
1531
       * if it is not found.
1532
       */
1533
      public static _Fields findByThriftIdOrThrow(int fieldId) {
1534
        _Fields fields = findByThriftId(fieldId);
1535
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
1536
        return fields;
1537
      }
1538
 
1539
      /**
1540
       * Find the _Fields constant that matches name, or null if its not found.
1541
       */
1542
      public static _Fields findByName(String name) {
1543
        return byName.get(name);
1544
      }
1545
 
1546
      private final short _thriftId;
1547
      private final String _fieldName;
1548
 
1549
      _Fields(short thriftId, String fieldName) {
1550
        _thriftId = thriftId;
1551
        _fieldName = fieldName;
1552
      }
1553
 
1554
      public short getThriftFieldId() {
1555
        return _thriftId;
1556
      }
1557
 
1558
      public String getFieldName() {
1559
        return _fieldName;
1560
      }
1561
    }
1562
 
1563
    // isset id assignments
1564
 
1565
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
1566
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
1567
          new FieldValueMetaData(TType.STRUCT)));
1568
    }});
1569
 
1570
    static {
1571
      FieldMetaData.addStructMetaDataMap(createPromotion_result.class, metaDataMap);
1572
    }
1573
 
1574
    public createPromotion_result() {
1575
    }
1576
 
1577
    public createPromotion_result(
1578
      PromotionException pex)
1579
    {
1580
      this();
1581
      this.pex = pex;
1582
    }
1583
 
1584
    /**
1585
     * Performs a deep copy on <i>other</i>.
1586
     */
1587
    public createPromotion_result(createPromotion_result other) {
1588
      if (other.isSetPex()) {
1589
        this.pex = new PromotionException(other.pex);
1590
      }
1591
    }
1592
 
1593
    public createPromotion_result deepCopy() {
1594
      return new createPromotion_result(this);
1595
    }
1596
 
1597
    @Deprecated
1598
    public createPromotion_result clone() {
1599
      return new createPromotion_result(this);
1600
    }
1601
 
1602
    public PromotionException getPex() {
1603
      return this.pex;
1604
    }
1605
 
1606
    public createPromotion_result setPex(PromotionException pex) {
1607
      this.pex = pex;
1608
      return this;
1609
    }
1610
 
1611
    public void unsetPex() {
1612
      this.pex = null;
1613
    }
1614
 
1615
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
1616
    public boolean isSetPex() {
1617
      return this.pex != null;
1618
    }
1619
 
1620
    public void setPexIsSet(boolean value) {
1621
      if (!value) {
1622
        this.pex = null;
1623
      }
1624
    }
1625
 
1626
    public void setFieldValue(_Fields field, Object value) {
1627
      switch (field) {
1628
      case PEX:
1629
        if (value == null) {
1630
          unsetPex();
1631
        } else {
1632
          setPex((PromotionException)value);
1633
        }
1634
        break;
1635
 
1636
      }
1637
    }
1638
 
1639
    public void setFieldValue(int fieldID, Object value) {
1640
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
1641
    }
1642
 
1643
    public Object getFieldValue(_Fields field) {
1644
      switch (field) {
1645
      case PEX:
1646
        return getPex();
1647
 
1648
      }
1649
      throw new IllegalStateException();
1650
    }
1651
 
1652
    public Object getFieldValue(int fieldId) {
1653
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
1654
    }
1655
 
1656
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
1657
    public boolean isSet(_Fields field) {
1658
      switch (field) {
1659
      case PEX:
1660
        return isSetPex();
1661
      }
1662
      throw new IllegalStateException();
1663
    }
1664
 
1665
    public boolean isSet(int fieldID) {
1666
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
1667
    }
1668
 
1669
    @Override
1670
    public boolean equals(Object that) {
1671
      if (that == null)
1672
        return false;
1673
      if (that instanceof createPromotion_result)
1674
        return this.equals((createPromotion_result)that);
1675
      return false;
1676
    }
1677
 
1678
    public boolean equals(createPromotion_result that) {
1679
      if (that == null)
1680
        return false;
1681
 
1682
      boolean this_present_pex = true && this.isSetPex();
1683
      boolean that_present_pex = true && that.isSetPex();
1684
      if (this_present_pex || that_present_pex) {
1685
        if (!(this_present_pex && that_present_pex))
1686
          return false;
1687
        if (!this.pex.equals(that.pex))
1688
          return false;
1689
      }
1690
 
1691
      return true;
1692
    }
1693
 
1694
    @Override
1695
    public int hashCode() {
1696
      return 0;
1697
    }
1698
 
1699
    public int compareTo(createPromotion_result other) {
1700
      if (!getClass().equals(other.getClass())) {
1701
        return getClass().getName().compareTo(other.getClass().getName());
1702
      }
1703
 
1704
      int lastComparison = 0;
1705
      createPromotion_result typedOther = (createPromotion_result)other;
1706
 
1707
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
1708
      if (lastComparison != 0) {
1709
        return lastComparison;
1710
      }
1711
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
1712
      if (lastComparison != 0) {
1713
        return lastComparison;
1714
      }
1715
      return 0;
1716
    }
1717
 
1718
    public void read(TProtocol iprot) throws TException {
1719
      TField field;
1720
      iprot.readStructBegin();
1721
      while (true)
1722
      {
1723
        field = iprot.readFieldBegin();
1724
        if (field.type == TType.STOP) { 
1725
          break;
1726
        }
1727
        _Fields fieldId = _Fields.findByThriftId(field.id);
1728
        if (fieldId == null) {
1729
          TProtocolUtil.skip(iprot, field.type);
1730
        } else {
1731
          switch (fieldId) {
1732
            case PEX:
1733
              if (field.type == TType.STRUCT) {
1734
                this.pex = new PromotionException();
1735
                this.pex.read(iprot);
1736
              } else { 
1737
                TProtocolUtil.skip(iprot, field.type);
1738
              }
1739
              break;
1740
          }
1741
          iprot.readFieldEnd();
1742
        }
1743
      }
1744
      iprot.readStructEnd();
1745
      validate();
1746
    }
1747
 
1748
    public void write(TProtocol oprot) throws TException {
1749
      oprot.writeStructBegin(STRUCT_DESC);
1750
 
1751
      if (this.isSetPex()) {
1752
        oprot.writeFieldBegin(PEX_FIELD_DESC);
1753
        this.pex.write(oprot);
1754
        oprot.writeFieldEnd();
1755
      }
1756
      oprot.writeFieldStop();
1757
      oprot.writeStructEnd();
1758
    }
1759
 
1760
    @Override
1761
    public String toString() {
1762
      StringBuilder sb = new StringBuilder("createPromotion_result(");
1763
      boolean first = true;
1764
 
1765
      sb.append("pex:");
1766
      if (this.pex == null) {
1767
        sb.append("null");
1768
      } else {
1769
        sb.append(this.pex);
1770
      }
1771
      first = false;
1772
      sb.append(")");
1773
      return sb.toString();
1774
    }
1775
 
1776
    public void validate() throws TException {
1777
      // check for required fields
1778
    }
1779
 
1780
  }
1781
 
1782
  public static class getAllPromotions_args implements TBase<getAllPromotions_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllPromotions_args>   {
1783
    private static final TStruct STRUCT_DESC = new TStruct("getAllPromotions_args");
1784
 
1785
 
1786
 
1787
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
1788
    public enum _Fields implements TFieldIdEnum {
1789
;
1790
 
1791
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
1792
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
1793
 
1794
      static {
1795
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
1796
          byId.put((int)field._thriftId, field);
1797
          byName.put(field.getFieldName(), field);
1798
        }
1799
      }
1800
 
1801
      /**
1802
       * Find the _Fields constant that matches fieldId, or null if its not found.
1803
       */
1804
      public static _Fields findByThriftId(int fieldId) {
1805
        return byId.get(fieldId);
1806
      }
1807
 
1808
      /**
1809
       * Find the _Fields constant that matches fieldId, throwing an exception
1810
       * if it is not found.
1811
       */
1812
      public static _Fields findByThriftIdOrThrow(int fieldId) {
1813
        _Fields fields = findByThriftId(fieldId);
1814
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
1815
        return fields;
1816
      }
1817
 
1818
      /**
1819
       * Find the _Fields constant that matches name, or null if its not found.
1820
       */
1821
      public static _Fields findByName(String name) {
1822
        return byName.get(name);
1823
      }
1824
 
1825
      private final short _thriftId;
1826
      private final String _fieldName;
1827
 
1828
      _Fields(short thriftId, String fieldName) {
1829
        _thriftId = thriftId;
1830
        _fieldName = fieldName;
1831
      }
1832
 
1833
      public short getThriftFieldId() {
1834
        return _thriftId;
1835
      }
1836
 
1837
      public String getFieldName() {
1838
        return _fieldName;
1839
      }
1840
    }
1841
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
1842
    }});
1843
 
1844
    static {
1845
      FieldMetaData.addStructMetaDataMap(getAllPromotions_args.class, metaDataMap);
1846
    }
1847
 
1848
    public getAllPromotions_args() {
1849
    }
1850
 
1851
    /**
1852
     * Performs a deep copy on <i>other</i>.
1853
     */
1854
    public getAllPromotions_args(getAllPromotions_args other) {
1855
    }
1856
 
1857
    public getAllPromotions_args deepCopy() {
1858
      return new getAllPromotions_args(this);
1859
    }
1860
 
1861
    @Deprecated
1862
    public getAllPromotions_args clone() {
1863
      return new getAllPromotions_args(this);
1864
    }
1865
 
1866
    public void setFieldValue(_Fields field, Object value) {
1867
      switch (field) {
1868
      }
1869
    }
1870
 
1871
    public void setFieldValue(int fieldID, Object value) {
1872
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
1873
    }
1874
 
1875
    public Object getFieldValue(_Fields field) {
1876
      switch (field) {
1877
      }
1878
      throw new IllegalStateException();
1879
    }
1880
 
1881
    public Object getFieldValue(int fieldId) {
1882
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
1883
    }
1884
 
1885
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
1886
    public boolean isSet(_Fields field) {
1887
      switch (field) {
1888
      }
1889
      throw new IllegalStateException();
1890
    }
1891
 
1892
    public boolean isSet(int fieldID) {
1893
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
1894
    }
1895
 
1896
    @Override
1897
    public boolean equals(Object that) {
1898
      if (that == null)
1899
        return false;
1900
      if (that instanceof getAllPromotions_args)
1901
        return this.equals((getAllPromotions_args)that);
1902
      return false;
1903
    }
1904
 
1905
    public boolean equals(getAllPromotions_args that) {
1906
      if (that == null)
1907
        return false;
1908
 
1909
      return true;
1910
    }
1911
 
1912
    @Override
1913
    public int hashCode() {
1914
      return 0;
1915
    }
1916
 
1917
    public int compareTo(getAllPromotions_args other) {
1918
      if (!getClass().equals(other.getClass())) {
1919
        return getClass().getName().compareTo(other.getClass().getName());
1920
      }
1921
 
1922
      int lastComparison = 0;
1923
      getAllPromotions_args typedOther = (getAllPromotions_args)other;
1924
 
1925
      return 0;
1926
    }
1927
 
1928
    public void read(TProtocol iprot) throws TException {
1929
      TField field;
1930
      iprot.readStructBegin();
1931
      while (true)
1932
      {
1933
        field = iprot.readFieldBegin();
1934
        if (field.type == TType.STOP) { 
1935
          break;
1936
        }
1937
        _Fields fieldId = _Fields.findByThriftId(field.id);
1938
        if (fieldId == null) {
1939
          TProtocolUtil.skip(iprot, field.type);
1940
        } else {
1941
          switch (fieldId) {
1942
          }
1943
          iprot.readFieldEnd();
1944
        }
1945
      }
1946
      iprot.readStructEnd();
1947
      validate();
1948
    }
1949
 
1950
    public void write(TProtocol oprot) throws TException {
1951
      validate();
1952
 
1953
      oprot.writeStructBegin(STRUCT_DESC);
1954
      oprot.writeFieldStop();
1955
      oprot.writeStructEnd();
1956
    }
1957
 
1958
    @Override
1959
    public String toString() {
1960
      StringBuilder sb = new StringBuilder("getAllPromotions_args(");
1961
      boolean first = true;
1962
 
1963
      sb.append(")");
1964
      return sb.toString();
1965
    }
1966
 
1967
    public void validate() throws TException {
1968
      // check for required fields
1969
    }
1970
 
1971
  }
1972
 
1973
  public static class getAllPromotions_result implements TBase<getAllPromotions_result._Fields>, java.io.Serializable, Cloneable, Comparable<getAllPromotions_result>   {
1974
    private static final TStruct STRUCT_DESC = new TStruct("getAllPromotions_result");
1975
 
1976
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
1977
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
1978
 
1979
    private List<Promotion> success;
1980
    private PromotionException pex;
1981
 
1982
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
1983
    public enum _Fields implements TFieldIdEnum {
1984
      SUCCESS((short)0, "success"),
1985
      PEX((short)1, "pex");
1986
 
1987
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
1988
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
1989
 
1990
      static {
1991
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
1992
          byId.put((int)field._thriftId, field);
1993
          byName.put(field.getFieldName(), field);
1994
        }
1995
      }
1996
 
1997
      /**
1998
       * Find the _Fields constant that matches fieldId, or null if its not found.
1999
       */
2000
      public static _Fields findByThriftId(int fieldId) {
2001
        return byId.get(fieldId);
2002
      }
2003
 
2004
      /**
2005
       * Find the _Fields constant that matches fieldId, throwing an exception
2006
       * if it is not found.
2007
       */
2008
      public static _Fields findByThriftIdOrThrow(int fieldId) {
2009
        _Fields fields = findByThriftId(fieldId);
2010
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
2011
        return fields;
2012
      }
2013
 
2014
      /**
2015
       * Find the _Fields constant that matches name, or null if its not found.
2016
       */
2017
      public static _Fields findByName(String name) {
2018
        return byName.get(name);
2019
      }
2020
 
2021
      private final short _thriftId;
2022
      private final String _fieldName;
2023
 
2024
      _Fields(short thriftId, String fieldName) {
2025
        _thriftId = thriftId;
2026
        _fieldName = fieldName;
2027
      }
2028
 
2029
      public short getThriftFieldId() {
2030
        return _thriftId;
2031
      }
2032
 
2033
      public String getFieldName() {
2034
        return _fieldName;
2035
      }
2036
    }
2037
 
2038
    // isset id assignments
2039
 
2040
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
2041
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
2042
          new ListMetaData(TType.LIST, 
2043
              new StructMetaData(TType.STRUCT, Promotion.class))));
2044
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
2045
          new FieldValueMetaData(TType.STRUCT)));
2046
    }});
2047
 
2048
    static {
2049
      FieldMetaData.addStructMetaDataMap(getAllPromotions_result.class, metaDataMap);
2050
    }
2051
 
2052
    public getAllPromotions_result() {
2053
    }
2054
 
2055
    public getAllPromotions_result(
2056
      List<Promotion> success,
2057
      PromotionException pex)
2058
    {
2059
      this();
2060
      this.success = success;
2061
      this.pex = pex;
2062
    }
2063
 
2064
    /**
2065
     * Performs a deep copy on <i>other</i>.
2066
     */
2067
    public getAllPromotions_result(getAllPromotions_result other) {
2068
      if (other.isSetSuccess()) {
2069
        List<Promotion> __this__success = new ArrayList<Promotion>();
2070
        for (Promotion other_element : other.success) {
2071
          __this__success.add(new Promotion(other_element));
2072
        }
2073
        this.success = __this__success;
2074
      }
2075
      if (other.isSetPex()) {
2076
        this.pex = new PromotionException(other.pex);
2077
      }
2078
    }
2079
 
2080
    public getAllPromotions_result deepCopy() {
2081
      return new getAllPromotions_result(this);
2082
    }
2083
 
2084
    @Deprecated
2085
    public getAllPromotions_result clone() {
2086
      return new getAllPromotions_result(this);
2087
    }
2088
 
2089
    public int getSuccessSize() {
2090
      return (this.success == null) ? 0 : this.success.size();
2091
    }
2092
 
2093
    public java.util.Iterator<Promotion> getSuccessIterator() {
2094
      return (this.success == null) ? null : this.success.iterator();
2095
    }
2096
 
2097
    public void addToSuccess(Promotion elem) {
2098
      if (this.success == null) {
2099
        this.success = new ArrayList<Promotion>();
2100
      }
2101
      this.success.add(elem);
2102
    }
2103
 
2104
    public List<Promotion> getSuccess() {
2105
      return this.success;
2106
    }
2107
 
2108
    public getAllPromotions_result setSuccess(List<Promotion> success) {
2109
      this.success = success;
2110
      return this;
2111
    }
2112
 
2113
    public void unsetSuccess() {
2114
      this.success = null;
2115
    }
2116
 
2117
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
2118
    public boolean isSetSuccess() {
2119
      return this.success != null;
2120
    }
2121
 
2122
    public void setSuccessIsSet(boolean value) {
2123
      if (!value) {
2124
        this.success = null;
2125
      }
2126
    }
2127
 
2128
    public PromotionException getPex() {
2129
      return this.pex;
2130
    }
2131
 
2132
    public getAllPromotions_result setPex(PromotionException pex) {
2133
      this.pex = pex;
2134
      return this;
2135
    }
2136
 
2137
    public void unsetPex() {
2138
      this.pex = null;
2139
    }
2140
 
2141
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
2142
    public boolean isSetPex() {
2143
      return this.pex != null;
2144
    }
2145
 
2146
    public void setPexIsSet(boolean value) {
2147
      if (!value) {
2148
        this.pex = null;
2149
      }
2150
    }
2151
 
2152
    public void setFieldValue(_Fields field, Object value) {
2153
      switch (field) {
2154
      case SUCCESS:
2155
        if (value == null) {
2156
          unsetSuccess();
2157
        } else {
2158
          setSuccess((List<Promotion>)value);
2159
        }
2160
        break;
2161
 
2162
      case PEX:
2163
        if (value == null) {
2164
          unsetPex();
2165
        } else {
2166
          setPex((PromotionException)value);
2167
        }
2168
        break;
2169
 
2170
      }
2171
    }
2172
 
2173
    public void setFieldValue(int fieldID, Object value) {
2174
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
2175
    }
2176
 
2177
    public Object getFieldValue(_Fields field) {
2178
      switch (field) {
2179
      case SUCCESS:
2180
        return getSuccess();
2181
 
2182
      case PEX:
2183
        return getPex();
2184
 
2185
      }
2186
      throw new IllegalStateException();
2187
    }
2188
 
2189
    public Object getFieldValue(int fieldId) {
2190
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
2191
    }
2192
 
2193
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
2194
    public boolean isSet(_Fields field) {
2195
      switch (field) {
2196
      case SUCCESS:
2197
        return isSetSuccess();
2198
      case PEX:
2199
        return isSetPex();
2200
      }
2201
      throw new IllegalStateException();
2202
    }
2203
 
2204
    public boolean isSet(int fieldID) {
2205
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
2206
    }
2207
 
2208
    @Override
2209
    public boolean equals(Object that) {
2210
      if (that == null)
2211
        return false;
2212
      if (that instanceof getAllPromotions_result)
2213
        return this.equals((getAllPromotions_result)that);
2214
      return false;
2215
    }
2216
 
2217
    public boolean equals(getAllPromotions_result that) {
2218
      if (that == null)
2219
        return false;
2220
 
2221
      boolean this_present_success = true && this.isSetSuccess();
2222
      boolean that_present_success = true && that.isSetSuccess();
2223
      if (this_present_success || that_present_success) {
2224
        if (!(this_present_success && that_present_success))
2225
          return false;
2226
        if (!this.success.equals(that.success))
2227
          return false;
2228
      }
2229
 
2230
      boolean this_present_pex = true && this.isSetPex();
2231
      boolean that_present_pex = true && that.isSetPex();
2232
      if (this_present_pex || that_present_pex) {
2233
        if (!(this_present_pex && that_present_pex))
2234
          return false;
2235
        if (!this.pex.equals(that.pex))
2236
          return false;
2237
      }
2238
 
2239
      return true;
2240
    }
2241
 
2242
    @Override
2243
    public int hashCode() {
2244
      return 0;
2245
    }
2246
 
2247
    public int compareTo(getAllPromotions_result other) {
2248
      if (!getClass().equals(other.getClass())) {
2249
        return getClass().getName().compareTo(other.getClass().getName());
2250
      }
2251
 
2252
      int lastComparison = 0;
2253
      getAllPromotions_result typedOther = (getAllPromotions_result)other;
2254
 
2255
      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
2256
      if (lastComparison != 0) {
2257
        return lastComparison;
2258
      }
2259
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
2260
      if (lastComparison != 0) {
2261
        return lastComparison;
2262
      }
2263
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
2264
      if (lastComparison != 0) {
2265
        return lastComparison;
2266
      }
2267
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
2268
      if (lastComparison != 0) {
2269
        return lastComparison;
2270
      }
2271
      return 0;
2272
    }
2273
 
2274
    public void read(TProtocol iprot) throws TException {
2275
      TField field;
2276
      iprot.readStructBegin();
2277
      while (true)
2278
      {
2279
        field = iprot.readFieldBegin();
2280
        if (field.type == TType.STOP) { 
2281
          break;
2282
        }
2283
        _Fields fieldId = _Fields.findByThriftId(field.id);
2284
        if (fieldId == null) {
2285
          TProtocolUtil.skip(iprot, field.type);
2286
        } else {
2287
          switch (fieldId) {
2288
            case SUCCESS:
2289
              if (field.type == TType.LIST) {
2290
                {
2981 rajveer 2291
                  TList _list12 = iprot.readListBegin();
2292
                  this.success = new ArrayList<Promotion>(_list12.size);
2293
                  for (int _i13 = 0; _i13 < _list12.size; ++_i13)
1982 varun.gupt 2294
                  {
2981 rajveer 2295
                    Promotion _elem14;
2296
                    _elem14 = new Promotion();
2297
                    _elem14.read(iprot);
2298
                    this.success.add(_elem14);
1982 varun.gupt 2299
                  }
2300
                  iprot.readListEnd();
2301
                }
2302
              } else { 
2303
                TProtocolUtil.skip(iprot, field.type);
2304
              }
2305
              break;
2306
            case PEX:
2307
              if (field.type == TType.STRUCT) {
2308
                this.pex = new PromotionException();
2309
                this.pex.read(iprot);
2310
              } else { 
2311
                TProtocolUtil.skip(iprot, field.type);
2312
              }
2313
              break;
2314
          }
2315
          iprot.readFieldEnd();
2316
        }
2317
      }
2318
      iprot.readStructEnd();
2319
      validate();
2320
    }
2321
 
2322
    public void write(TProtocol oprot) throws TException {
2323
      oprot.writeStructBegin(STRUCT_DESC);
2324
 
2325
      if (this.isSetSuccess()) {
2326
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
2327
        {
2328
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
2981 rajveer 2329
          for (Promotion _iter15 : this.success)
1982 varun.gupt 2330
          {
2981 rajveer 2331
            _iter15.write(oprot);
1982 varun.gupt 2332
          }
2333
          oprot.writeListEnd();
2334
        }
2335
        oprot.writeFieldEnd();
2336
      } else if (this.isSetPex()) {
2337
        oprot.writeFieldBegin(PEX_FIELD_DESC);
2338
        this.pex.write(oprot);
2339
        oprot.writeFieldEnd();
2340
      }
2341
      oprot.writeFieldStop();
2342
      oprot.writeStructEnd();
2343
    }
2344
 
2345
    @Override
2346
    public String toString() {
2347
      StringBuilder sb = new StringBuilder("getAllPromotions_result(");
2348
      boolean first = true;
2349
 
2350
      sb.append("success:");
2351
      if (this.success == null) {
2352
        sb.append("null");
2353
      } else {
2354
        sb.append(this.success);
2355
      }
2356
      first = false;
2357
      if (!first) sb.append(", ");
2358
      sb.append("pex:");
2359
      if (this.pex == null) {
2360
        sb.append("null");
2361
      } else {
2362
        sb.append(this.pex);
2363
      }
2364
      first = false;
2365
      sb.append(")");
2366
      return sb.toString();
2367
    }
2368
 
2369
    public void validate() throws TException {
2370
      // check for required fields
2371
    }
2372
 
2373
  }
2374
 
2375
  public static class getPromotionById_args implements TBase<getPromotionById_args._Fields>, java.io.Serializable, Cloneable, Comparable<getPromotionById_args>   {
2376
    private static final TStruct STRUCT_DESC = new TStruct("getPromotionById_args");
2377
 
2378
    private static final TField PROMOTION_ID_FIELD_DESC = new TField("promotionId", TType.I64, (short)1);
2379
 
2380
    private long promotionId;
2381
 
2382
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
2383
    public enum _Fields implements TFieldIdEnum {
2384
      PROMOTION_ID((short)1, "promotionId");
2385
 
2386
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
2387
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
2388
 
2389
      static {
2390
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
2391
          byId.put((int)field._thriftId, field);
2392
          byName.put(field.getFieldName(), field);
2393
        }
2394
      }
2395
 
2396
      /**
2397
       * Find the _Fields constant that matches fieldId, or null if its not found.
2398
       */
2399
      public static _Fields findByThriftId(int fieldId) {
2400
        return byId.get(fieldId);
2401
      }
2402
 
2403
      /**
2404
       * Find the _Fields constant that matches fieldId, throwing an exception
2405
       * if it is not found.
2406
       */
2407
      public static _Fields findByThriftIdOrThrow(int fieldId) {
2408
        _Fields fields = findByThriftId(fieldId);
2409
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
2410
        return fields;
2411
      }
2412
 
2413
      /**
2414
       * Find the _Fields constant that matches name, or null if its not found.
2415
       */
2416
      public static _Fields findByName(String name) {
2417
        return byName.get(name);
2418
      }
2419
 
2420
      private final short _thriftId;
2421
      private final String _fieldName;
2422
 
2423
      _Fields(short thriftId, String fieldName) {
2424
        _thriftId = thriftId;
2425
        _fieldName = fieldName;
2426
      }
2427
 
2428
      public short getThriftFieldId() {
2429
        return _thriftId;
2430
      }
2431
 
2432
      public String getFieldName() {
2433
        return _fieldName;
2434
      }
2435
    }
2436
 
2437
    // isset id assignments
2438
    private static final int __PROMOTIONID_ISSET_ID = 0;
2439
    private BitSet __isset_bit_vector = new BitSet(1);
2440
 
2441
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
2442
      put(_Fields.PROMOTION_ID, new FieldMetaData("promotionId", TFieldRequirementType.DEFAULT, 
2443
          new FieldValueMetaData(TType.I64)));
2444
    }});
2445
 
2446
    static {
2447
      FieldMetaData.addStructMetaDataMap(getPromotionById_args.class, metaDataMap);
2448
    }
2449
 
2450
    public getPromotionById_args() {
2451
    }
2452
 
2453
    public getPromotionById_args(
2454
      long promotionId)
2455
    {
2456
      this();
2457
      this.promotionId = promotionId;
2458
      setPromotionIdIsSet(true);
2459
    }
2460
 
2461
    /**
2462
     * Performs a deep copy on <i>other</i>.
2463
     */
2464
    public getPromotionById_args(getPromotionById_args other) {
2465
      __isset_bit_vector.clear();
2466
      __isset_bit_vector.or(other.__isset_bit_vector);
2467
      this.promotionId = other.promotionId;
2468
    }
2469
 
2470
    public getPromotionById_args deepCopy() {
2471
      return new getPromotionById_args(this);
2472
    }
2473
 
2474
    @Deprecated
2475
    public getPromotionById_args clone() {
2476
      return new getPromotionById_args(this);
2477
    }
2478
 
2479
    public long getPromotionId() {
2480
      return this.promotionId;
2481
    }
2482
 
2483
    public getPromotionById_args setPromotionId(long promotionId) {
2484
      this.promotionId = promotionId;
2485
      setPromotionIdIsSet(true);
2486
      return this;
2487
    }
2488
 
2489
    public void unsetPromotionId() {
2490
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
2491
    }
2492
 
2493
    /** Returns true if field promotionId is set (has been asigned a value) and false otherwise */
2494
    public boolean isSetPromotionId() {
2495
      return __isset_bit_vector.get(__PROMOTIONID_ISSET_ID);
2496
    }
2497
 
2498
    public void setPromotionIdIsSet(boolean value) {
2499
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
2500
    }
2501
 
2502
    public void setFieldValue(_Fields field, Object value) {
2503
      switch (field) {
2504
      case PROMOTION_ID:
2505
        if (value == null) {
2506
          unsetPromotionId();
2507
        } else {
2508
          setPromotionId((Long)value);
2509
        }
2510
        break;
2511
 
2512
      }
2513
    }
2514
 
2515
    public void setFieldValue(int fieldID, Object value) {
2516
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
2517
    }
2518
 
2519
    public Object getFieldValue(_Fields field) {
2520
      switch (field) {
2521
      case PROMOTION_ID:
2522
        return new Long(getPromotionId());
2523
 
2524
      }
2525
      throw new IllegalStateException();
2526
    }
2527
 
2528
    public Object getFieldValue(int fieldId) {
2529
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
2530
    }
2531
 
2532
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
2533
    public boolean isSet(_Fields field) {
2534
      switch (field) {
2535
      case PROMOTION_ID:
2536
        return isSetPromotionId();
2537
      }
2538
      throw new IllegalStateException();
2539
    }
2540
 
2541
    public boolean isSet(int fieldID) {
2542
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
2543
    }
2544
 
2545
    @Override
2546
    public boolean equals(Object that) {
2547
      if (that == null)
2548
        return false;
2549
      if (that instanceof getPromotionById_args)
2550
        return this.equals((getPromotionById_args)that);
2551
      return false;
2552
    }
2553
 
2554
    public boolean equals(getPromotionById_args that) {
2555
      if (that == null)
2556
        return false;
2557
 
2558
      boolean this_present_promotionId = true;
2559
      boolean that_present_promotionId = true;
2560
      if (this_present_promotionId || that_present_promotionId) {
2561
        if (!(this_present_promotionId && that_present_promotionId))
2562
          return false;
2563
        if (this.promotionId != that.promotionId)
2564
          return false;
2565
      }
2566
 
2567
      return true;
2568
    }
2569
 
2570
    @Override
2571
    public int hashCode() {
2572
      return 0;
2573
    }
2574
 
2575
    public int compareTo(getPromotionById_args other) {
2576
      if (!getClass().equals(other.getClass())) {
2577
        return getClass().getName().compareTo(other.getClass().getName());
2578
      }
2579
 
2580
      int lastComparison = 0;
2581
      getPromotionById_args typedOther = (getPromotionById_args)other;
2582
 
2583
      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(isSetPromotionId());
2584
      if (lastComparison != 0) {
2585
        return lastComparison;
2586
      }
2587
      lastComparison = TBaseHelper.compareTo(promotionId, typedOther.promotionId);
2588
      if (lastComparison != 0) {
2589
        return lastComparison;
2590
      }
2591
      return 0;
2592
    }
2593
 
2594
    public void read(TProtocol iprot) throws TException {
2595
      TField field;
2596
      iprot.readStructBegin();
2597
      while (true)
2598
      {
2599
        field = iprot.readFieldBegin();
2600
        if (field.type == TType.STOP) { 
2601
          break;
2602
        }
2603
        _Fields fieldId = _Fields.findByThriftId(field.id);
2604
        if (fieldId == null) {
2605
          TProtocolUtil.skip(iprot, field.type);
2606
        } else {
2607
          switch (fieldId) {
2608
            case PROMOTION_ID:
2609
              if (field.type == TType.I64) {
2610
                this.promotionId = iprot.readI64();
2611
                setPromotionIdIsSet(true);
2612
              } else { 
2613
                TProtocolUtil.skip(iprot, field.type);
2614
              }
2615
              break;
2616
          }
2617
          iprot.readFieldEnd();
2618
        }
2619
      }
2620
      iprot.readStructEnd();
2621
      validate();
2622
    }
2623
 
2624
    public void write(TProtocol oprot) throws TException {
2625
      validate();
2626
 
2627
      oprot.writeStructBegin(STRUCT_DESC);
2628
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
2629
      oprot.writeI64(this.promotionId);
2630
      oprot.writeFieldEnd();
2631
      oprot.writeFieldStop();
2632
      oprot.writeStructEnd();
2633
    }
2634
 
2635
    @Override
2636
    public String toString() {
2637
      StringBuilder sb = new StringBuilder("getPromotionById_args(");
2638
      boolean first = true;
2639
 
2640
      sb.append("promotionId:");
2641
      sb.append(this.promotionId);
2642
      first = false;
2643
      sb.append(")");
2644
      return sb.toString();
2645
    }
2646
 
2647
    public void validate() throws TException {
2648
      // check for required fields
2649
    }
2650
 
2651
  }
2652
 
2653
  public static class getPromotionById_result implements TBase<getPromotionById_result._Fields>, java.io.Serializable, Cloneable, Comparable<getPromotionById_result>   {
2654
    private static final TStruct STRUCT_DESC = new TStruct("getPromotionById_result");
2655
 
2656
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
2657
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
2658
 
2659
    private Promotion success;
2660
    private PromotionException pex;
2661
 
2662
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
2663
    public enum _Fields implements TFieldIdEnum {
2664
      SUCCESS((short)0, "success"),
2665
      PEX((short)1, "pex");
2666
 
2667
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
2668
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
2669
 
2670
      static {
2671
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
2672
          byId.put((int)field._thriftId, field);
2673
          byName.put(field.getFieldName(), field);
2674
        }
2675
      }
2676
 
2677
      /**
2678
       * Find the _Fields constant that matches fieldId, or null if its not found.
2679
       */
2680
      public static _Fields findByThriftId(int fieldId) {
2681
        return byId.get(fieldId);
2682
      }
2683
 
2684
      /**
2685
       * Find the _Fields constant that matches fieldId, throwing an exception
2686
       * if it is not found.
2687
       */
2688
      public static _Fields findByThriftIdOrThrow(int fieldId) {
2689
        _Fields fields = findByThriftId(fieldId);
2690
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
2691
        return fields;
2692
      }
2693
 
2694
      /**
2695
       * Find the _Fields constant that matches name, or null if its not found.
2696
       */
2697
      public static _Fields findByName(String name) {
2698
        return byName.get(name);
2699
      }
2700
 
2701
      private final short _thriftId;
2702
      private final String _fieldName;
2703
 
2704
      _Fields(short thriftId, String fieldName) {
2705
        _thriftId = thriftId;
2706
        _fieldName = fieldName;
2707
      }
2708
 
2709
      public short getThriftFieldId() {
2710
        return _thriftId;
2711
      }
2712
 
2713
      public String getFieldName() {
2714
        return _fieldName;
2715
      }
2716
    }
2717
 
2718
    // isset id assignments
2719
 
2720
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
2721
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
2722
          new StructMetaData(TType.STRUCT, Promotion.class)));
2723
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
2724
          new FieldValueMetaData(TType.STRUCT)));
2725
    }});
2726
 
2727
    static {
2728
      FieldMetaData.addStructMetaDataMap(getPromotionById_result.class, metaDataMap);
2729
    }
2730
 
2731
    public getPromotionById_result() {
2732
    }
2733
 
2734
    public getPromotionById_result(
2735
      Promotion success,
2736
      PromotionException pex)
2737
    {
2738
      this();
2739
      this.success = success;
2740
      this.pex = pex;
2741
    }
2742
 
2743
    /**
2744
     * Performs a deep copy on <i>other</i>.
2745
     */
2746
    public getPromotionById_result(getPromotionById_result other) {
2747
      if (other.isSetSuccess()) {
2748
        this.success = new Promotion(other.success);
2749
      }
2750
      if (other.isSetPex()) {
2751
        this.pex = new PromotionException(other.pex);
2752
      }
2753
    }
2754
 
2755
    public getPromotionById_result deepCopy() {
2756
      return new getPromotionById_result(this);
2757
    }
2758
 
2759
    @Deprecated
2760
    public getPromotionById_result clone() {
2761
      return new getPromotionById_result(this);
2762
    }
2763
 
2764
    public Promotion getSuccess() {
2765
      return this.success;
2766
    }
2767
 
2768
    public getPromotionById_result setSuccess(Promotion success) {
2769
      this.success = success;
2770
      return this;
2771
    }
2772
 
2773
    public void unsetSuccess() {
2774
      this.success = null;
2775
    }
2776
 
2777
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
2778
    public boolean isSetSuccess() {
2779
      return this.success != null;
2780
    }
2781
 
2782
    public void setSuccessIsSet(boolean value) {
2783
      if (!value) {
2784
        this.success = null;
2785
      }
2786
    }
2787
 
2788
    public PromotionException getPex() {
2789
      return this.pex;
2790
    }
2791
 
2792
    public getPromotionById_result setPex(PromotionException pex) {
2793
      this.pex = pex;
2794
      return this;
2795
    }
2796
 
2797
    public void unsetPex() {
2798
      this.pex = null;
2799
    }
2800
 
2801
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
2802
    public boolean isSetPex() {
2803
      return this.pex != null;
2804
    }
2805
 
2806
    public void setPexIsSet(boolean value) {
2807
      if (!value) {
2808
        this.pex = null;
2809
      }
2810
    }
2811
 
2812
    public void setFieldValue(_Fields field, Object value) {
2813
      switch (field) {
2814
      case SUCCESS:
2815
        if (value == null) {
2816
          unsetSuccess();
2817
        } else {
2818
          setSuccess((Promotion)value);
2819
        }
2820
        break;
2821
 
2822
      case PEX:
2823
        if (value == null) {
2824
          unsetPex();
2825
        } else {
2826
          setPex((PromotionException)value);
2827
        }
2828
        break;
2829
 
2830
      }
2831
    }
2832
 
2833
    public void setFieldValue(int fieldID, Object value) {
2834
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
2835
    }
2836
 
2837
    public Object getFieldValue(_Fields field) {
2838
      switch (field) {
2839
      case SUCCESS:
2840
        return getSuccess();
2841
 
2842
      case PEX:
2843
        return getPex();
2844
 
2845
      }
2846
      throw new IllegalStateException();
2847
    }
2848
 
2849
    public Object getFieldValue(int fieldId) {
2850
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
2851
    }
2852
 
2853
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
2854
    public boolean isSet(_Fields field) {
2855
      switch (field) {
2856
      case SUCCESS:
2857
        return isSetSuccess();
2858
      case PEX:
2859
        return isSetPex();
2860
      }
2861
      throw new IllegalStateException();
2862
    }
2863
 
2864
    public boolean isSet(int fieldID) {
2865
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
2866
    }
2867
 
2868
    @Override
2869
    public boolean equals(Object that) {
2870
      if (that == null)
2871
        return false;
2872
      if (that instanceof getPromotionById_result)
2873
        return this.equals((getPromotionById_result)that);
2874
      return false;
2875
    }
2876
 
2877
    public boolean equals(getPromotionById_result that) {
2878
      if (that == null)
2879
        return false;
2880
 
2881
      boolean this_present_success = true && this.isSetSuccess();
2882
      boolean that_present_success = true && that.isSetSuccess();
2883
      if (this_present_success || that_present_success) {
2884
        if (!(this_present_success && that_present_success))
2885
          return false;
2886
        if (!this.success.equals(that.success))
2887
          return false;
2888
      }
2889
 
2890
      boolean this_present_pex = true && this.isSetPex();
2891
      boolean that_present_pex = true && that.isSetPex();
2892
      if (this_present_pex || that_present_pex) {
2893
        if (!(this_present_pex && that_present_pex))
2894
          return false;
2895
        if (!this.pex.equals(that.pex))
2896
          return false;
2897
      }
2898
 
2899
      return true;
2900
    }
2901
 
2902
    @Override
2903
    public int hashCode() {
2904
      return 0;
2905
    }
2906
 
2907
    public int compareTo(getPromotionById_result other) {
2908
      if (!getClass().equals(other.getClass())) {
2909
        return getClass().getName().compareTo(other.getClass().getName());
2910
      }
2911
 
2912
      int lastComparison = 0;
2913
      getPromotionById_result typedOther = (getPromotionById_result)other;
2914
 
2915
      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
2916
      if (lastComparison != 0) {
2917
        return lastComparison;
2918
      }
2919
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
2920
      if (lastComparison != 0) {
2921
        return lastComparison;
2922
      }
2923
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
2924
      if (lastComparison != 0) {
2925
        return lastComparison;
2926
      }
2927
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
2928
      if (lastComparison != 0) {
2929
        return lastComparison;
2930
      }
2931
      return 0;
2932
    }
2933
 
2934
    public void read(TProtocol iprot) throws TException {
2935
      TField field;
2936
      iprot.readStructBegin();
2937
      while (true)
2938
      {
2939
        field = iprot.readFieldBegin();
2940
        if (field.type == TType.STOP) { 
2941
          break;
2942
        }
2943
        _Fields fieldId = _Fields.findByThriftId(field.id);
2944
        if (fieldId == null) {
2945
          TProtocolUtil.skip(iprot, field.type);
2946
        } else {
2947
          switch (fieldId) {
2948
            case SUCCESS:
2949
              if (field.type == TType.STRUCT) {
2950
                this.success = new Promotion();
2951
                this.success.read(iprot);
2952
              } else { 
2953
                TProtocolUtil.skip(iprot, field.type);
2954
              }
2955
              break;
2956
            case PEX:
2957
              if (field.type == TType.STRUCT) {
2958
                this.pex = new PromotionException();
2959
                this.pex.read(iprot);
2960
              } else { 
2961
                TProtocolUtil.skip(iprot, field.type);
2962
              }
2963
              break;
2964
          }
2965
          iprot.readFieldEnd();
2966
        }
2967
      }
2968
      iprot.readStructEnd();
2969
      validate();
2970
    }
2971
 
2972
    public void write(TProtocol oprot) throws TException {
2973
      oprot.writeStructBegin(STRUCT_DESC);
2974
 
2975
      if (this.isSetSuccess()) {
2976
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
2977
        this.success.write(oprot);
2978
        oprot.writeFieldEnd();
2979
      } else if (this.isSetPex()) {
2980
        oprot.writeFieldBegin(PEX_FIELD_DESC);
2981
        this.pex.write(oprot);
2982
        oprot.writeFieldEnd();
2983
      }
2984
      oprot.writeFieldStop();
2985
      oprot.writeStructEnd();
2986
    }
2987
 
2988
    @Override
2989
    public String toString() {
2990
      StringBuilder sb = new StringBuilder("getPromotionById_result(");
2991
      boolean first = true;
2992
 
2993
      sb.append("success:");
2994
      if (this.success == null) {
2995
        sb.append("null");
2996
      } else {
2997
        sb.append(this.success);
2998
      }
2999
      first = false;
3000
      if (!first) sb.append(", ");
3001
      sb.append("pex:");
3002
      if (this.pex == null) {
3003
        sb.append("null");
3004
      } else {
3005
        sb.append(this.pex);
3006
      }
3007
      first = false;
3008
      sb.append(")");
3009
      return sb.toString();
3010
    }
3011
 
3012
    public void validate() throws TException {
3013
      // check for required fields
3014
    }
3015
 
3016
  }
3017
 
3018
  public static class generateCouponsForPromotion_args implements TBase<generateCouponsForPromotion_args._Fields>, java.io.Serializable, Cloneable, Comparable<generateCouponsForPromotion_args>   {
3019
    private static final TStruct STRUCT_DESC = new TStruct("generateCouponsForPromotion_args");
3020
 
3021
    private static final TField PROMOTION_ID_FIELD_DESC = new TField("promotionId", TType.I64, (short)1);
3022
    private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)2);
3023
 
3024
    private long promotionId;
3025
    private String couponCode;
3026
 
3027
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3028
    public enum _Fields implements TFieldIdEnum {
3029
      PROMOTION_ID((short)1, "promotionId"),
3030
      COUPON_CODE((short)2, "couponCode");
3031
 
3032
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
3033
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
3034
 
3035
      static {
3036
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
3037
          byId.put((int)field._thriftId, field);
3038
          byName.put(field.getFieldName(), field);
3039
        }
3040
      }
3041
 
3042
      /**
3043
       * Find the _Fields constant that matches fieldId, or null if its not found.
3044
       */
3045
      public static _Fields findByThriftId(int fieldId) {
3046
        return byId.get(fieldId);
3047
      }
3048
 
3049
      /**
3050
       * Find the _Fields constant that matches fieldId, throwing an exception
3051
       * if it is not found.
3052
       */
3053
      public static _Fields findByThriftIdOrThrow(int fieldId) {
3054
        _Fields fields = findByThriftId(fieldId);
3055
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
3056
        return fields;
3057
      }
3058
 
3059
      /**
3060
       * Find the _Fields constant that matches name, or null if its not found.
3061
       */
3062
      public static _Fields findByName(String name) {
3063
        return byName.get(name);
3064
      }
3065
 
3066
      private final short _thriftId;
3067
      private final String _fieldName;
3068
 
3069
      _Fields(short thriftId, String fieldName) {
3070
        _thriftId = thriftId;
3071
        _fieldName = fieldName;
3072
      }
3073
 
3074
      public short getThriftFieldId() {
3075
        return _thriftId;
3076
      }
3077
 
3078
      public String getFieldName() {
3079
        return _fieldName;
3080
      }
3081
    }
3082
 
3083
    // isset id assignments
3084
    private static final int __PROMOTIONID_ISSET_ID = 0;
3085
    private BitSet __isset_bit_vector = new BitSet(1);
3086
 
3087
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
3088
      put(_Fields.PROMOTION_ID, new FieldMetaData("promotionId", TFieldRequirementType.DEFAULT, 
3089
          new FieldValueMetaData(TType.I64)));
3090
      put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
3091
          new FieldValueMetaData(TType.STRING)));
3092
    }});
3093
 
3094
    static {
3095
      FieldMetaData.addStructMetaDataMap(generateCouponsForPromotion_args.class, metaDataMap);
3096
    }
3097
 
3098
    public generateCouponsForPromotion_args() {
3099
    }
3100
 
3101
    public generateCouponsForPromotion_args(
3102
      long promotionId,
3103
      String couponCode)
3104
    {
3105
      this();
3106
      this.promotionId = promotionId;
3107
      setPromotionIdIsSet(true);
3108
      this.couponCode = couponCode;
3109
    }
3110
 
3111
    /**
3112
     * Performs a deep copy on <i>other</i>.
3113
     */
3114
    public generateCouponsForPromotion_args(generateCouponsForPromotion_args other) {
3115
      __isset_bit_vector.clear();
3116
      __isset_bit_vector.or(other.__isset_bit_vector);
3117
      this.promotionId = other.promotionId;
3118
      if (other.isSetCouponCode()) {
3119
        this.couponCode = other.couponCode;
3120
      }
3121
    }
3122
 
3123
    public generateCouponsForPromotion_args deepCopy() {
3124
      return new generateCouponsForPromotion_args(this);
3125
    }
3126
 
3127
    @Deprecated
3128
    public generateCouponsForPromotion_args clone() {
3129
      return new generateCouponsForPromotion_args(this);
3130
    }
3131
 
3132
    public long getPromotionId() {
3133
      return this.promotionId;
3134
    }
3135
 
3136
    public generateCouponsForPromotion_args setPromotionId(long promotionId) {
3137
      this.promotionId = promotionId;
3138
      setPromotionIdIsSet(true);
3139
      return this;
3140
    }
3141
 
3142
    public void unsetPromotionId() {
3143
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
3144
    }
3145
 
3146
    /** Returns true if field promotionId is set (has been asigned a value) and false otherwise */
3147
    public boolean isSetPromotionId() {
3148
      return __isset_bit_vector.get(__PROMOTIONID_ISSET_ID);
3149
    }
3150
 
3151
    public void setPromotionIdIsSet(boolean value) {
3152
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
3153
    }
3154
 
3155
    public String getCouponCode() {
3156
      return this.couponCode;
3157
    }
3158
 
3159
    public generateCouponsForPromotion_args setCouponCode(String couponCode) {
3160
      this.couponCode = couponCode;
3161
      return this;
3162
    }
3163
 
3164
    public void unsetCouponCode() {
3165
      this.couponCode = null;
3166
    }
3167
 
3168
    /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
3169
    public boolean isSetCouponCode() {
3170
      return this.couponCode != null;
3171
    }
3172
 
3173
    public void setCouponCodeIsSet(boolean value) {
3174
      if (!value) {
3175
        this.couponCode = null;
3176
      }
3177
    }
3178
 
3179
    public void setFieldValue(_Fields field, Object value) {
3180
      switch (field) {
3181
      case PROMOTION_ID:
3182
        if (value == null) {
3183
          unsetPromotionId();
3184
        } else {
3185
          setPromotionId((Long)value);
3186
        }
3187
        break;
3188
 
3189
      case COUPON_CODE:
3190
        if (value == null) {
3191
          unsetCouponCode();
3192
        } else {
3193
          setCouponCode((String)value);
3194
        }
3195
        break;
3196
 
3197
      }
3198
    }
3199
 
3200
    public void setFieldValue(int fieldID, Object value) {
3201
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
3202
    }
3203
 
3204
    public Object getFieldValue(_Fields field) {
3205
      switch (field) {
3206
      case PROMOTION_ID:
3207
        return new Long(getPromotionId());
3208
 
3209
      case COUPON_CODE:
3210
        return getCouponCode();
3211
 
3212
      }
3213
      throw new IllegalStateException();
3214
    }
3215
 
3216
    public Object getFieldValue(int fieldId) {
3217
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
3218
    }
3219
 
3220
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
3221
    public boolean isSet(_Fields field) {
3222
      switch (field) {
3223
      case PROMOTION_ID:
3224
        return isSetPromotionId();
3225
      case COUPON_CODE:
3226
        return isSetCouponCode();
3227
      }
3228
      throw new IllegalStateException();
3229
    }
3230
 
3231
    public boolean isSet(int fieldID) {
3232
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
3233
    }
3234
 
3235
    @Override
3236
    public boolean equals(Object that) {
3237
      if (that == null)
3238
        return false;
3239
      if (that instanceof generateCouponsForPromotion_args)
3240
        return this.equals((generateCouponsForPromotion_args)that);
3241
      return false;
3242
    }
3243
 
3244
    public boolean equals(generateCouponsForPromotion_args that) {
3245
      if (that == null)
3246
        return false;
3247
 
3248
      boolean this_present_promotionId = true;
3249
      boolean that_present_promotionId = true;
3250
      if (this_present_promotionId || that_present_promotionId) {
3251
        if (!(this_present_promotionId && that_present_promotionId))
3252
          return false;
3253
        if (this.promotionId != that.promotionId)
3254
          return false;
3255
      }
3256
 
3257
      boolean this_present_couponCode = true && this.isSetCouponCode();
3258
      boolean that_present_couponCode = true && that.isSetCouponCode();
3259
      if (this_present_couponCode || that_present_couponCode) {
3260
        if (!(this_present_couponCode && that_present_couponCode))
3261
          return false;
3262
        if (!this.couponCode.equals(that.couponCode))
3263
          return false;
3264
      }
3265
 
3266
      return true;
3267
    }
3268
 
3269
    @Override
3270
    public int hashCode() {
3271
      return 0;
3272
    }
3273
 
3274
    public int compareTo(generateCouponsForPromotion_args other) {
3275
      if (!getClass().equals(other.getClass())) {
3276
        return getClass().getName().compareTo(other.getClass().getName());
3277
      }
3278
 
3279
      int lastComparison = 0;
3280
      generateCouponsForPromotion_args typedOther = (generateCouponsForPromotion_args)other;
3281
 
3282
      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(isSetPromotionId());
3283
      if (lastComparison != 0) {
3284
        return lastComparison;
3285
      }
3286
      lastComparison = TBaseHelper.compareTo(promotionId, typedOther.promotionId);
3287
      if (lastComparison != 0) {
3288
        return lastComparison;
3289
      }
3290
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
3291
      if (lastComparison != 0) {
3292
        return lastComparison;
3293
      }
3294
      lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
3295
      if (lastComparison != 0) {
3296
        return lastComparison;
3297
      }
3298
      return 0;
3299
    }
3300
 
3301
    public void read(TProtocol iprot) throws TException {
3302
      TField field;
3303
      iprot.readStructBegin();
3304
      while (true)
3305
      {
3306
        field = iprot.readFieldBegin();
3307
        if (field.type == TType.STOP) { 
3308
          break;
3309
        }
3310
        _Fields fieldId = _Fields.findByThriftId(field.id);
3311
        if (fieldId == null) {
3312
          TProtocolUtil.skip(iprot, field.type);
3313
        } else {
3314
          switch (fieldId) {
3315
            case PROMOTION_ID:
3316
              if (field.type == TType.I64) {
3317
                this.promotionId = iprot.readI64();
3318
                setPromotionIdIsSet(true);
3319
              } else { 
3320
                TProtocolUtil.skip(iprot, field.type);
3321
              }
3322
              break;
3323
            case COUPON_CODE:
3324
              if (field.type == TType.STRING) {
3325
                this.couponCode = iprot.readString();
3326
              } else { 
3327
                TProtocolUtil.skip(iprot, field.type);
3328
              }
3329
              break;
3330
          }
3331
          iprot.readFieldEnd();
3332
        }
3333
      }
3334
      iprot.readStructEnd();
3335
      validate();
3336
    }
3337
 
3338
    public void write(TProtocol oprot) throws TException {
3339
      validate();
3340
 
3341
      oprot.writeStructBegin(STRUCT_DESC);
3342
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
3343
      oprot.writeI64(this.promotionId);
3344
      oprot.writeFieldEnd();
3345
      if (this.couponCode != null) {
3346
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
3347
        oprot.writeString(this.couponCode);
3348
        oprot.writeFieldEnd();
3349
      }
3350
      oprot.writeFieldStop();
3351
      oprot.writeStructEnd();
3352
    }
3353
 
3354
    @Override
3355
    public String toString() {
3356
      StringBuilder sb = new StringBuilder("generateCouponsForPromotion_args(");
3357
      boolean first = true;
3358
 
3359
      sb.append("promotionId:");
3360
      sb.append(this.promotionId);
3361
      first = false;
3362
      if (!first) sb.append(", ");
3363
      sb.append("couponCode:");
3364
      if (this.couponCode == null) {
3365
        sb.append("null");
3366
      } else {
3367
        sb.append(this.couponCode);
3368
      }
3369
      first = false;
3370
      sb.append(")");
3371
      return sb.toString();
3372
    }
3373
 
3374
    public void validate() throws TException {
3375
      // check for required fields
3376
    }
3377
 
3378
  }
3379
 
3380
  public static class generateCouponsForPromotion_result implements TBase<generateCouponsForPromotion_result._Fields>, java.io.Serializable, Cloneable, Comparable<generateCouponsForPromotion_result>   {
3381
    private static final TStruct STRUCT_DESC = new TStruct("generateCouponsForPromotion_result");
3382
 
3383
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
3384
 
3385
    private PromotionException pex;
3386
 
3387
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3388
    public enum _Fields implements TFieldIdEnum {
3389
      PEX((short)1, "pex");
3390
 
3391
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
3392
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
3393
 
3394
      static {
3395
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
3396
          byId.put((int)field._thriftId, field);
3397
          byName.put(field.getFieldName(), field);
3398
        }
3399
      }
3400
 
3401
      /**
3402
       * Find the _Fields constant that matches fieldId, or null if its not found.
3403
       */
3404
      public static _Fields findByThriftId(int fieldId) {
3405
        return byId.get(fieldId);
3406
      }
3407
 
3408
      /**
3409
       * Find the _Fields constant that matches fieldId, throwing an exception
3410
       * if it is not found.
3411
       */
3412
      public static _Fields findByThriftIdOrThrow(int fieldId) {
3413
        _Fields fields = findByThriftId(fieldId);
3414
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
3415
        return fields;
3416
      }
3417
 
3418
      /**
3419
       * Find the _Fields constant that matches name, or null if its not found.
3420
       */
3421
      public static _Fields findByName(String name) {
3422
        return byName.get(name);
3423
      }
3424
 
3425
      private final short _thriftId;
3426
      private final String _fieldName;
3427
 
3428
      _Fields(short thriftId, String fieldName) {
3429
        _thriftId = thriftId;
3430
        _fieldName = fieldName;
3431
      }
3432
 
3433
      public short getThriftFieldId() {
3434
        return _thriftId;
3435
      }
3436
 
3437
      public String getFieldName() {
3438
        return _fieldName;
3439
      }
3440
    }
3441
 
3442
    // isset id assignments
3443
 
3444
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
3445
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
3446
          new FieldValueMetaData(TType.STRUCT)));
3447
    }});
3448
 
3449
    static {
3450
      FieldMetaData.addStructMetaDataMap(generateCouponsForPromotion_result.class, metaDataMap);
3451
    }
3452
 
3453
    public generateCouponsForPromotion_result() {
3454
    }
3455
 
3456
    public generateCouponsForPromotion_result(
3457
      PromotionException pex)
3458
    {
3459
      this();
3460
      this.pex = pex;
3461
    }
3462
 
3463
    /**
3464
     * Performs a deep copy on <i>other</i>.
3465
     */
3466
    public generateCouponsForPromotion_result(generateCouponsForPromotion_result other) {
3467
      if (other.isSetPex()) {
3468
        this.pex = new PromotionException(other.pex);
3469
      }
3470
    }
3471
 
3472
    public generateCouponsForPromotion_result deepCopy() {
3473
      return new generateCouponsForPromotion_result(this);
3474
    }
3475
 
3476
    @Deprecated
3477
    public generateCouponsForPromotion_result clone() {
3478
      return new generateCouponsForPromotion_result(this);
3479
    }
3480
 
3481
    public PromotionException getPex() {
3482
      return this.pex;
3483
    }
3484
 
3485
    public generateCouponsForPromotion_result setPex(PromotionException pex) {
3486
      this.pex = pex;
3487
      return this;
3488
    }
3489
 
3490
    public void unsetPex() {
3491
      this.pex = null;
3492
    }
3493
 
3494
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
3495
    public boolean isSetPex() {
3496
      return this.pex != null;
3497
    }
3498
 
3499
    public void setPexIsSet(boolean value) {
3500
      if (!value) {
3501
        this.pex = null;
3502
      }
3503
    }
3504
 
3505
    public void setFieldValue(_Fields field, Object value) {
3506
      switch (field) {
3507
      case PEX:
3508
        if (value == null) {
3509
          unsetPex();
3510
        } else {
3511
          setPex((PromotionException)value);
3512
        }
3513
        break;
3514
 
3515
      }
3516
    }
3517
 
3518
    public void setFieldValue(int fieldID, Object value) {
3519
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
3520
    }
3521
 
3522
    public Object getFieldValue(_Fields field) {
3523
      switch (field) {
3524
      case PEX:
3525
        return getPex();
3526
 
3527
      }
3528
      throw new IllegalStateException();
3529
    }
3530
 
3531
    public Object getFieldValue(int fieldId) {
3532
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
3533
    }
3534
 
3535
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
3536
    public boolean isSet(_Fields field) {
3537
      switch (field) {
3538
      case PEX:
3539
        return isSetPex();
3540
      }
3541
      throw new IllegalStateException();
3542
    }
3543
 
3544
    public boolean isSet(int fieldID) {
3545
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
3546
    }
3547
 
3548
    @Override
3549
    public boolean equals(Object that) {
3550
      if (that == null)
3551
        return false;
3552
      if (that instanceof generateCouponsForPromotion_result)
3553
        return this.equals((generateCouponsForPromotion_result)that);
3554
      return false;
3555
    }
3556
 
3557
    public boolean equals(generateCouponsForPromotion_result that) {
3558
      if (that == null)
3559
        return false;
3560
 
3561
      boolean this_present_pex = true && this.isSetPex();
3562
      boolean that_present_pex = true && that.isSetPex();
3563
      if (this_present_pex || that_present_pex) {
3564
        if (!(this_present_pex && that_present_pex))
3565
          return false;
3566
        if (!this.pex.equals(that.pex))
3567
          return false;
3568
      }
3569
 
3570
      return true;
3571
    }
3572
 
3573
    @Override
3574
    public int hashCode() {
3575
      return 0;
3576
    }
3577
 
3578
    public int compareTo(generateCouponsForPromotion_result other) {
3579
      if (!getClass().equals(other.getClass())) {
3580
        return getClass().getName().compareTo(other.getClass().getName());
3581
      }
3582
 
3583
      int lastComparison = 0;
3584
      generateCouponsForPromotion_result typedOther = (generateCouponsForPromotion_result)other;
3585
 
3586
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
3587
      if (lastComparison != 0) {
3588
        return lastComparison;
3589
      }
3590
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
3591
      if (lastComparison != 0) {
3592
        return lastComparison;
3593
      }
3594
      return 0;
3595
    }
3596
 
3597
    public void read(TProtocol iprot) throws TException {
3598
      TField field;
3599
      iprot.readStructBegin();
3600
      while (true)
3601
      {
3602
        field = iprot.readFieldBegin();
3603
        if (field.type == TType.STOP) { 
3604
          break;
3605
        }
3606
        _Fields fieldId = _Fields.findByThriftId(field.id);
3607
        if (fieldId == null) {
3608
          TProtocolUtil.skip(iprot, field.type);
3609
        } else {
3610
          switch (fieldId) {
3611
            case PEX:
3612
              if (field.type == TType.STRUCT) {
3613
                this.pex = new PromotionException();
3614
                this.pex.read(iprot);
3615
              } else { 
3616
                TProtocolUtil.skip(iprot, field.type);
3617
              }
3618
              break;
3619
          }
3620
          iprot.readFieldEnd();
3621
        }
3622
      }
3623
      iprot.readStructEnd();
3624
      validate();
3625
    }
3626
 
3627
    public void write(TProtocol oprot) throws TException {
3628
      oprot.writeStructBegin(STRUCT_DESC);
3629
 
3630
      if (this.isSetPex()) {
3631
        oprot.writeFieldBegin(PEX_FIELD_DESC);
3632
        this.pex.write(oprot);
3633
        oprot.writeFieldEnd();
3634
      }
3635
      oprot.writeFieldStop();
3636
      oprot.writeStructEnd();
3637
    }
3638
 
3639
    @Override
3640
    public String toString() {
3641
      StringBuilder sb = new StringBuilder("generateCouponsForPromotion_result(");
3642
      boolean first = true;
3643
 
3644
      sb.append("pex:");
3645
      if (this.pex == null) {
3646
        sb.append("null");
3647
      } else {
3648
        sb.append(this.pex);
3649
      }
3650
      first = false;
3651
      sb.append(")");
3652
      return sb.toString();
3653
    }
3654
 
3655
    public void validate() throws TException {
3656
      // check for required fields
3657
    }
3658
 
3659
  }
3660
 
3661
  public static class applyCoupon_args implements TBase<applyCoupon_args._Fields>, java.io.Serializable, Cloneable, Comparable<applyCoupon_args>   {
3662
    private static final TStruct STRUCT_DESC = new TStruct("applyCoupon_args");
3663
 
3664
    private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
3665
    private static final TField CART_ID_FIELD_DESC = new TField("cartId", TType.I64, (short)2);
3666
 
3667
    private String couponCode;
3668
    private long cartId;
3669
 
3670
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3671
    public enum _Fields implements TFieldIdEnum {
3672
      COUPON_CODE((short)1, "couponCode"),
3673
      CART_ID((short)2, "cartId");
3674
 
3675
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
3676
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
3677
 
3678
      static {
3679
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
3680
          byId.put((int)field._thriftId, field);
3681
          byName.put(field.getFieldName(), field);
3682
        }
3683
      }
3684
 
3685
      /**
3686
       * Find the _Fields constant that matches fieldId, or null if its not found.
3687
       */
3688
      public static _Fields findByThriftId(int fieldId) {
3689
        return byId.get(fieldId);
3690
      }
3691
 
3692
      /**
3693
       * Find the _Fields constant that matches fieldId, throwing an exception
3694
       * if it is not found.
3695
       */
3696
      public static _Fields findByThriftIdOrThrow(int fieldId) {
3697
        _Fields fields = findByThriftId(fieldId);
3698
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
3699
        return fields;
3700
      }
3701
 
3702
      /**
3703
       * Find the _Fields constant that matches name, or null if its not found.
3704
       */
3705
      public static _Fields findByName(String name) {
3706
        return byName.get(name);
3707
      }
3708
 
3709
      private final short _thriftId;
3710
      private final String _fieldName;
3711
 
3712
      _Fields(short thriftId, String fieldName) {
3713
        _thriftId = thriftId;
3714
        _fieldName = fieldName;
3715
      }
3716
 
3717
      public short getThriftFieldId() {
3718
        return _thriftId;
3719
      }
3720
 
3721
      public String getFieldName() {
3722
        return _fieldName;
3723
      }
3724
    }
3725
 
3726
    // isset id assignments
3727
    private static final int __CARTID_ISSET_ID = 0;
3728
    private BitSet __isset_bit_vector = new BitSet(1);
3729
 
3730
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
3731
      put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
3732
          new FieldValueMetaData(TType.STRING)));
3733
      put(_Fields.CART_ID, new FieldMetaData("cartId", TFieldRequirementType.DEFAULT, 
3734
          new FieldValueMetaData(TType.I64)));
3735
    }});
3736
 
3737
    static {
3738
      FieldMetaData.addStructMetaDataMap(applyCoupon_args.class, metaDataMap);
3739
    }
3740
 
3741
    public applyCoupon_args() {
3742
    }
3743
 
3744
    public applyCoupon_args(
3745
      String couponCode,
3746
      long cartId)
3747
    {
3748
      this();
3749
      this.couponCode = couponCode;
3750
      this.cartId = cartId;
3751
      setCartIdIsSet(true);
3752
    }
3753
 
3754
    /**
3755
     * Performs a deep copy on <i>other</i>.
3756
     */
3757
    public applyCoupon_args(applyCoupon_args other) {
3758
      __isset_bit_vector.clear();
3759
      __isset_bit_vector.or(other.__isset_bit_vector);
3760
      if (other.isSetCouponCode()) {
3761
        this.couponCode = other.couponCode;
3762
      }
3763
      this.cartId = other.cartId;
3764
    }
3765
 
3766
    public applyCoupon_args deepCopy() {
3767
      return new applyCoupon_args(this);
3768
    }
3769
 
3770
    @Deprecated
3771
    public applyCoupon_args clone() {
3772
      return new applyCoupon_args(this);
3773
    }
3774
 
3775
    public String getCouponCode() {
3776
      return this.couponCode;
3777
    }
3778
 
3779
    public applyCoupon_args setCouponCode(String couponCode) {
3780
      this.couponCode = couponCode;
3781
      return this;
3782
    }
3783
 
3784
    public void unsetCouponCode() {
3785
      this.couponCode = null;
3786
    }
3787
 
3788
    /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
3789
    public boolean isSetCouponCode() {
3790
      return this.couponCode != null;
3791
    }
3792
 
3793
    public void setCouponCodeIsSet(boolean value) {
3794
      if (!value) {
3795
        this.couponCode = null;
3796
      }
3797
    }
3798
 
3799
    public long getCartId() {
3800
      return this.cartId;
3801
    }
3802
 
3803
    public applyCoupon_args setCartId(long cartId) {
3804
      this.cartId = cartId;
3805
      setCartIdIsSet(true);
3806
      return this;
3807
    }
3808
 
3809
    public void unsetCartId() {
3810
      __isset_bit_vector.clear(__CARTID_ISSET_ID);
3811
    }
3812
 
3813
    /** Returns true if field cartId is set (has been asigned a value) and false otherwise */
3814
    public boolean isSetCartId() {
3815
      return __isset_bit_vector.get(__CARTID_ISSET_ID);
3816
    }
3817
 
3818
    public void setCartIdIsSet(boolean value) {
3819
      __isset_bit_vector.set(__CARTID_ISSET_ID, value);
3820
    }
3821
 
3822
    public void setFieldValue(_Fields field, Object value) {
3823
      switch (field) {
3824
      case COUPON_CODE:
3825
        if (value == null) {
3826
          unsetCouponCode();
3827
        } else {
3828
          setCouponCode((String)value);
3829
        }
3830
        break;
3831
 
3832
      case CART_ID:
3833
        if (value == null) {
3834
          unsetCartId();
3835
        } else {
3836
          setCartId((Long)value);
3837
        }
3838
        break;
3839
 
3840
      }
3841
    }
3842
 
3843
    public void setFieldValue(int fieldID, Object value) {
3844
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
3845
    }
3846
 
3847
    public Object getFieldValue(_Fields field) {
3848
      switch (field) {
3849
      case COUPON_CODE:
3850
        return getCouponCode();
3851
 
3852
      case CART_ID:
3853
        return new Long(getCartId());
3854
 
3855
      }
3856
      throw new IllegalStateException();
3857
    }
3858
 
3859
    public Object getFieldValue(int fieldId) {
3860
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
3861
    }
3862
 
3863
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
3864
    public boolean isSet(_Fields field) {
3865
      switch (field) {
3866
      case COUPON_CODE:
3867
        return isSetCouponCode();
3868
      case CART_ID:
3869
        return isSetCartId();
3870
      }
3871
      throw new IllegalStateException();
3872
    }
3873
 
3874
    public boolean isSet(int fieldID) {
3875
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
3876
    }
3877
 
3878
    @Override
3879
    public boolean equals(Object that) {
3880
      if (that == null)
3881
        return false;
3882
      if (that instanceof applyCoupon_args)
3883
        return this.equals((applyCoupon_args)that);
3884
      return false;
3885
    }
3886
 
3887
    public boolean equals(applyCoupon_args that) {
3888
      if (that == null)
3889
        return false;
3890
 
3891
      boolean this_present_couponCode = true && this.isSetCouponCode();
3892
      boolean that_present_couponCode = true && that.isSetCouponCode();
3893
      if (this_present_couponCode || that_present_couponCode) {
3894
        if (!(this_present_couponCode && that_present_couponCode))
3895
          return false;
3896
        if (!this.couponCode.equals(that.couponCode))
3897
          return false;
3898
      }
3899
 
3900
      boolean this_present_cartId = true;
3901
      boolean that_present_cartId = true;
3902
      if (this_present_cartId || that_present_cartId) {
3903
        if (!(this_present_cartId && that_present_cartId))
3904
          return false;
3905
        if (this.cartId != that.cartId)
3906
          return false;
3907
      }
3908
 
3909
      return true;
3910
    }
3911
 
3912
    @Override
3913
    public int hashCode() {
3914
      return 0;
3915
    }
3916
 
3917
    public int compareTo(applyCoupon_args other) {
3918
      if (!getClass().equals(other.getClass())) {
3919
        return getClass().getName().compareTo(other.getClass().getName());
3920
      }
3921
 
3922
      int lastComparison = 0;
3923
      applyCoupon_args typedOther = (applyCoupon_args)other;
3924
 
3925
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
3926
      if (lastComparison != 0) {
3927
        return lastComparison;
3928
      }
3929
      lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
3930
      if (lastComparison != 0) {
3931
        return lastComparison;
3932
      }
3933
      lastComparison = Boolean.valueOf(isSetCartId()).compareTo(isSetCartId());
3934
      if (lastComparison != 0) {
3935
        return lastComparison;
3936
      }
3937
      lastComparison = TBaseHelper.compareTo(cartId, typedOther.cartId);
3938
      if (lastComparison != 0) {
3939
        return lastComparison;
3940
      }
3941
      return 0;
3942
    }
3943
 
3944
    public void read(TProtocol iprot) throws TException {
3945
      TField field;
3946
      iprot.readStructBegin();
3947
      while (true)
3948
      {
3949
        field = iprot.readFieldBegin();
3950
        if (field.type == TType.STOP) { 
3951
          break;
3952
        }
3953
        _Fields fieldId = _Fields.findByThriftId(field.id);
3954
        if (fieldId == null) {
3955
          TProtocolUtil.skip(iprot, field.type);
3956
        } else {
3957
          switch (fieldId) {
3958
            case COUPON_CODE:
3959
              if (field.type == TType.STRING) {
3960
                this.couponCode = iprot.readString();
3961
              } else { 
3962
                TProtocolUtil.skip(iprot, field.type);
3963
              }
3964
              break;
3965
            case CART_ID:
3966
              if (field.type == TType.I64) {
3967
                this.cartId = iprot.readI64();
3968
                setCartIdIsSet(true);
3969
              } else { 
3970
                TProtocolUtil.skip(iprot, field.type);
3971
              }
3972
              break;
3973
          }
3974
          iprot.readFieldEnd();
3975
        }
3976
      }
3977
      iprot.readStructEnd();
3978
      validate();
3979
    }
3980
 
3981
    public void write(TProtocol oprot) throws TException {
3982
      validate();
3983
 
3984
      oprot.writeStructBegin(STRUCT_DESC);
3985
      if (this.couponCode != null) {
3986
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
3987
        oprot.writeString(this.couponCode);
3988
        oprot.writeFieldEnd();
3989
      }
3990
      oprot.writeFieldBegin(CART_ID_FIELD_DESC);
3991
      oprot.writeI64(this.cartId);
3992
      oprot.writeFieldEnd();
3993
      oprot.writeFieldStop();
3994
      oprot.writeStructEnd();
3995
    }
3996
 
3997
    @Override
3998
    public String toString() {
3999
      StringBuilder sb = new StringBuilder("applyCoupon_args(");
4000
      boolean first = true;
4001
 
4002
      sb.append("couponCode:");
4003
      if (this.couponCode == null) {
4004
        sb.append("null");
4005
      } else {
4006
        sb.append(this.couponCode);
4007
      }
4008
      first = false;
4009
      if (!first) sb.append(", ");
4010
      sb.append("cartId:");
4011
      sb.append(this.cartId);
4012
      first = false;
4013
      sb.append(")");
4014
      return sb.toString();
4015
    }
4016
 
4017
    public void validate() throws TException {
4018
      // check for required fields
4019
    }
4020
 
4021
  }
4022
 
4023
  public static class applyCoupon_result implements TBase<applyCoupon_result._Fields>, java.io.Serializable, Cloneable, Comparable<applyCoupon_result>   {
4024
    private static final TStruct STRUCT_DESC = new TStruct("applyCoupon_result");
4025
 
4026
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
4027
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
4028
 
4029
    private Cart success;
4030
    private PromotionException pex;
4031
 
4032
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
4033
    public enum _Fields implements TFieldIdEnum {
4034
      SUCCESS((short)0, "success"),
4035
      PEX((short)1, "pex");
4036
 
4037
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
4038
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
4039
 
4040
      static {
4041
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
4042
          byId.put((int)field._thriftId, field);
4043
          byName.put(field.getFieldName(), field);
4044
        }
4045
      }
4046
 
4047
      /**
4048
       * Find the _Fields constant that matches fieldId, or null if its not found.
4049
       */
4050
      public static _Fields findByThriftId(int fieldId) {
4051
        return byId.get(fieldId);
4052
      }
4053
 
4054
      /**
4055
       * Find the _Fields constant that matches fieldId, throwing an exception
4056
       * if it is not found.
4057
       */
4058
      public static _Fields findByThriftIdOrThrow(int fieldId) {
4059
        _Fields fields = findByThriftId(fieldId);
4060
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
4061
        return fields;
4062
      }
4063
 
4064
      /**
4065
       * Find the _Fields constant that matches name, or null if its not found.
4066
       */
4067
      public static _Fields findByName(String name) {
4068
        return byName.get(name);
4069
      }
4070
 
4071
      private final short _thriftId;
4072
      private final String _fieldName;
4073
 
4074
      _Fields(short thriftId, String fieldName) {
4075
        _thriftId = thriftId;
4076
        _fieldName = fieldName;
4077
      }
4078
 
4079
      public short getThriftFieldId() {
4080
        return _thriftId;
4081
      }
4082
 
4083
      public String getFieldName() {
4084
        return _fieldName;
4085
      }
4086
    }
4087
 
4088
    // isset id assignments
4089
 
4090
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
4091
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
4092
          new StructMetaData(TType.STRUCT, Cart.class)));
4093
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
4094
          new FieldValueMetaData(TType.STRUCT)));
4095
    }});
4096
 
4097
    static {
4098
      FieldMetaData.addStructMetaDataMap(applyCoupon_result.class, metaDataMap);
4099
    }
4100
 
4101
    public applyCoupon_result() {
4102
    }
4103
 
4104
    public applyCoupon_result(
4105
      Cart success,
4106
      PromotionException pex)
4107
    {
4108
      this();
4109
      this.success = success;
4110
      this.pex = pex;
4111
    }
4112
 
4113
    /**
4114
     * Performs a deep copy on <i>other</i>.
4115
     */
4116
    public applyCoupon_result(applyCoupon_result other) {
4117
      if (other.isSetSuccess()) {
4118
        this.success = new Cart(other.success);
4119
      }
4120
      if (other.isSetPex()) {
4121
        this.pex = new PromotionException(other.pex);
4122
      }
4123
    }
4124
 
4125
    public applyCoupon_result deepCopy() {
4126
      return new applyCoupon_result(this);
4127
    }
4128
 
4129
    @Deprecated
4130
    public applyCoupon_result clone() {
4131
      return new applyCoupon_result(this);
4132
    }
4133
 
4134
    public Cart getSuccess() {
4135
      return this.success;
4136
    }
4137
 
4138
    public applyCoupon_result setSuccess(Cart success) {
4139
      this.success = success;
4140
      return this;
4141
    }
4142
 
4143
    public void unsetSuccess() {
4144
      this.success = null;
4145
    }
4146
 
4147
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
4148
    public boolean isSetSuccess() {
4149
      return this.success != null;
4150
    }
4151
 
4152
    public void setSuccessIsSet(boolean value) {
4153
      if (!value) {
4154
        this.success = null;
4155
      }
4156
    }
4157
 
4158
    public PromotionException getPex() {
4159
      return this.pex;
4160
    }
4161
 
4162
    public applyCoupon_result setPex(PromotionException pex) {
4163
      this.pex = pex;
4164
      return this;
4165
    }
4166
 
4167
    public void unsetPex() {
4168
      this.pex = null;
4169
    }
4170
 
4171
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
4172
    public boolean isSetPex() {
4173
      return this.pex != null;
4174
    }
4175
 
4176
    public void setPexIsSet(boolean value) {
4177
      if (!value) {
4178
        this.pex = null;
4179
      }
4180
    }
4181
 
4182
    public void setFieldValue(_Fields field, Object value) {
4183
      switch (field) {
4184
      case SUCCESS:
4185
        if (value == null) {
4186
          unsetSuccess();
4187
        } else {
4188
          setSuccess((Cart)value);
4189
        }
4190
        break;
4191
 
4192
      case PEX:
4193
        if (value == null) {
4194
          unsetPex();
4195
        } else {
4196
          setPex((PromotionException)value);
4197
        }
4198
        break;
4199
 
4200
      }
4201
    }
4202
 
4203
    public void setFieldValue(int fieldID, Object value) {
4204
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
4205
    }
4206
 
4207
    public Object getFieldValue(_Fields field) {
4208
      switch (field) {
4209
      case SUCCESS:
4210
        return getSuccess();
4211
 
4212
      case PEX:
4213
        return getPex();
4214
 
4215
      }
4216
      throw new IllegalStateException();
4217
    }
4218
 
4219
    public Object getFieldValue(int fieldId) {
4220
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
4221
    }
4222
 
4223
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
4224
    public boolean isSet(_Fields field) {
4225
      switch (field) {
4226
      case SUCCESS:
4227
        return isSetSuccess();
4228
      case PEX:
4229
        return isSetPex();
4230
      }
4231
      throw new IllegalStateException();
4232
    }
4233
 
4234
    public boolean isSet(int fieldID) {
4235
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
4236
    }
4237
 
4238
    @Override
4239
    public boolean equals(Object that) {
4240
      if (that == null)
4241
        return false;
4242
      if (that instanceof applyCoupon_result)
4243
        return this.equals((applyCoupon_result)that);
4244
      return false;
4245
    }
4246
 
4247
    public boolean equals(applyCoupon_result that) {
4248
      if (that == null)
4249
        return false;
4250
 
4251
      boolean this_present_success = true && this.isSetSuccess();
4252
      boolean that_present_success = true && that.isSetSuccess();
4253
      if (this_present_success || that_present_success) {
4254
        if (!(this_present_success && that_present_success))
4255
          return false;
4256
        if (!this.success.equals(that.success))
4257
          return false;
4258
      }
4259
 
4260
      boolean this_present_pex = true && this.isSetPex();
4261
      boolean that_present_pex = true && that.isSetPex();
4262
      if (this_present_pex || that_present_pex) {
4263
        if (!(this_present_pex && that_present_pex))
4264
          return false;
4265
        if (!this.pex.equals(that.pex))
4266
          return false;
4267
      }
4268
 
4269
      return true;
4270
    }
4271
 
4272
    @Override
4273
    public int hashCode() {
4274
      return 0;
4275
    }
4276
 
4277
    public int compareTo(applyCoupon_result other) {
4278
      if (!getClass().equals(other.getClass())) {
4279
        return getClass().getName().compareTo(other.getClass().getName());
4280
      }
4281
 
4282
      int lastComparison = 0;
4283
      applyCoupon_result typedOther = (applyCoupon_result)other;
4284
 
4285
      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
4286
      if (lastComparison != 0) {
4287
        return lastComparison;
4288
      }
4289
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
4290
      if (lastComparison != 0) {
4291
        return lastComparison;
4292
      }
4293
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
4294
      if (lastComparison != 0) {
4295
        return lastComparison;
4296
      }
4297
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
4298
      if (lastComparison != 0) {
4299
        return lastComparison;
4300
      }
4301
      return 0;
4302
    }
4303
 
4304
    public void read(TProtocol iprot) throws TException {
4305
      TField field;
4306
      iprot.readStructBegin();
4307
      while (true)
4308
      {
4309
        field = iprot.readFieldBegin();
4310
        if (field.type == TType.STOP) { 
4311
          break;
4312
        }
4313
        _Fields fieldId = _Fields.findByThriftId(field.id);
4314
        if (fieldId == null) {
4315
          TProtocolUtil.skip(iprot, field.type);
4316
        } else {
4317
          switch (fieldId) {
4318
            case SUCCESS:
4319
              if (field.type == TType.STRUCT) {
4320
                this.success = new Cart();
4321
                this.success.read(iprot);
4322
              } else { 
4323
                TProtocolUtil.skip(iprot, field.type);
4324
              }
4325
              break;
4326
            case PEX:
4327
              if (field.type == TType.STRUCT) {
4328
                this.pex = new PromotionException();
4329
                this.pex.read(iprot);
4330
              } else { 
4331
                TProtocolUtil.skip(iprot, field.type);
4332
              }
4333
              break;
4334
          }
4335
          iprot.readFieldEnd();
4336
        }
4337
      }
4338
      iprot.readStructEnd();
4339
      validate();
4340
    }
4341
 
4342
    public void write(TProtocol oprot) throws TException {
4343
      oprot.writeStructBegin(STRUCT_DESC);
4344
 
4345
      if (this.isSetSuccess()) {
4346
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
4347
        this.success.write(oprot);
4348
        oprot.writeFieldEnd();
4349
      } else if (this.isSetPex()) {
4350
        oprot.writeFieldBegin(PEX_FIELD_DESC);
4351
        this.pex.write(oprot);
4352
        oprot.writeFieldEnd();
4353
      }
4354
      oprot.writeFieldStop();
4355
      oprot.writeStructEnd();
4356
    }
4357
 
4358
    @Override
4359
    public String toString() {
4360
      StringBuilder sb = new StringBuilder("applyCoupon_result(");
4361
      boolean first = true;
4362
 
4363
      sb.append("success:");
4364
      if (this.success == null) {
4365
        sb.append("null");
4366
      } else {
4367
        sb.append(this.success);
4368
      }
4369
      first = false;
4370
      if (!first) sb.append(", ");
4371
      sb.append("pex:");
4372
      if (this.pex == null) {
4373
        sb.append("null");
4374
      } else {
4375
        sb.append(this.pex);
4376
      }
4377
      first = false;
4378
      sb.append(")");
4379
      return sb.toString();
4380
    }
4381
 
4382
    public void validate() throws TException {
4383
      // check for required fields
4384
    }
4385
 
4386
  }
4387
 
4388
  public static class trackCouponUsage_args implements TBase<trackCouponUsage_args._Fields>, java.io.Serializable, Cloneable, Comparable<trackCouponUsage_args>   {
4389
    private static final TStruct STRUCT_DESC = new TStruct("trackCouponUsage_args");
4390
 
4391
    private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
4392
    private static final TField TRANSACTION_ID_FIELD_DESC = new TField("transactionId", TType.I64, (short)2);
4393
    private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)3);
4394
 
4395
    private String couponCode;
4396
    private long transactionId;
4397
    private long userId;
4398
 
4399
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
4400
    public enum _Fields implements TFieldIdEnum {
4401
      COUPON_CODE((short)1, "couponCode"),
4402
      TRANSACTION_ID((short)2, "transactionId"),
4403
      USER_ID((short)3, "userId");
4404
 
4405
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
4406
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
4407
 
4408
      static {
4409
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
4410
          byId.put((int)field._thriftId, field);
4411
          byName.put(field.getFieldName(), field);
4412
        }
4413
      }
4414
 
4415
      /**
4416
       * Find the _Fields constant that matches fieldId, or null if its not found.
4417
       */
4418
      public static _Fields findByThriftId(int fieldId) {
4419
        return byId.get(fieldId);
4420
      }
4421
 
4422
      /**
4423
       * Find the _Fields constant that matches fieldId, throwing an exception
4424
       * if it is not found.
4425
       */
4426
      public static _Fields findByThriftIdOrThrow(int fieldId) {
4427
        _Fields fields = findByThriftId(fieldId);
4428
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
4429
        return fields;
4430
      }
4431
 
4432
      /**
4433
       * Find the _Fields constant that matches name, or null if its not found.
4434
       */
4435
      public static _Fields findByName(String name) {
4436
        return byName.get(name);
4437
      }
4438
 
4439
      private final short _thriftId;
4440
      private final String _fieldName;
4441
 
4442
      _Fields(short thriftId, String fieldName) {
4443
        _thriftId = thriftId;
4444
        _fieldName = fieldName;
4445
      }
4446
 
4447
      public short getThriftFieldId() {
4448
        return _thriftId;
4449
      }
4450
 
4451
      public String getFieldName() {
4452
        return _fieldName;
4453
      }
4454
    }
4455
 
4456
    // isset id assignments
4457
    private static final int __TRANSACTIONID_ISSET_ID = 0;
4458
    private static final int __USERID_ISSET_ID = 1;
4459
    private BitSet __isset_bit_vector = new BitSet(2);
4460
 
4461
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
4462
      put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
4463
          new FieldValueMetaData(TType.STRING)));
4464
      put(_Fields.TRANSACTION_ID, new FieldMetaData("transactionId", TFieldRequirementType.DEFAULT, 
4465
          new FieldValueMetaData(TType.I64)));
4466
      put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
4467
          new FieldValueMetaData(TType.I64)));
4468
    }});
4469
 
4470
    static {
4471
      FieldMetaData.addStructMetaDataMap(trackCouponUsage_args.class, metaDataMap);
4472
    }
4473
 
4474
    public trackCouponUsage_args() {
4475
    }
4476
 
4477
    public trackCouponUsage_args(
4478
      String couponCode,
4479
      long transactionId,
4480
      long userId)
4481
    {
4482
      this();
4483
      this.couponCode = couponCode;
4484
      this.transactionId = transactionId;
4485
      setTransactionIdIsSet(true);
4486
      this.userId = userId;
4487
      setUserIdIsSet(true);
4488
    }
4489
 
4490
    /**
4491
     * Performs a deep copy on <i>other</i>.
4492
     */
4493
    public trackCouponUsage_args(trackCouponUsage_args other) {
4494
      __isset_bit_vector.clear();
4495
      __isset_bit_vector.or(other.__isset_bit_vector);
4496
      if (other.isSetCouponCode()) {
4497
        this.couponCode = other.couponCode;
4498
      }
4499
      this.transactionId = other.transactionId;
4500
      this.userId = other.userId;
4501
    }
4502
 
4503
    public trackCouponUsage_args deepCopy() {
4504
      return new trackCouponUsage_args(this);
4505
    }
4506
 
4507
    @Deprecated
4508
    public trackCouponUsage_args clone() {
4509
      return new trackCouponUsage_args(this);
4510
    }
4511
 
4512
    public String getCouponCode() {
4513
      return this.couponCode;
4514
    }
4515
 
4516
    public trackCouponUsage_args setCouponCode(String couponCode) {
4517
      this.couponCode = couponCode;
4518
      return this;
4519
    }
4520
 
4521
    public void unsetCouponCode() {
4522
      this.couponCode = null;
4523
    }
4524
 
4525
    /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
4526
    public boolean isSetCouponCode() {
4527
      return this.couponCode != null;
4528
    }
4529
 
4530
    public void setCouponCodeIsSet(boolean value) {
4531
      if (!value) {
4532
        this.couponCode = null;
4533
      }
4534
    }
4535
 
4536
    public long getTransactionId() {
4537
      return this.transactionId;
4538
    }
4539
 
4540
    public trackCouponUsage_args setTransactionId(long transactionId) {
4541
      this.transactionId = transactionId;
4542
      setTransactionIdIsSet(true);
4543
      return this;
4544
    }
4545
 
4546
    public void unsetTransactionId() {
4547
      __isset_bit_vector.clear(__TRANSACTIONID_ISSET_ID);
4548
    }
4549
 
4550
    /** Returns true if field transactionId is set (has been asigned a value) and false otherwise */
4551
    public boolean isSetTransactionId() {
4552
      return __isset_bit_vector.get(__TRANSACTIONID_ISSET_ID);
4553
    }
4554
 
4555
    public void setTransactionIdIsSet(boolean value) {
4556
      __isset_bit_vector.set(__TRANSACTIONID_ISSET_ID, value);
4557
    }
4558
 
4559
    public long getUserId() {
4560
      return this.userId;
4561
    }
4562
 
4563
    public trackCouponUsage_args setUserId(long userId) {
4564
      this.userId = userId;
4565
      setUserIdIsSet(true);
4566
      return this;
4567
    }
4568
 
4569
    public void unsetUserId() {
4570
      __isset_bit_vector.clear(__USERID_ISSET_ID);
4571
    }
4572
 
4573
    /** Returns true if field userId is set (has been asigned a value) and false otherwise */
4574
    public boolean isSetUserId() {
4575
      return __isset_bit_vector.get(__USERID_ISSET_ID);
4576
    }
4577
 
4578
    public void setUserIdIsSet(boolean value) {
4579
      __isset_bit_vector.set(__USERID_ISSET_ID, value);
4580
    }
4581
 
4582
    public void setFieldValue(_Fields field, Object value) {
4583
      switch (field) {
4584
      case COUPON_CODE:
4585
        if (value == null) {
4586
          unsetCouponCode();
4587
        } else {
4588
          setCouponCode((String)value);
4589
        }
4590
        break;
4591
 
4592
      case TRANSACTION_ID:
4593
        if (value == null) {
4594
          unsetTransactionId();
4595
        } else {
4596
          setTransactionId((Long)value);
4597
        }
4598
        break;
4599
 
4600
      case USER_ID:
4601
        if (value == null) {
4602
          unsetUserId();
4603
        } else {
4604
          setUserId((Long)value);
4605
        }
4606
        break;
4607
 
4608
      }
4609
    }
4610
 
4611
    public void setFieldValue(int fieldID, Object value) {
4612
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
4613
    }
4614
 
4615
    public Object getFieldValue(_Fields field) {
4616
      switch (field) {
4617
      case COUPON_CODE:
4618
        return getCouponCode();
4619
 
4620
      case TRANSACTION_ID:
4621
        return new Long(getTransactionId());
4622
 
4623
      case USER_ID:
4624
        return new Long(getUserId());
4625
 
4626
      }
4627
      throw new IllegalStateException();
4628
    }
4629
 
4630
    public Object getFieldValue(int fieldId) {
4631
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
4632
    }
4633
 
4634
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
4635
    public boolean isSet(_Fields field) {
4636
      switch (field) {
4637
      case COUPON_CODE:
4638
        return isSetCouponCode();
4639
      case TRANSACTION_ID:
4640
        return isSetTransactionId();
4641
      case USER_ID:
4642
        return isSetUserId();
4643
      }
4644
      throw new IllegalStateException();
4645
    }
4646
 
4647
    public boolean isSet(int fieldID) {
4648
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
4649
    }
4650
 
4651
    @Override
4652
    public boolean equals(Object that) {
4653
      if (that == null)
4654
        return false;
4655
      if (that instanceof trackCouponUsage_args)
4656
        return this.equals((trackCouponUsage_args)that);
4657
      return false;
4658
    }
4659
 
4660
    public boolean equals(trackCouponUsage_args that) {
4661
      if (that == null)
4662
        return false;
4663
 
4664
      boolean this_present_couponCode = true && this.isSetCouponCode();
4665
      boolean that_present_couponCode = true && that.isSetCouponCode();
4666
      if (this_present_couponCode || that_present_couponCode) {
4667
        if (!(this_present_couponCode && that_present_couponCode))
4668
          return false;
4669
        if (!this.couponCode.equals(that.couponCode))
4670
          return false;
4671
      }
4672
 
4673
      boolean this_present_transactionId = true;
4674
      boolean that_present_transactionId = true;
4675
      if (this_present_transactionId || that_present_transactionId) {
4676
        if (!(this_present_transactionId && that_present_transactionId))
4677
          return false;
4678
        if (this.transactionId != that.transactionId)
4679
          return false;
4680
      }
4681
 
4682
      boolean this_present_userId = true;
4683
      boolean that_present_userId = true;
4684
      if (this_present_userId || that_present_userId) {
4685
        if (!(this_present_userId && that_present_userId))
4686
          return false;
4687
        if (this.userId != that.userId)
4688
          return false;
4689
      }
4690
 
4691
      return true;
4692
    }
4693
 
4694
    @Override
4695
    public int hashCode() {
4696
      return 0;
4697
    }
4698
 
4699
    public int compareTo(trackCouponUsage_args other) {
4700
      if (!getClass().equals(other.getClass())) {
4701
        return getClass().getName().compareTo(other.getClass().getName());
4702
      }
4703
 
4704
      int lastComparison = 0;
4705
      trackCouponUsage_args typedOther = (trackCouponUsage_args)other;
4706
 
4707
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
4708
      if (lastComparison != 0) {
4709
        return lastComparison;
4710
      }
4711
      lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
4712
      if (lastComparison != 0) {
4713
        return lastComparison;
4714
      }
4715
      lastComparison = Boolean.valueOf(isSetTransactionId()).compareTo(isSetTransactionId());
4716
      if (lastComparison != 0) {
4717
        return lastComparison;
4718
      }
4719
      lastComparison = TBaseHelper.compareTo(transactionId, typedOther.transactionId);
4720
      if (lastComparison != 0) {
4721
        return lastComparison;
4722
      }
4723
      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
4724
      if (lastComparison != 0) {
4725
        return lastComparison;
4726
      }
4727
      lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
4728
      if (lastComparison != 0) {
4729
        return lastComparison;
4730
      }
4731
      return 0;
4732
    }
4733
 
4734
    public void read(TProtocol iprot) throws TException {
4735
      TField field;
4736
      iprot.readStructBegin();
4737
      while (true)
4738
      {
4739
        field = iprot.readFieldBegin();
4740
        if (field.type == TType.STOP) { 
4741
          break;
4742
        }
4743
        _Fields fieldId = _Fields.findByThriftId(field.id);
4744
        if (fieldId == null) {
4745
          TProtocolUtil.skip(iprot, field.type);
4746
        } else {
4747
          switch (fieldId) {
4748
            case COUPON_CODE:
4749
              if (field.type == TType.STRING) {
4750
                this.couponCode = iprot.readString();
4751
              } else { 
4752
                TProtocolUtil.skip(iprot, field.type);
4753
              }
4754
              break;
4755
            case TRANSACTION_ID:
4756
              if (field.type == TType.I64) {
4757
                this.transactionId = iprot.readI64();
4758
                setTransactionIdIsSet(true);
4759
              } else { 
4760
                TProtocolUtil.skip(iprot, field.type);
4761
              }
4762
              break;
4763
            case USER_ID:
4764
              if (field.type == TType.I64) {
4765
                this.userId = iprot.readI64();
4766
                setUserIdIsSet(true);
4767
              } else { 
4768
                TProtocolUtil.skip(iprot, field.type);
4769
              }
4770
              break;
4771
          }
4772
          iprot.readFieldEnd();
4773
        }
4774
      }
4775
      iprot.readStructEnd();
4776
      validate();
4777
    }
4778
 
4779
    public void write(TProtocol oprot) throws TException {
4780
      validate();
4781
 
4782
      oprot.writeStructBegin(STRUCT_DESC);
4783
      if (this.couponCode != null) {
4784
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
4785
        oprot.writeString(this.couponCode);
4786
        oprot.writeFieldEnd();
4787
      }
4788
      oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC);
4789
      oprot.writeI64(this.transactionId);
4790
      oprot.writeFieldEnd();
4791
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
4792
      oprot.writeI64(this.userId);
4793
      oprot.writeFieldEnd();
4794
      oprot.writeFieldStop();
4795
      oprot.writeStructEnd();
4796
    }
4797
 
4798
    @Override
4799
    public String toString() {
4800
      StringBuilder sb = new StringBuilder("trackCouponUsage_args(");
4801
      boolean first = true;
4802
 
4803
      sb.append("couponCode:");
4804
      if (this.couponCode == null) {
4805
        sb.append("null");
4806
      } else {
4807
        sb.append(this.couponCode);
4808
      }
4809
      first = false;
4810
      if (!first) sb.append(", ");
4811
      sb.append("transactionId:");
4812
      sb.append(this.transactionId);
4813
      first = false;
4814
      if (!first) sb.append(", ");
4815
      sb.append("userId:");
4816
      sb.append(this.userId);
4817
      first = false;
4818
      sb.append(")");
4819
      return sb.toString();
4820
    }
4821
 
4822
    public void validate() throws TException {
4823
      // check for required fields
4824
    }
4825
 
4826
  }
4827
 
4828
  public static class trackCouponUsage_result implements TBase<trackCouponUsage_result._Fields>, java.io.Serializable, Cloneable, Comparable<trackCouponUsage_result>   {
4829
    private static final TStruct STRUCT_DESC = new TStruct("trackCouponUsage_result");
4830
 
4831
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
4832
 
4833
    private PromotionException pex;
4834
 
4835
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
4836
    public enum _Fields implements TFieldIdEnum {
4837
      PEX((short)1, "pex");
4838
 
4839
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
4840
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
4841
 
4842
      static {
4843
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
4844
          byId.put((int)field._thriftId, field);
4845
          byName.put(field.getFieldName(), field);
4846
        }
4847
      }
4848
 
4849
      /**
4850
       * Find the _Fields constant that matches fieldId, or null if its not found.
4851
       */
4852
      public static _Fields findByThriftId(int fieldId) {
4853
        return byId.get(fieldId);
4854
      }
4855
 
4856
      /**
4857
       * Find the _Fields constant that matches fieldId, throwing an exception
4858
       * if it is not found.
4859
       */
4860
      public static _Fields findByThriftIdOrThrow(int fieldId) {
4861
        _Fields fields = findByThriftId(fieldId);
4862
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
4863
        return fields;
4864
      }
4865
 
4866
      /**
4867
       * Find the _Fields constant that matches name, or null if its not found.
4868
       */
4869
      public static _Fields findByName(String name) {
4870
        return byName.get(name);
4871
      }
4872
 
4873
      private final short _thriftId;
4874
      private final String _fieldName;
4875
 
4876
      _Fields(short thriftId, String fieldName) {
4877
        _thriftId = thriftId;
4878
        _fieldName = fieldName;
4879
      }
4880
 
4881
      public short getThriftFieldId() {
4882
        return _thriftId;
4883
      }
4884
 
4885
      public String getFieldName() {
4886
        return _fieldName;
4887
      }
4888
    }
4889
 
4890
    // isset id assignments
4891
 
4892
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
4893
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
4894
          new FieldValueMetaData(TType.STRUCT)));
4895
    }});
4896
 
4897
    static {
4898
      FieldMetaData.addStructMetaDataMap(trackCouponUsage_result.class, metaDataMap);
4899
    }
4900
 
4901
    public trackCouponUsage_result() {
4902
    }
4903
 
4904
    public trackCouponUsage_result(
4905
      PromotionException pex)
4906
    {
4907
      this();
4908
      this.pex = pex;
4909
    }
4910
 
4911
    /**
4912
     * Performs a deep copy on <i>other</i>.
4913
     */
4914
    public trackCouponUsage_result(trackCouponUsage_result other) {
4915
      if (other.isSetPex()) {
4916
        this.pex = new PromotionException(other.pex);
4917
      }
4918
    }
4919
 
4920
    public trackCouponUsage_result deepCopy() {
4921
      return new trackCouponUsage_result(this);
4922
    }
4923
 
4924
    @Deprecated
4925
    public trackCouponUsage_result clone() {
4926
      return new trackCouponUsage_result(this);
4927
    }
4928
 
4929
    public PromotionException getPex() {
4930
      return this.pex;
4931
    }
4932
 
4933
    public trackCouponUsage_result setPex(PromotionException pex) {
4934
      this.pex = pex;
4935
      return this;
4936
    }
4937
 
4938
    public void unsetPex() {
4939
      this.pex = null;
4940
    }
4941
 
4942
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
4943
    public boolean isSetPex() {
4944
      return this.pex != null;
4945
    }
4946
 
4947
    public void setPexIsSet(boolean value) {
4948
      if (!value) {
4949
        this.pex = null;
4950
      }
4951
    }
4952
 
4953
    public void setFieldValue(_Fields field, Object value) {
4954
      switch (field) {
4955
      case PEX:
4956
        if (value == null) {
4957
          unsetPex();
4958
        } else {
4959
          setPex((PromotionException)value);
4960
        }
4961
        break;
4962
 
4963
      }
4964
    }
4965
 
4966
    public void setFieldValue(int fieldID, Object value) {
4967
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
4968
    }
4969
 
4970
    public Object getFieldValue(_Fields field) {
4971
      switch (field) {
4972
      case PEX:
4973
        return getPex();
4974
 
4975
      }
4976
      throw new IllegalStateException();
4977
    }
4978
 
4979
    public Object getFieldValue(int fieldId) {
4980
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
4981
    }
4982
 
4983
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
4984
    public boolean isSet(_Fields field) {
4985
      switch (field) {
4986
      case PEX:
4987
        return isSetPex();
4988
      }
4989
      throw new IllegalStateException();
4990
    }
4991
 
4992
    public boolean isSet(int fieldID) {
4993
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
4994
    }
4995
 
4996
    @Override
4997
    public boolean equals(Object that) {
4998
      if (that == null)
4999
        return false;
5000
      if (that instanceof trackCouponUsage_result)
5001
        return this.equals((trackCouponUsage_result)that);
5002
      return false;
5003
    }
5004
 
5005
    public boolean equals(trackCouponUsage_result that) {
5006
      if (that == null)
5007
        return false;
5008
 
5009
      boolean this_present_pex = true && this.isSetPex();
5010
      boolean that_present_pex = true && that.isSetPex();
5011
      if (this_present_pex || that_present_pex) {
5012
        if (!(this_present_pex && that_present_pex))
5013
          return false;
5014
        if (!this.pex.equals(that.pex))
5015
          return false;
5016
      }
5017
 
5018
      return true;
5019
    }
5020
 
5021
    @Override
5022
    public int hashCode() {
5023
      return 0;
5024
    }
5025
 
5026
    public int compareTo(trackCouponUsage_result other) {
5027
      if (!getClass().equals(other.getClass())) {
5028
        return getClass().getName().compareTo(other.getClass().getName());
5029
      }
5030
 
5031
      int lastComparison = 0;
5032
      trackCouponUsage_result typedOther = (trackCouponUsage_result)other;
5033
 
5034
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
5035
      if (lastComparison != 0) {
5036
        return lastComparison;
5037
      }
5038
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
5039
      if (lastComparison != 0) {
5040
        return lastComparison;
5041
      }
5042
      return 0;
5043
    }
5044
 
5045
    public void read(TProtocol iprot) throws TException {
5046
      TField field;
5047
      iprot.readStructBegin();
5048
      while (true)
5049
      {
5050
        field = iprot.readFieldBegin();
5051
        if (field.type == TType.STOP) { 
5052
          break;
5053
        }
5054
        _Fields fieldId = _Fields.findByThriftId(field.id);
5055
        if (fieldId == null) {
5056
          TProtocolUtil.skip(iprot, field.type);
5057
        } else {
5058
          switch (fieldId) {
5059
            case PEX:
5060
              if (field.type == TType.STRUCT) {
5061
                this.pex = new PromotionException();
5062
                this.pex.read(iprot);
5063
              } else { 
5064
                TProtocolUtil.skip(iprot, field.type);
5065
              }
5066
              break;
5067
          }
5068
          iprot.readFieldEnd();
5069
        }
5070
      }
5071
      iprot.readStructEnd();
5072
      validate();
5073
    }
5074
 
5075
    public void write(TProtocol oprot) throws TException {
5076
      oprot.writeStructBegin(STRUCT_DESC);
5077
 
5078
      if (this.isSetPex()) {
5079
        oprot.writeFieldBegin(PEX_FIELD_DESC);
5080
        this.pex.write(oprot);
5081
        oprot.writeFieldEnd();
5082
      }
5083
      oprot.writeFieldStop();
5084
      oprot.writeStructEnd();
5085
    }
5086
 
5087
    @Override
5088
    public String toString() {
5089
      StringBuilder sb = new StringBuilder("trackCouponUsage_result(");
5090
      boolean first = true;
5091
 
5092
      sb.append("pex:");
5093
      if (this.pex == null) {
5094
        sb.append("null");
5095
      } else {
5096
        sb.append(this.pex);
5097
      }
5098
      first = false;
5099
      sb.append(")");
5100
      return sb.toString();
5101
    }
5102
 
5103
    public void validate() throws TException {
5104
      // check for required fields
5105
    }
5106
 
5107
  }
5108
 
5109
  public static class getCouponUsageCountByUser_args implements TBase<getCouponUsageCountByUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<getCouponUsageCountByUser_args>   {
5110
    private static final TStruct STRUCT_DESC = new TStruct("getCouponUsageCountByUser_args");
5111
 
5112
    private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
5113
    private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)2);
5114
 
5115
    private String couponCode;
5116
    private long userId;
5117
 
5118
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
5119
    public enum _Fields implements TFieldIdEnum {
5120
      COUPON_CODE((short)1, "couponCode"),
5121
      USER_ID((short)2, "userId");
5122
 
5123
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
5124
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
5125
 
5126
      static {
5127
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
5128
          byId.put((int)field._thriftId, field);
5129
          byName.put(field.getFieldName(), field);
5130
        }
5131
      }
5132
 
5133
      /**
5134
       * Find the _Fields constant that matches fieldId, or null if its not found.
5135
       */
5136
      public static _Fields findByThriftId(int fieldId) {
5137
        return byId.get(fieldId);
5138
      }
5139
 
5140
      /**
5141
       * Find the _Fields constant that matches fieldId, throwing an exception
5142
       * if it is not found.
5143
       */
5144
      public static _Fields findByThriftIdOrThrow(int fieldId) {
5145
        _Fields fields = findByThriftId(fieldId);
5146
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
5147
        return fields;
5148
      }
5149
 
5150
      /**
5151
       * Find the _Fields constant that matches name, or null if its not found.
5152
       */
5153
      public static _Fields findByName(String name) {
5154
        return byName.get(name);
5155
      }
5156
 
5157
      private final short _thriftId;
5158
      private final String _fieldName;
5159
 
5160
      _Fields(short thriftId, String fieldName) {
5161
        _thriftId = thriftId;
5162
        _fieldName = fieldName;
5163
      }
5164
 
5165
      public short getThriftFieldId() {
5166
        return _thriftId;
5167
      }
5168
 
5169
      public String getFieldName() {
5170
        return _fieldName;
5171
      }
5172
    }
5173
 
5174
    // isset id assignments
5175
    private static final int __USERID_ISSET_ID = 0;
5176
    private BitSet __isset_bit_vector = new BitSet(1);
5177
 
5178
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
5179
      put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
5180
          new FieldValueMetaData(TType.STRING)));
5181
      put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
5182
          new FieldValueMetaData(TType.I64)));
5183
    }});
5184
 
5185
    static {
5186
      FieldMetaData.addStructMetaDataMap(getCouponUsageCountByUser_args.class, metaDataMap);
5187
    }
5188
 
5189
    public getCouponUsageCountByUser_args() {
5190
    }
5191
 
5192
    public getCouponUsageCountByUser_args(
5193
      String couponCode,
5194
      long userId)
5195
    {
5196
      this();
5197
      this.couponCode = couponCode;
5198
      this.userId = userId;
5199
      setUserIdIsSet(true);
5200
    }
5201
 
5202
    /**
5203
     * Performs a deep copy on <i>other</i>.
5204
     */
5205
    public getCouponUsageCountByUser_args(getCouponUsageCountByUser_args other) {
5206
      __isset_bit_vector.clear();
5207
      __isset_bit_vector.or(other.__isset_bit_vector);
5208
      if (other.isSetCouponCode()) {
5209
        this.couponCode = other.couponCode;
5210
      }
5211
      this.userId = other.userId;
5212
    }
5213
 
5214
    public getCouponUsageCountByUser_args deepCopy() {
5215
      return new getCouponUsageCountByUser_args(this);
5216
    }
5217
 
5218
    @Deprecated
5219
    public getCouponUsageCountByUser_args clone() {
5220
      return new getCouponUsageCountByUser_args(this);
5221
    }
5222
 
5223
    public String getCouponCode() {
5224
      return this.couponCode;
5225
    }
5226
 
5227
    public getCouponUsageCountByUser_args setCouponCode(String couponCode) {
5228
      this.couponCode = couponCode;
5229
      return this;
5230
    }
5231
 
5232
    public void unsetCouponCode() {
5233
      this.couponCode = null;
5234
    }
5235
 
5236
    /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
5237
    public boolean isSetCouponCode() {
5238
      return this.couponCode != null;
5239
    }
5240
 
5241
    public void setCouponCodeIsSet(boolean value) {
5242
      if (!value) {
5243
        this.couponCode = null;
5244
      }
5245
    }
5246
 
5247
    public long getUserId() {
5248
      return this.userId;
5249
    }
5250
 
5251
    public getCouponUsageCountByUser_args setUserId(long userId) {
5252
      this.userId = userId;
5253
      setUserIdIsSet(true);
5254
      return this;
5255
    }
5256
 
5257
    public void unsetUserId() {
5258
      __isset_bit_vector.clear(__USERID_ISSET_ID);
5259
    }
5260
 
5261
    /** Returns true if field userId is set (has been asigned a value) and false otherwise */
5262
    public boolean isSetUserId() {
5263
      return __isset_bit_vector.get(__USERID_ISSET_ID);
5264
    }
5265
 
5266
    public void setUserIdIsSet(boolean value) {
5267
      __isset_bit_vector.set(__USERID_ISSET_ID, value);
5268
    }
5269
 
5270
    public void setFieldValue(_Fields field, Object value) {
5271
      switch (field) {
5272
      case COUPON_CODE:
5273
        if (value == null) {
5274
          unsetCouponCode();
5275
        } else {
5276
          setCouponCode((String)value);
5277
        }
5278
        break;
5279
 
5280
      case USER_ID:
5281
        if (value == null) {
5282
          unsetUserId();
5283
        } else {
5284
          setUserId((Long)value);
5285
        }
5286
        break;
5287
 
5288
      }
5289
    }
5290
 
5291
    public void setFieldValue(int fieldID, Object value) {
5292
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
5293
    }
5294
 
5295
    public Object getFieldValue(_Fields field) {
5296
      switch (field) {
5297
      case COUPON_CODE:
5298
        return getCouponCode();
5299
 
5300
      case USER_ID:
5301
        return new Long(getUserId());
5302
 
5303
      }
5304
      throw new IllegalStateException();
5305
    }
5306
 
5307
    public Object getFieldValue(int fieldId) {
5308
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
5309
    }
5310
 
5311
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
5312
    public boolean isSet(_Fields field) {
5313
      switch (field) {
5314
      case COUPON_CODE:
5315
        return isSetCouponCode();
5316
      case USER_ID:
5317
        return isSetUserId();
5318
      }
5319
      throw new IllegalStateException();
5320
    }
5321
 
5322
    public boolean isSet(int fieldID) {
5323
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
5324
    }
5325
 
5326
    @Override
5327
    public boolean equals(Object that) {
5328
      if (that == null)
5329
        return false;
5330
      if (that instanceof getCouponUsageCountByUser_args)
5331
        return this.equals((getCouponUsageCountByUser_args)that);
5332
      return false;
5333
    }
5334
 
5335
    public boolean equals(getCouponUsageCountByUser_args that) {
5336
      if (that == null)
5337
        return false;
5338
 
5339
      boolean this_present_couponCode = true && this.isSetCouponCode();
5340
      boolean that_present_couponCode = true && that.isSetCouponCode();
5341
      if (this_present_couponCode || that_present_couponCode) {
5342
        if (!(this_present_couponCode && that_present_couponCode))
5343
          return false;
5344
        if (!this.couponCode.equals(that.couponCode))
5345
          return false;
5346
      }
5347
 
5348
      boolean this_present_userId = true;
5349
      boolean that_present_userId = true;
5350
      if (this_present_userId || that_present_userId) {
5351
        if (!(this_present_userId && that_present_userId))
5352
          return false;
5353
        if (this.userId != that.userId)
5354
          return false;
5355
      }
5356
 
5357
      return true;
5358
    }
5359
 
5360
    @Override
5361
    public int hashCode() {
5362
      return 0;
5363
    }
5364
 
5365
    public int compareTo(getCouponUsageCountByUser_args other) {
5366
      if (!getClass().equals(other.getClass())) {
5367
        return getClass().getName().compareTo(other.getClass().getName());
5368
      }
5369
 
5370
      int lastComparison = 0;
5371
      getCouponUsageCountByUser_args typedOther = (getCouponUsageCountByUser_args)other;
5372
 
5373
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
5374
      if (lastComparison != 0) {
5375
        return lastComparison;
5376
      }
5377
      lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
5378
      if (lastComparison != 0) {
5379
        return lastComparison;
5380
      }
5381
      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
5382
      if (lastComparison != 0) {
5383
        return lastComparison;
5384
      }
5385
      lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
5386
      if (lastComparison != 0) {
5387
        return lastComparison;
5388
      }
5389
      return 0;
5390
    }
5391
 
5392
    public void read(TProtocol iprot) throws TException {
5393
      TField field;
5394
      iprot.readStructBegin();
5395
      while (true)
5396
      {
5397
        field = iprot.readFieldBegin();
5398
        if (field.type == TType.STOP) { 
5399
          break;
5400
        }
5401
        _Fields fieldId = _Fields.findByThriftId(field.id);
5402
        if (fieldId == null) {
5403
          TProtocolUtil.skip(iprot, field.type);
5404
        } else {
5405
          switch (fieldId) {
5406
            case COUPON_CODE:
5407
              if (field.type == TType.STRING) {
5408
                this.couponCode = iprot.readString();
5409
              } else { 
5410
                TProtocolUtil.skip(iprot, field.type);
5411
              }
5412
              break;
5413
            case USER_ID:
5414
              if (field.type == TType.I64) {
5415
                this.userId = iprot.readI64();
5416
                setUserIdIsSet(true);
5417
              } else { 
5418
                TProtocolUtil.skip(iprot, field.type);
5419
              }
5420
              break;
5421
          }
5422
          iprot.readFieldEnd();
5423
        }
5424
      }
5425
      iprot.readStructEnd();
5426
      validate();
5427
    }
5428
 
5429
    public void write(TProtocol oprot) throws TException {
5430
      validate();
5431
 
5432
      oprot.writeStructBegin(STRUCT_DESC);
5433
      if (this.couponCode != null) {
5434
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
5435
        oprot.writeString(this.couponCode);
5436
        oprot.writeFieldEnd();
5437
      }
5438
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
5439
      oprot.writeI64(this.userId);
5440
      oprot.writeFieldEnd();
5441
      oprot.writeFieldStop();
5442
      oprot.writeStructEnd();
5443
    }
5444
 
5445
    @Override
5446
    public String toString() {
5447
      StringBuilder sb = new StringBuilder("getCouponUsageCountByUser_args(");
5448
      boolean first = true;
5449
 
5450
      sb.append("couponCode:");
5451
      if (this.couponCode == null) {
5452
        sb.append("null");
5453
      } else {
5454
        sb.append(this.couponCode);
5455
      }
5456
      first = false;
5457
      if (!first) sb.append(", ");
5458
      sb.append("userId:");
5459
      sb.append(this.userId);
5460
      first = false;
5461
      sb.append(")");
5462
      return sb.toString();
5463
    }
5464
 
5465
    public void validate() throws TException {
5466
      // check for required fields
5467
    }
5468
 
5469
  }
5470
 
5471
  public static class getCouponUsageCountByUser_result implements TBase<getCouponUsageCountByUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<getCouponUsageCountByUser_result>   {
5472
    private static final TStruct STRUCT_DESC = new TStruct("getCouponUsageCountByUser_result");
5473
 
5474
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
5475
    private static final TField PEX_FIELD_DESC = new TField("pex", TType.STRUCT, (short)1);
5476
 
5477
    private long success;
5478
    private PromotionException pex;
5479
 
5480
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
5481
    public enum _Fields implements TFieldIdEnum {
5482
      SUCCESS((short)0, "success"),
5483
      PEX((short)1, "pex");
5484
 
5485
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
5486
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
5487
 
5488
      static {
5489
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
5490
          byId.put((int)field._thriftId, field);
5491
          byName.put(field.getFieldName(), field);
5492
        }
5493
      }
5494
 
5495
      /**
5496
       * Find the _Fields constant that matches fieldId, or null if its not found.
5497
       */
5498
      public static _Fields findByThriftId(int fieldId) {
5499
        return byId.get(fieldId);
5500
      }
5501
 
5502
      /**
5503
       * Find the _Fields constant that matches fieldId, throwing an exception
5504
       * if it is not found.
5505
       */
5506
      public static _Fields findByThriftIdOrThrow(int fieldId) {
5507
        _Fields fields = findByThriftId(fieldId);
5508
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
5509
        return fields;
5510
      }
5511
 
5512
      /**
5513
       * Find the _Fields constant that matches name, or null if its not found.
5514
       */
5515
      public static _Fields findByName(String name) {
5516
        return byName.get(name);
5517
      }
5518
 
5519
      private final short _thriftId;
5520
      private final String _fieldName;
5521
 
5522
      _Fields(short thriftId, String fieldName) {
5523
        _thriftId = thriftId;
5524
        _fieldName = fieldName;
5525
      }
5526
 
5527
      public short getThriftFieldId() {
5528
        return _thriftId;
5529
      }
5530
 
5531
      public String getFieldName() {
5532
        return _fieldName;
5533
      }
5534
    }
5535
 
5536
    // isset id assignments
5537
    private static final int __SUCCESS_ISSET_ID = 0;
5538
    private BitSet __isset_bit_vector = new BitSet(1);
5539
 
5540
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
5541
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
5542
          new FieldValueMetaData(TType.I64)));
5543
      put(_Fields.PEX, new FieldMetaData("pex", TFieldRequirementType.DEFAULT, 
5544
          new FieldValueMetaData(TType.STRUCT)));
5545
    }});
5546
 
5547
    static {
5548
      FieldMetaData.addStructMetaDataMap(getCouponUsageCountByUser_result.class, metaDataMap);
5549
    }
5550
 
5551
    public getCouponUsageCountByUser_result() {
5552
    }
5553
 
5554
    public getCouponUsageCountByUser_result(
5555
      long success,
5556
      PromotionException pex)
5557
    {
5558
      this();
5559
      this.success = success;
5560
      setSuccessIsSet(true);
5561
      this.pex = pex;
5562
    }
5563
 
5564
    /**
5565
     * Performs a deep copy on <i>other</i>.
5566
     */
5567
    public getCouponUsageCountByUser_result(getCouponUsageCountByUser_result other) {
5568
      __isset_bit_vector.clear();
5569
      __isset_bit_vector.or(other.__isset_bit_vector);
5570
      this.success = other.success;
5571
      if (other.isSetPex()) {
5572
        this.pex = new PromotionException(other.pex);
5573
      }
5574
    }
5575
 
5576
    public getCouponUsageCountByUser_result deepCopy() {
5577
      return new getCouponUsageCountByUser_result(this);
5578
    }
5579
 
5580
    @Deprecated
5581
    public getCouponUsageCountByUser_result clone() {
5582
      return new getCouponUsageCountByUser_result(this);
5583
    }
5584
 
5585
    public long getSuccess() {
5586
      return this.success;
5587
    }
5588
 
5589
    public getCouponUsageCountByUser_result setSuccess(long success) {
5590
      this.success = success;
5591
      setSuccessIsSet(true);
5592
      return this;
5593
    }
5594
 
5595
    public void unsetSuccess() {
5596
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
5597
    }
5598
 
5599
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
5600
    public boolean isSetSuccess() {
5601
      return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
5602
    }
5603
 
5604
    public void setSuccessIsSet(boolean value) {
5605
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
5606
    }
5607
 
5608
    public PromotionException getPex() {
5609
      return this.pex;
5610
    }
5611
 
5612
    public getCouponUsageCountByUser_result setPex(PromotionException pex) {
5613
      this.pex = pex;
5614
      return this;
5615
    }
5616
 
5617
    public void unsetPex() {
5618
      this.pex = null;
5619
    }
5620
 
5621
    /** Returns true if field pex is set (has been asigned a value) and false otherwise */
5622
    public boolean isSetPex() {
5623
      return this.pex != null;
5624
    }
5625
 
5626
    public void setPexIsSet(boolean value) {
5627
      if (!value) {
5628
        this.pex = null;
5629
      }
5630
    }
5631
 
5632
    public void setFieldValue(_Fields field, Object value) {
5633
      switch (field) {
5634
      case SUCCESS:
5635
        if (value == null) {
5636
          unsetSuccess();
5637
        } else {
5638
          setSuccess((Long)value);
5639
        }
5640
        break;
5641
 
5642
      case PEX:
5643
        if (value == null) {
5644
          unsetPex();
5645
        } else {
5646
          setPex((PromotionException)value);
5647
        }
5648
        break;
5649
 
5650
      }
5651
    }
5652
 
5653
    public void setFieldValue(int fieldID, Object value) {
5654
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
5655
    }
5656
 
5657
    public Object getFieldValue(_Fields field) {
5658
      switch (field) {
5659
      case SUCCESS:
5660
        return new Long(getSuccess());
5661
 
5662
      case PEX:
5663
        return getPex();
5664
 
5665
      }
5666
      throw new IllegalStateException();
5667
    }
5668
 
5669
    public Object getFieldValue(int fieldId) {
5670
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
5671
    }
5672
 
5673
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
5674
    public boolean isSet(_Fields field) {
5675
      switch (field) {
5676
      case SUCCESS:
5677
        return isSetSuccess();
5678
      case PEX:
5679
        return isSetPex();
5680
      }
5681
      throw new IllegalStateException();
5682
    }
5683
 
5684
    public boolean isSet(int fieldID) {
5685
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
5686
    }
5687
 
5688
    @Override
5689
    public boolean equals(Object that) {
5690
      if (that == null)
5691
        return false;
5692
      if (that instanceof getCouponUsageCountByUser_result)
5693
        return this.equals((getCouponUsageCountByUser_result)that);
5694
      return false;
5695
    }
5696
 
5697
    public boolean equals(getCouponUsageCountByUser_result that) {
5698
      if (that == null)
5699
        return false;
5700
 
5701
      boolean this_present_success = true;
5702
      boolean that_present_success = true;
5703
      if (this_present_success || that_present_success) {
5704
        if (!(this_present_success && that_present_success))
5705
          return false;
5706
        if (this.success != that.success)
5707
          return false;
5708
      }
5709
 
5710
      boolean this_present_pex = true && this.isSetPex();
5711
      boolean that_present_pex = true && that.isSetPex();
5712
      if (this_present_pex || that_present_pex) {
5713
        if (!(this_present_pex && that_present_pex))
5714
          return false;
5715
        if (!this.pex.equals(that.pex))
5716
          return false;
5717
      }
5718
 
5719
      return true;
5720
    }
5721
 
5722
    @Override
5723
    public int hashCode() {
5724
      return 0;
5725
    }
5726
 
5727
    public int compareTo(getCouponUsageCountByUser_result other) {
5728
      if (!getClass().equals(other.getClass())) {
5729
        return getClass().getName().compareTo(other.getClass().getName());
5730
      }
5731
 
5732
      int lastComparison = 0;
5733
      getCouponUsageCountByUser_result typedOther = (getCouponUsageCountByUser_result)other;
5734
 
5735
      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
5736
      if (lastComparison != 0) {
5737
        return lastComparison;
5738
      }
5739
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
5740
      if (lastComparison != 0) {
5741
        return lastComparison;
5742
      }
5743
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(isSetPex());
5744
      if (lastComparison != 0) {
5745
        return lastComparison;
5746
      }
5747
      lastComparison = TBaseHelper.compareTo(pex, typedOther.pex);
5748
      if (lastComparison != 0) {
5749
        return lastComparison;
5750
      }
5751
      return 0;
5752
    }
5753
 
5754
    public void read(TProtocol iprot) throws TException {
5755
      TField field;
5756
      iprot.readStructBegin();
5757
      while (true)
5758
      {
5759
        field = iprot.readFieldBegin();
5760
        if (field.type == TType.STOP) { 
5761
          break;
5762
        }
5763
        _Fields fieldId = _Fields.findByThriftId(field.id);
5764
        if (fieldId == null) {
5765
          TProtocolUtil.skip(iprot, field.type);
5766
        } else {
5767
          switch (fieldId) {
5768
            case SUCCESS:
5769
              if (field.type == TType.I64) {
5770
                this.success = iprot.readI64();
5771
                setSuccessIsSet(true);
5772
              } else { 
5773
                TProtocolUtil.skip(iprot, field.type);
5774
              }
5775
              break;
5776
            case PEX:
5777
              if (field.type == TType.STRUCT) {
5778
                this.pex = new PromotionException();
5779
                this.pex.read(iprot);
5780
              } else { 
5781
                TProtocolUtil.skip(iprot, field.type);
5782
              }
5783
              break;
5784
          }
5785
          iprot.readFieldEnd();
5786
        }
5787
      }
5788
      iprot.readStructEnd();
5789
      validate();
5790
    }
5791
 
5792
    public void write(TProtocol oprot) throws TException {
5793
      oprot.writeStructBegin(STRUCT_DESC);
5794
 
5795
      if (this.isSetSuccess()) {
5796
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
5797
        oprot.writeI64(this.success);
5798
        oprot.writeFieldEnd();
5799
      } else if (this.isSetPex()) {
5800
        oprot.writeFieldBegin(PEX_FIELD_DESC);
5801
        this.pex.write(oprot);
5802
        oprot.writeFieldEnd();
5803
      }
5804
      oprot.writeFieldStop();
5805
      oprot.writeStructEnd();
5806
    }
5807
 
5808
    @Override
5809
    public String toString() {
5810
      StringBuilder sb = new StringBuilder("getCouponUsageCountByUser_result(");
5811
      boolean first = true;
5812
 
5813
      sb.append("success:");
5814
      sb.append(this.success);
5815
      first = false;
5816
      if (!first) sb.append(", ");
5817
      sb.append("pex:");
5818
      if (this.pex == null) {
5819
        sb.append("null");
5820
      } else {
5821
        sb.append(this.pex);
5822
      }
5823
      first = false;
5824
      sb.append(")");
5825
      return sb.toString();
5826
    }
5827
 
5828
    public void validate() throws TException {
5829
      // check for required fields
5830
    }
5831
 
5832
  }
5833
 
5834
}