Subversion Repositories SmartDukaan

Rev

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

Rev 11592 Rev 11819
Line 33... Line 33...
33
 
33
 
34
    public Coupon getCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException;
34
    public Coupon getCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException;
35
 
35
 
36
    public boolean isGiftVoucher(String couponCode) throws PromotionException, org.apache.thrift.TException;
36
    public boolean isGiftVoucher(String couponCode) throws PromotionException, org.apache.thrift.TException;
37
 
37
 
38
    public boolean isCodApplicable(String couponCode) throws PromotionException, org.apache.thrift.TException;
38
    public boolean isCodApplicable(Cart cart) throws PromotionException, org.apache.thrift.TException;
39
 
39
 
40
    public List<Promotion> getAllPromotions() throws PromotionException, org.apache.thrift.TException;
40
    public List<Promotion> getAllPromotions() throws PromotionException, org.apache.thrift.TException;
41
 
41
 
42
    public Promotion getPromotionById(long promotionId) throws PromotionException, org.apache.thrift.TException;
42
    public Promotion getPromotionById(long promotionId) throws PromotionException, org.apache.thrift.TException;
43
 
43
 
Line 110... Line 110...
110
 
110
 
111
    public void getCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getCoupon_call> resultHandler) throws org.apache.thrift.TException;
111
    public void getCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getCoupon_call> resultHandler) throws org.apache.thrift.TException;
112
 
112
 
113
    public void isGiftVoucher(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.isGiftVoucher_call> resultHandler) throws org.apache.thrift.TException;
113
    public void isGiftVoucher(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.isGiftVoucher_call> resultHandler) throws org.apache.thrift.TException;
114
 
114
 
115
    public void isCodApplicable(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.isCodApplicable_call> resultHandler) throws org.apache.thrift.TException;
115
    public void isCodApplicable(Cart cart, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.isCodApplicable_call> resultHandler) throws org.apache.thrift.TException;
116
 
116
 
117
    public void getAllPromotions(org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getAllPromotions_call> resultHandler) throws org.apache.thrift.TException;
117
    public void getAllPromotions(org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getAllPromotions_call> resultHandler) throws org.apache.thrift.TException;
118
 
118
 
119
    public void getPromotionById(long promotionId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getPromotionById_call> resultHandler) throws org.apache.thrift.TException;
119
    public void getPromotionById(long promotionId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getPromotionById_call> resultHandler) throws org.apache.thrift.TException;
120
 
120
 
Line 278... Line 278...
278
        throw result.pex;
278
        throw result.pex;
279
      }
279
      }
280
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");
280
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");
281
    }
281
    }
282
 
282
 
283
    public boolean isCodApplicable(String couponCode) throws PromotionException, org.apache.thrift.TException
283
    public boolean isCodApplicable(Cart cart) throws PromotionException, org.apache.thrift.TException
284
    {
284
    {
285
      send_isCodApplicable(couponCode);
285
      send_isCodApplicable(cart);
286
      return recv_isCodApplicable();
286
      return recv_isCodApplicable();
287
    }
287
    }
288
 
288
 
289
    public void send_isCodApplicable(String couponCode) throws org.apache.thrift.TException
289
    public void send_isCodApplicable(Cart cart) throws org.apache.thrift.TException
290
    {
290
    {
291
      isCodApplicable_args args = new isCodApplicable_args();
291
      isCodApplicable_args args = new isCodApplicable_args();
292
      args.setCouponCode(couponCode);
292
      args.setCart(cart);
293
      sendBase("isCodApplicable", args);
293
      sendBase("isCodApplicable", args);
294
    }
294
    }
295
 
295
 
296
    public boolean recv_isCodApplicable() throws PromotionException, org.apache.thrift.TException
296
    public boolean recv_isCodApplicable() throws PromotionException, org.apache.thrift.TException
297
    {
297
    {
Line 966... Line 966...
966
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
966
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
967
        return (new Client(prot)).recv_isGiftVoucher();
967
        return (new Client(prot)).recv_isGiftVoucher();
968
      }
968
      }
969
    }
969
    }
970
 
970
 
971
    public void isCodApplicable(String couponCode, org.apache.thrift.async.AsyncMethodCallback<isCodApplicable_call> resultHandler) throws org.apache.thrift.TException {
971
    public void isCodApplicable(Cart cart, org.apache.thrift.async.AsyncMethodCallback<isCodApplicable_call> resultHandler) throws org.apache.thrift.TException {
972
      checkReady();
972
      checkReady();
973
      isCodApplicable_call method_call = new isCodApplicable_call(couponCode, resultHandler, this, ___protocolFactory, ___transport);
973
      isCodApplicable_call method_call = new isCodApplicable_call(cart, resultHandler, this, ___protocolFactory, ___transport);
974
      this.___currentMethod = method_call;
974
      this.___currentMethod = method_call;
975
      ___manager.call(method_call);
975
      ___manager.call(method_call);
976
    }
976
    }
977
 
977
 
978
    public static class isCodApplicable_call extends org.apache.thrift.async.TAsyncMethodCall {
978
    public static class isCodApplicable_call extends org.apache.thrift.async.TAsyncMethodCall {
979
      private String couponCode;
979
      private Cart cart;
980
      public isCodApplicable_call(String couponCode, org.apache.thrift.async.AsyncMethodCallback<isCodApplicable_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
980
      public isCodApplicable_call(Cart cart, org.apache.thrift.async.AsyncMethodCallback<isCodApplicable_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
981
        super(client, protocolFactory, transport, resultHandler, false);
981
        super(client, protocolFactory, transport, resultHandler, false);
982
        this.couponCode = couponCode;
982
        this.cart = cart;
983
      }
983
      }
984
 
984
 
985
      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
985
      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
986
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isCodApplicable", org.apache.thrift.protocol.TMessageType.CALL, 0));
986
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isCodApplicable", org.apache.thrift.protocol.TMessageType.CALL, 0));
987
        isCodApplicable_args args = new isCodApplicable_args();
987
        isCodApplicable_args args = new isCodApplicable_args();
988
        args.setCouponCode(couponCode);
988
        args.setCart(cart);
989
        args.write(prot);
989
        args.write(prot);
990
        prot.writeMessageEnd();
990
        prot.writeMessageEnd();
991
      }
991
      }
992
 
992
 
993
      public boolean getResult() throws PromotionException, org.apache.thrift.TException {
993
      public boolean getResult() throws PromotionException, org.apache.thrift.TException {
Line 1815... Line 1815...
1815
      }
1815
      }
1816
 
1816
 
1817
      protected isCodApplicable_result getResult(I iface, isCodApplicable_args args) throws org.apache.thrift.TException {
1817
      protected isCodApplicable_result getResult(I iface, isCodApplicable_args args) throws org.apache.thrift.TException {
1818
        isCodApplicable_result result = new isCodApplicable_result();
1818
        isCodApplicable_result result = new isCodApplicable_result();
1819
        try {
1819
        try {
1820
          result.success = iface.isCodApplicable(args.couponCode);
1820
          result.success = iface.isCodApplicable(args.cart);
1821
          result.setSuccessIsSet(true);
1821
          result.setSuccessIsSet(true);
1822
        } catch (PromotionException pex) {
1822
        } catch (PromotionException pex) {
1823
          result.pex = pex;
1823
          result.pex = pex;
1824
        }
1824
        }
1825
        return result;
1825
        return result;
Line 5085... Line 5085...
5085
  }
5085
  }
5086
 
5086
 
5087
  public static class isCodApplicable_args implements org.apache.thrift.TBase<isCodApplicable_args, isCodApplicable_args._Fields>, java.io.Serializable, Cloneable   {
5087
  public static class isCodApplicable_args implements org.apache.thrift.TBase<isCodApplicable_args, isCodApplicable_args._Fields>, java.io.Serializable, Cloneable   {
5088
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isCodApplicable_args");
5088
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isCodApplicable_args");
5089
 
5089
 
5090
    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);
5090
    private static final org.apache.thrift.protocol.TField CART_FIELD_DESC = new org.apache.thrift.protocol.TField("cart", org.apache.thrift.protocol.TType.STRUCT, (short)1);
5091
 
5091
 
5092
    private String couponCode; // required
5092
    private Cart cart; // required
5093
 
5093
 
5094
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
5094
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
5095
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
5095
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
5096
      COUPON_CODE((short)1, "couponCode");
5096
      CART((short)1, "cart");
5097
 
5097
 
5098
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
5098
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
5099
 
5099
 
5100
      static {
5100
      static {
5101
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
5101
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
Line 5106... Line 5106...
5106
      /**
5106
      /**
5107
       * Find the _Fields constant that matches fieldId, or null if its not found.
5107
       * Find the _Fields constant that matches fieldId, or null if its not found.
5108
       */
5108
       */
5109
      public static _Fields findByThriftId(int fieldId) {
5109
      public static _Fields findByThriftId(int fieldId) {
5110
        switch(fieldId) {
5110
        switch(fieldId) {
5111
          case 1: // COUPON_CODE
5111
          case 1: // CART
5112
            return COUPON_CODE;
5112
            return CART;
5113
          default:
5113
          default:
5114
            return null;
5114
            return null;
5115
        }
5115
        }
5116
      }
5116
      }
5117
 
5117
 
Line 5152... Line 5152...
5152
    // isset id assignments
5152
    // isset id assignments
5153
 
5153
 
5154
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
5154
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
5155
    static {
5155
    static {
5156
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
5156
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
5157
      tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
5157
      tmpMap.put(_Fields.CART, new org.apache.thrift.meta_data.FieldMetaData("cart", org.apache.thrift.TFieldRequirementType.DEFAULT, 
5158
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
5158
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Cart.class)));
5159
      metaDataMap = Collections.unmodifiableMap(tmpMap);
5159
      metaDataMap = Collections.unmodifiableMap(tmpMap);
5160
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isCodApplicable_args.class, metaDataMap);
5160
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isCodApplicable_args.class, metaDataMap);
5161
    }
5161
    }
5162
 
5162
 
5163
    public isCodApplicable_args() {
5163
    public isCodApplicable_args() {
5164
    }
5164
    }
5165
 
5165
 
5166
    public isCodApplicable_args(
5166
    public isCodApplicable_args(
5167
      String couponCode)
5167
      Cart cart)
5168
    {
5168
    {
5169
      this();
5169
      this();
5170
      this.couponCode = couponCode;
5170
      this.cart = cart;
5171
    }
5171
    }
5172
 
5172
 
5173
    /**
5173
    /**
5174
     * Performs a deep copy on <i>other</i>.
5174
     * Performs a deep copy on <i>other</i>.
5175
     */
5175
     */
5176
    public isCodApplicable_args(isCodApplicable_args other) {
5176
    public isCodApplicable_args(isCodApplicable_args other) {
5177
      if (other.isSetCouponCode()) {
5177
      if (other.isSetCart()) {
5178
        this.couponCode = other.couponCode;
5178
        this.cart = new Cart(other.cart);
5179
      }
5179
      }
5180
    }
5180
    }
5181
 
5181
 
5182
    public isCodApplicable_args deepCopy() {
5182
    public isCodApplicable_args deepCopy() {
5183
      return new isCodApplicable_args(this);
5183
      return new isCodApplicable_args(this);
5184
    }
5184
    }
5185
 
5185
 
5186
    @Override
5186
    @Override
5187
    public void clear() {
5187
    public void clear() {
5188
      this.couponCode = null;
5188
      this.cart = null;
5189
    }
5189
    }
5190
 
5190
 
5191
    public String getCouponCode() {
5191
    public Cart getCart() {
5192
      return this.couponCode;
5192
      return this.cart;
5193
    }
5193
    }
5194
 
5194
 
5195
    public void setCouponCode(String couponCode) {
5195
    public void setCart(Cart cart) {
5196
      this.couponCode = couponCode;
5196
      this.cart = cart;
5197
    }
5197
    }
5198
 
5198
 
5199
    public void unsetCouponCode() {
5199
    public void unsetCart() {
5200
      this.couponCode = null;
5200
      this.cart = null;
5201
    }
5201
    }
5202
 
5202
 
5203
    /** Returns true if field couponCode is set (has been assigned a value) and false otherwise */
5203
    /** Returns true if field cart is set (has been assigned a value) and false otherwise */
5204
    public boolean isSetCouponCode() {
5204
    public boolean isSetCart() {
5205
      return this.couponCode != null;
5205
      return this.cart != null;
5206
    }
5206
    }
5207
 
5207
 
5208
    public void setCouponCodeIsSet(boolean value) {
5208
    public void setCartIsSet(boolean value) {
5209
      if (!value) {
5209
      if (!value) {
5210
        this.couponCode = null;
5210
        this.cart = null;
5211
      }
5211
      }
5212
    }
5212
    }
5213
 
5213
 
5214
    public void setFieldValue(_Fields field, Object value) {
5214
    public void setFieldValue(_Fields field, Object value) {
5215
      switch (field) {
5215
      switch (field) {
5216
      case COUPON_CODE:
5216
      case CART:
5217
        if (value == null) {
5217
        if (value == null) {
5218
          unsetCouponCode();
5218
          unsetCart();
5219
        } else {
5219
        } else {
5220
          setCouponCode((String)value);
5220
          setCart((Cart)value);
5221
        }
5221
        }
5222
        break;
5222
        break;
5223
 
5223
 
5224
      }
5224
      }
5225
    }
5225
    }
5226
 
5226
 
5227
    public Object getFieldValue(_Fields field) {
5227
    public Object getFieldValue(_Fields field) {
5228
      switch (field) {
5228
      switch (field) {
5229
      case COUPON_CODE:
5229
      case CART:
5230
        return getCouponCode();
5230
        return getCart();
5231
 
5231
 
5232
      }
5232
      }
5233
      throw new IllegalStateException();
5233
      throw new IllegalStateException();
5234
    }
5234
    }
5235
 
5235
 
Line 5238... Line 5238...
5238
      if (field == null) {
5238
      if (field == null) {
5239
        throw new IllegalArgumentException();
5239
        throw new IllegalArgumentException();
5240
      }
5240
      }
5241
 
5241
 
5242
      switch (field) {
5242
      switch (field) {
5243
      case COUPON_CODE:
5243
      case CART:
5244
        return isSetCouponCode();
5244
        return isSetCart();
5245
      }
5245
      }
5246
      throw new IllegalStateException();
5246
      throw new IllegalStateException();
5247
    }
5247
    }
5248
 
5248
 
5249
    @Override
5249
    @Override
Line 5257... Line 5257...
5257
 
5257
 
5258
    public boolean equals(isCodApplicable_args that) {
5258
    public boolean equals(isCodApplicable_args that) {
5259
      if (that == null)
5259
      if (that == null)
5260
        return false;
5260
        return false;
5261
 
5261
 
5262
      boolean this_present_couponCode = true && this.isSetCouponCode();
5262
      boolean this_present_cart = true && this.isSetCart();
5263
      boolean that_present_couponCode = true && that.isSetCouponCode();
5263
      boolean that_present_cart = true && that.isSetCart();
5264
      if (this_present_couponCode || that_present_couponCode) {
5264
      if (this_present_cart || that_present_cart) {
5265
        if (!(this_present_couponCode && that_present_couponCode))
5265
        if (!(this_present_cart && that_present_cart))
5266
          return false;
5266
          return false;
5267
        if (!this.couponCode.equals(that.couponCode))
5267
        if (!this.cart.equals(that.cart))
5268
          return false;
5268
          return false;
5269
      }
5269
      }
5270
 
5270
 
5271
      return true;
5271
      return true;
5272
    }
5272
    }
Line 5282... Line 5282...
5282
      }
5282
      }
5283
 
5283
 
5284
      int lastComparison = 0;
5284
      int lastComparison = 0;
5285
      isCodApplicable_args typedOther = (isCodApplicable_args)other;
5285
      isCodApplicable_args typedOther = (isCodApplicable_args)other;
5286
 
5286
 
5287
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
5287
      lastComparison = Boolean.valueOf(isSetCart()).compareTo(typedOther.isSetCart());
5288
      if (lastComparison != 0) {
5288
      if (lastComparison != 0) {
5289
        return lastComparison;
5289
        return lastComparison;
5290
      }
5290
      }
5291
      if (isSetCouponCode()) {
5291
      if (isSetCart()) {
5292
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
5292
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cart, typedOther.cart);
5293
        if (lastComparison != 0) {
5293
        if (lastComparison != 0) {
5294
          return lastComparison;
5294
          return lastComparison;
5295
        }
5295
        }
5296
      }
5296
      }
5297
      return 0;
5297
      return 0;
Line 5309... Line 5309...
5309
        field = iprot.readFieldBegin();
5309
        field = iprot.readFieldBegin();
5310
        if (field.type == org.apache.thrift.protocol.TType.STOP) { 
5310
        if (field.type == org.apache.thrift.protocol.TType.STOP) { 
5311
          break;
5311
          break;
5312
        }
5312
        }
5313
        switch (field.id) {
5313
        switch (field.id) {
5314
          case 1: // COUPON_CODE
5314
          case 1: // CART
5315
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
5315
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
-
 
5316
              this.cart = new Cart();
5316
              this.couponCode = iprot.readString();
5317
              this.cart.read(iprot);
5317
            } else { 
5318
            } else { 
5318
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
5319
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
5319
            }
5320
            }
5320
            break;
5321
            break;
5321
          default:
5322
          default:
Line 5329... Line 5330...
5329
 
5330
 
5330
    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
5331
    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
5331
      validate();
5332
      validate();
5332
 
5333
 
5333
      oprot.writeStructBegin(STRUCT_DESC);
5334
      oprot.writeStructBegin(STRUCT_DESC);
5334
      if (this.couponCode != null) {
5335
      if (this.cart != null) {
5335
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
5336
        oprot.writeFieldBegin(CART_FIELD_DESC);
5336
        oprot.writeString(this.couponCode);
5337
        this.cart.write(oprot);
5337
        oprot.writeFieldEnd();
5338
        oprot.writeFieldEnd();
5338
      }
5339
      }
5339
      oprot.writeFieldStop();
5340
      oprot.writeFieldStop();
5340
      oprot.writeStructEnd();
5341
      oprot.writeStructEnd();
5341
    }
5342
    }
Line 5343... Line 5344...
5343
    @Override
5344
    @Override
5344
    public String toString() {
5345
    public String toString() {
5345
      StringBuilder sb = new StringBuilder("isCodApplicable_args(");
5346
      StringBuilder sb = new StringBuilder("isCodApplicable_args(");
5346
      boolean first = true;
5347
      boolean first = true;
5347
 
5348
 
5348
      sb.append("couponCode:");
5349
      sb.append("cart:");
5349
      if (this.couponCode == null) {
5350
      if (this.cart == null) {
5350
        sb.append("null");
5351
        sb.append("null");
5351
      } else {
5352
      } else {
5352
        sb.append(this.couponCode);
5353
        sb.append(this.cart);
5353
      }
5354
      }
5354
      first = false;
5355
      first = false;
5355
      sb.append(")");
5356
      sb.append(")");
5356
      return sb.toString();
5357
      return sb.toString();
5357
    }
5358
    }