// Adding the new coupon by giving the coupon details @Override public ResponseMessage coupons(ServiceExecutionContext ctx, CouponDetails couponsDetails) throws ExecException { response.setMessage("could not add the new coupon"); response.setMessage("coupen is not added"); response.setStatus("500"); try { if (couponsDetails == null || couponsDetails.getCoupon() == null || couponsDetails.getCoupon().trim().isEmpty() || couponsDetails.getFromDate() == null || couponsDetails.getFromDate().trim().isEmpty() || couponsDetails.getToDate() == null || couponsDetails.getToDate().trim().isEmpty()) { throw new ExecException(ErrorCodes.MISSING_FIELD, null, "Mandatory Fields are missing"); } // adding coupon in the DB boolean couponFlag = couponDAO.addCoupons(couponsDetails); if (couponFlag == true) { response.setMessage("couponadded successfully"); response.setStatus("200"); } } catch (ExecException m) { logger.error("Error while adding the coupen" + m.getMessage()); throw m; } catch (Exception e) { logger.error("Error while adding the coupen" + e.getMessage()); throw new ExecException(ErrorCodes.APPLICATION_ERROR, e, e.getMessage()); } return response; }