Subversion Repositories SmartDukaan

Rev

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

Rev 1177 Rev 1466
Line 105... Line 105...
105
    public long createOrders(long cartId) throws ShoppingCartException, TException;
105
    public long createOrders(long cartId) throws ShoppingCartException, TException;
106
 
106
 
107
    /**
107
    /**
108
     * Validates that:
108
     * Validates that:
109
     * 1. The checkout timestamp is greater than the updatedOn timestamp.
109
     * 1. The checkout timestamp is greater than the updatedOn timestamp.
110
     * 2. None of the lines in the cart for an inactive item.
110
     * 2. All of the lines in the cart are active items.
111
     * 3. The estimate for any of the lines in cart doesn't change.
111
     * 3. The estimate for any of the lines in cart doesn't change.
112
     * Returns true only if all three hold.
112
     * If all three are true, returns empty string; else returns appropriate message.
113
     * 
113
     * 
114
     * @param cartId
114
     * @param cartId
115
     */
115
     */
116
    public boolean validateCart(long cartId) throws ShoppingCartException, TException;
116
    public String validateCart(long cartId) throws ShoppingCartException, TException;
117
 
117
 
118
    /**
118
    /**
119
     * Merges the lines from the first cart into the second cart. Lines with duplicate items are removed.
119
     * Merges the lines from the first cart into the second cart. Lines with duplicate items are removed.
120
     * 
120
     * 
121
     * @param fromCartId
121
     * @param fromCartId
Line 1375... Line 1375...
1375
        throw result.scx;
1375
        throw result.scx;
1376
      }
1376
      }
1377
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "createOrders failed: unknown result");
1377
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "createOrders failed: unknown result");
1378
    }
1378
    }
1379
 
1379
 
1380
    public boolean validateCart(long cartId) throws ShoppingCartException, TException
1380
    public String validateCart(long cartId) throws ShoppingCartException, TException
1381
    {
1381
    {
1382
      send_validateCart(cartId);
1382
      send_validateCart(cartId);
1383
      return recv_validateCart();
1383
      return recv_validateCart();
1384
    }
1384
    }
1385
 
1385
 
Line 1391... Line 1391...
1391
      args.write(oprot_);
1391
      args.write(oprot_);
1392
      oprot_.writeMessageEnd();
1392
      oprot_.writeMessageEnd();
1393
      oprot_.getTransport().flush();
1393
      oprot_.getTransport().flush();
1394
    }
1394
    }
1395
 
1395
 
1396
    public boolean recv_validateCart() throws ShoppingCartException, TException
1396
    public String recv_validateCart() throws ShoppingCartException, TException
1397
    {
1397
    {
1398
      TMessage msg = iprot_.readMessageBegin();
1398
      TMessage msg = iprot_.readMessageBegin();
1399
      if (msg.type == TMessageType.EXCEPTION) {
1399
      if (msg.type == TMessageType.EXCEPTION) {
1400
        TApplicationException x = TApplicationException.read(iprot_);
1400
        TApplicationException x = TApplicationException.read(iprot_);
1401
        iprot_.readMessageEnd();
1401
        iprot_.readMessageEnd();
Line 2730... Line 2730...
2730
        args.read(iprot);
2730
        args.read(iprot);
2731
        iprot.readMessageEnd();
2731
        iprot.readMessageEnd();
2732
        validateCart_result result = new validateCart_result();
2732
        validateCart_result result = new validateCart_result();
2733
        try {
2733
        try {
2734
          result.success = iface_.validateCart(args.cartId);
2734
          result.success = iface_.validateCart(args.cartId);
2735
          result.setSuccessIsSet(true);
-
 
2736
        } catch (ShoppingCartException scex) {
2735
        } catch (ShoppingCartException scex) {
2737
          result.scex = scex;
2736
          result.scex = scex;
2738
        } catch (Throwable th) {
2737
        } catch (Throwable th) {
2739
          LOGGER.error("Internal error processing validateCart", th);
2738
          LOGGER.error("Internal error processing validateCart", th);
2740
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing validateCart");
2739
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing validateCart");
Line 26296... Line 26295...
26296
  }
26295
  }
26297
 
26296
 
26298
  public static class validateCart_result implements TBase<validateCart_result._Fields>, java.io.Serializable, Cloneable, Comparable<validateCart_result>   {
26297
  public static class validateCart_result implements TBase<validateCart_result._Fields>, java.io.Serializable, Cloneable, Comparable<validateCart_result>   {
26299
    private static final TStruct STRUCT_DESC = new TStruct("validateCart_result");
26298
    private static final TStruct STRUCT_DESC = new TStruct("validateCart_result");
26300
 
26299
 
26301
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);
26300
    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRING, (short)0);
26302
    private static final TField SCEX_FIELD_DESC = new TField("scex", TType.STRUCT, (short)1);
26301
    private static final TField SCEX_FIELD_DESC = new TField("scex", TType.STRUCT, (short)1);
26303
 
26302
 
26304
    private boolean success;
26303
    private String success;
26305
    private ShoppingCartException scex;
26304
    private ShoppingCartException scex;
26306
 
26305
 
26307
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
26306
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
26308
    public enum _Fields implements TFieldIdEnum {
26307
    public enum _Fields implements TFieldIdEnum {
26309
      SUCCESS((short)0, "success"),
26308
      SUCCESS((short)0, "success"),
Line 26359... Line 26358...
26359
        return _fieldName;
26358
        return _fieldName;
26360
      }
26359
      }
26361
    }
26360
    }
26362
 
26361
 
26363
    // isset id assignments
26362
    // isset id assignments
26364
    private static final int __SUCCESS_ISSET_ID = 0;
-
 
26365
    private BitSet __isset_bit_vector = new BitSet(1);
-
 
26366
 
26363
 
26367
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
26364
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
26368
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
26365
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
26369
          new FieldValueMetaData(TType.BOOL)));
26366
          new FieldValueMetaData(TType.STRING)));
26370
      put(_Fields.SCEX, new FieldMetaData("scex", TFieldRequirementType.DEFAULT, 
26367
      put(_Fields.SCEX, new FieldMetaData("scex", TFieldRequirementType.DEFAULT, 
26371
          new FieldValueMetaData(TType.STRUCT)));
26368
          new FieldValueMetaData(TType.STRUCT)));
26372
    }});
26369
    }});
26373
 
26370
 
26374
    static {
26371
    static {
Line 26377... Line 26374...
26377
 
26374
 
26378
    public validateCart_result() {
26375
    public validateCart_result() {
26379
    }
26376
    }
26380
 
26377
 
26381
    public validateCart_result(
26378
    public validateCart_result(
26382
      boolean success,
26379
      String success,
26383
      ShoppingCartException scex)
26380
      ShoppingCartException scex)
26384
    {
26381
    {
26385
      this();
26382
      this();
26386
      this.success = success;
26383
      this.success = success;
26387
      setSuccessIsSet(true);
-
 
26388
      this.scex = scex;
26384
      this.scex = scex;
26389
    }
26385
    }
26390
 
26386
 
26391
    /**
26387
    /**
26392
     * Performs a deep copy on <i>other</i>.
26388
     * Performs a deep copy on <i>other</i>.
26393
     */
26389
     */
26394
    public validateCart_result(validateCart_result other) {
26390
    public validateCart_result(validateCart_result other) {
26395
      __isset_bit_vector.clear();
26391
      if (other.isSetSuccess()) {
26396
      __isset_bit_vector.or(other.__isset_bit_vector);
-
 
26397
      this.success = other.success;
26392
        this.success = other.success;
-
 
26393
      }
26398
      if (other.isSetScex()) {
26394
      if (other.isSetScex()) {
26399
        this.scex = new ShoppingCartException(other.scex);
26395
        this.scex = new ShoppingCartException(other.scex);
26400
      }
26396
      }
26401
    }
26397
    }
26402
 
26398
 
Line 26407... Line 26403...
26407
    @Deprecated
26403
    @Deprecated
26408
    public validateCart_result clone() {
26404
    public validateCart_result clone() {
26409
      return new validateCart_result(this);
26405
      return new validateCart_result(this);
26410
    }
26406
    }
26411
 
26407
 
26412
    public boolean isSuccess() {
26408
    public String getSuccess() {
26413
      return this.success;
26409
      return this.success;
26414
    }
26410
    }
26415
 
26411
 
26416
    public validateCart_result setSuccess(boolean success) {
26412
    public validateCart_result setSuccess(String success) {
26417
      this.success = success;
26413
      this.success = success;
26418
      setSuccessIsSet(true);
-
 
26419
      return this;
26414
      return this;
26420
    }
26415
    }
26421
 
26416
 
26422
    public void unsetSuccess() {
26417
    public void unsetSuccess() {
26423
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
26418
      this.success = null;
26424
    }
26419
    }
26425
 
26420
 
26426
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
26421
    /** Returns true if field success is set (has been asigned a value) and false otherwise */
26427
    public boolean isSetSuccess() {
26422
    public boolean isSetSuccess() {
26428
      return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
26423
      return this.success != null;
26429
    }
26424
    }
26430
 
26425
 
26431
    public void setSuccessIsSet(boolean value) {
26426
    public void setSuccessIsSet(boolean value) {
-
 
26427
      if (!value) {
26432
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
26428
        this.success = null;
-
 
26429
      }
26433
    }
26430
    }
26434
 
26431
 
26435
    public ShoppingCartException getScex() {
26432
    public ShoppingCartException getScex() {
26436
      return this.scex;
26433
      return this.scex;
26437
    }
26434
    }
Line 26460... Line 26457...
26460
      switch (field) {
26457
      switch (field) {
26461
      case SUCCESS:
26458
      case SUCCESS:
26462
        if (value == null) {
26459
        if (value == null) {
26463
          unsetSuccess();
26460
          unsetSuccess();
26464
        } else {
26461
        } else {
26465
          setSuccess((Boolean)value);
26462
          setSuccess((String)value);
26466
        }
26463
        }
26467
        break;
26464
        break;
26468
 
26465
 
26469
      case SCEX:
26466
      case SCEX:
26470
        if (value == null) {
26467
        if (value == null) {
Line 26482... Line 26479...
26482
    }
26479
    }
26483
 
26480
 
26484
    public Object getFieldValue(_Fields field) {
26481
    public Object getFieldValue(_Fields field) {
26485
      switch (field) {
26482
      switch (field) {
26486
      case SUCCESS:
26483
      case SUCCESS:
26487
        return new Boolean(isSuccess());
26484
        return getSuccess();
26488
 
26485
 
26489
      case SCEX:
26486
      case SCEX:
26490
        return getScex();
26487
        return getScex();
26491
 
26488
 
26492
      }
26489
      }
Line 26523... Line 26520...
26523
 
26520
 
26524
    public boolean equals(validateCart_result that) {
26521
    public boolean equals(validateCart_result that) {
26525
      if (that == null)
26522
      if (that == null)
26526
        return false;
26523
        return false;
26527
 
26524
 
26528
      boolean this_present_success = true;
26525
      boolean this_present_success = true && this.isSetSuccess();
26529
      boolean that_present_success = true;
26526
      boolean that_present_success = true && that.isSetSuccess();
26530
      if (this_present_success || that_present_success) {
26527
      if (this_present_success || that_present_success) {
26531
        if (!(this_present_success && that_present_success))
26528
        if (!(this_present_success && that_present_success))
26532
          return false;
26529
          return false;
26533
        if (this.success != that.success)
26530
        if (!this.success.equals(that.success))
26534
          return false;
26531
          return false;
26535
      }
26532
      }
26536
 
26533
 
26537
      boolean this_present_scex = true && this.isSetScex();
26534
      boolean this_present_scex = true && this.isSetScex();
26538
      boolean that_present_scex = true && that.isSetScex();
26535
      boolean that_present_scex = true && that.isSetScex();
Line 26591... Line 26588...
26591
        if (fieldId == null) {
26588
        if (fieldId == null) {
26592
          TProtocolUtil.skip(iprot, field.type);
26589
          TProtocolUtil.skip(iprot, field.type);
26593
        } else {
26590
        } else {
26594
          switch (fieldId) {
26591
          switch (fieldId) {
26595
            case SUCCESS:
26592
            case SUCCESS:
26596
              if (field.type == TType.BOOL) {
26593
              if (field.type == TType.STRING) {
26597
                this.success = iprot.readBool();
26594
                this.success = iprot.readString();
26598
                setSuccessIsSet(true);
-
 
26599
              } else { 
26595
              } else { 
26600
                TProtocolUtil.skip(iprot, field.type);
26596
                TProtocolUtil.skip(iprot, field.type);
26601
              }
26597
              }
26602
              break;
26598
              break;
26603
            case SCEX:
26599
            case SCEX:
Line 26619... Line 26615...
26619
    public void write(TProtocol oprot) throws TException {
26615
    public void write(TProtocol oprot) throws TException {
26620
      oprot.writeStructBegin(STRUCT_DESC);
26616
      oprot.writeStructBegin(STRUCT_DESC);
26621
 
26617
 
26622
      if (this.isSetSuccess()) {
26618
      if (this.isSetSuccess()) {
26623
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
26619
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
26624
        oprot.writeBool(this.success);
26620
        oprot.writeString(this.success);
26625
        oprot.writeFieldEnd();
26621
        oprot.writeFieldEnd();
26626
      } else if (this.isSetScex()) {
26622
      } else if (this.isSetScex()) {
26627
        oprot.writeFieldBegin(SCEX_FIELD_DESC);
26623
        oprot.writeFieldBegin(SCEX_FIELD_DESC);
26628
        this.scex.write(oprot);
26624
        this.scex.write(oprot);
26629
        oprot.writeFieldEnd();
26625
        oprot.writeFieldEnd();
Line 26636... Line 26632...
26636
    public String toString() {
26632
    public String toString() {
26637
      StringBuilder sb = new StringBuilder("validateCart_result(");
26633
      StringBuilder sb = new StringBuilder("validateCart_result(");
26638
      boolean first = true;
26634
      boolean first = true;
26639
 
26635
 
26640
      sb.append("success:");
26636
      sb.append("success:");
-
 
26637
      if (this.success == null) {
-
 
26638
        sb.append("null");
-
 
26639
      } else {
26641
      sb.append(this.success);
26640
        sb.append(this.success);
-
 
26641
      }
26642
      first = false;
26642
      first = false;
26643
      if (!first) sb.append(", ");
26643
      if (!first) sb.append(", ");
26644
      sb.append("scex:");
26644
      sb.append("scex:");
26645
      if (this.scex == null) {
26645
      if (this.scex == null) {
26646
        sb.append("null");
26646
        sb.append("null");