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()); } }
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()); } }