Subversion Repositories SmartDukaan

Rev

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

Rev 2981 Rev 3374
Line 26... Line 26...
26
public class PromotionService {
26
public class PromotionService {
27
 
27
 
28
  /**
28
  /**
29
   * Promotion Service
29
   * Promotion Service
30
   */
30
   */
31
  public interface Iface {
31
  public interface Iface extends in.shop2020.generic.GenericService.Iface {
32
 
32
 
33
    /**
33
    /**
34
     * For closing the open session in sqlalchemy
34
     * For closing the open session in sqlalchemy
35
     */
35
     */
36
    public void closeSession() throws TException;
36
    public void closeSession() throws TException;
Line 49... Line 49...
49
 
49
 
50
    public long getCouponUsageCountByUser(String couponCode, long userId) throws PromotionException, TException;
50
    public long getCouponUsageCountByUser(String couponCode, long userId) throws PromotionException, TException;
51
 
51
 
52
  }
52
  }
53
 
53
 
54
  public static class Client implements Iface {
54
  public static class Client extends in.shop2020.generic.GenericService.Client implements Iface {
55
    public Client(TProtocol prot)
55
    public Client(TProtocol prot)
56
    {
56
    {
57
      this(prot, prot);
57
      this(prot, prot);
58
    }
58
    }
59
 
59
 
60
    public Client(TProtocol iprot, TProtocol oprot)
60
    public Client(TProtocol iprot, TProtocol oprot)
61
    {
61
    {
62
      iprot_ = iprot;
-
 
63
      oprot_ = oprot;
62
      super(iprot, 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
    }
63
    }
80
 
64
 
81
    public void closeSession() throws TException
65
    public void closeSession() throws TException
82
    {
66
    {
83
      send_closeSession();
67
      send_closeSession();
Line 356... Line 340...
356
      }
340
      }
357
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");
341
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");
358
    }
342
    }
359
 
343
 
360
  }
344
  }
361
  public static class Processor implements TProcessor {
345
  public static class Processor extends in.shop2020.generic.GenericService.Processor implements TProcessor {
362
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
346
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
363
    public Processor(Iface iface)
347
    public Processor(Iface iface)
364
    {
348
    {
-
 
349
      super(iface);
365
      iface_ = iface;
350
      iface_ = iface;
366
      processMap_.put("closeSession", new closeSession());
351
      processMap_.put("closeSession", new closeSession());
367
      processMap_.put("createPromotion", new createPromotion());
352
      processMap_.put("createPromotion", new createPromotion());
368
      processMap_.put("getAllPromotions", new getAllPromotions());
353
      processMap_.put("getAllPromotions", new getAllPromotions());
369
      processMap_.put("getPromotionById", new getPromotionById());
354
      processMap_.put("getPromotionById", new getPromotionById());
Line 371... Line 356...
371
      processMap_.put("applyCoupon", new applyCoupon());
356
      processMap_.put("applyCoupon", new applyCoupon());
372
      processMap_.put("trackCouponUsage", new trackCouponUsage());
357
      processMap_.put("trackCouponUsage", new trackCouponUsage());
373
      processMap_.put("getCouponUsageCountByUser", new getCouponUsageCountByUser());
358
      processMap_.put("getCouponUsageCountByUser", new getCouponUsageCountByUser());
374
    }
359
    }
375
 
360
 
376
    protected static interface ProcessFunction {
-
 
377
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
-
 
378
    }
-
 
379
 
-
 
380
    private Iface iface_;
361
    private Iface iface_;
381
    protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();
-
 
382
 
362
 
383
    public boolean process(TProtocol iprot, TProtocol oprot) throws TException
363
    public boolean process(TProtocol iprot, TProtocol oprot) throws TException
384
    {
364
    {
385
      TMessage msg = iprot.readMessageBegin();
365
      TMessage msg = iprot.readMessageBegin();
386
      ProcessFunction fn = processMap_.get(msg.name);
366
      ProcessFunction fn = processMap_.get(msg.name);