Exemplo n.º 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());
    }
  }
Exemplo n.º 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());
    }
  }