Subversion Repositories SmartDukaan

Rev

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