示例#1
0
  private void expireCoupon(long couponId) {
    System.out.println("expiering coupon with id : " + couponId);

    try {
      Coupon coupon = compFacade.getCoupon(couponId);
      coupon.setEndDate(new Date()); // the DailyCouponExpirationTask will delete this coupon
      compFacade.updateCoupon(coupon);
    } catch (Exception e) {
      logger.error("expireCoupon failed : " + e.toString());
    }
  }
示例#2
0
  private void updateCoupon(long couponId) {
    System.out.println("updating coupon with id : " + couponId);

    try {
      Coupon coupon = compFacade.getCoupon(couponId);
      coupon.setAmount(100);
      coupon.setPrice(coupon.getPrice() / 2);
      compFacade.updateCoupon(coupon);
    } catch (Exception e) {
      logger.error("updateCoupon failed : " + e.toString());
    }
  }