Class CouponWsUtils


  • public class CouponWsUtils
    extends java.lang.Object
    Some common utility methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      CouponWsUtils()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assertValidMultiCodeCoupon​(AbstractCouponModel couponModel, java.lang.String couponId)
      Given the couponModel and couponId string, checks for instance of MultiCode Coupon, otherwise throws exception
      void assertValidSingleCodeCoupon​(AbstractCouponModel couponModel, java.lang.String couponId)
      Given the couponModel and couponId string, checks for instance of SingleCode Coupon, otherwise throws exception
      AbstractCouponModel getCouponById​(java.lang.String couponId)
      Given the couponId string, checks for instance of Coupon, otherwise throws exception
      protected CouponDao getCouponDao()  
      java.util.function.Function<java.util.Date,​java.lang.String> getDateToStringMapper()
      Returns mapping function from Date (at UTC time zone) into String (in ISO date time format)
      java.util.function.Function<java.lang.String,​java.util.Date> getStringToDateMapper()
      Returns mapping function from String (in ISO date time format) into Date (at UTC time zone)
      MultiCodeCouponModel getValidMultiCodeCoupon​(java.lang.String couponId)
      Given the couponId string, checks for instance of MultiCode Coupon, otherwise throws exception
      void setCouponDao​(CouponDao couponDao)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CouponWsUtils

        public CouponWsUtils()
    • Method Detail

      • getStringToDateMapper

        public java.util.function.Function<java.lang.String,​java.util.Date> getStringToDateMapper()
        Returns mapping function from String (in ISO date time format) into Date (at UTC time zone)
      • getDateToStringMapper

        public java.util.function.Function<java.util.Date,​java.lang.String> getDateToStringMapper()
        Returns mapping function from Date (at UTC time zone) into String (in ISO date time format)
      • assertValidSingleCodeCoupon

        public void assertValidSingleCodeCoupon​(AbstractCouponModel couponModel,
                                                java.lang.String couponId)
        Given the couponModel and couponId string, checks for instance of SingleCode Coupon, otherwise throws exception
        Parameters:
        couponModel -
        couponId -
      • assertValidMultiCodeCoupon

        public void assertValidMultiCodeCoupon​(AbstractCouponModel couponModel,
                                               java.lang.String couponId)
        Given the couponModel and couponId string, checks for instance of MultiCode Coupon, otherwise throws exception
        Parameters:
        couponModel -
        couponId -
      • getValidMultiCodeCoupon

        public MultiCodeCouponModel getValidMultiCodeCoupon​(java.lang.String couponId)
        Given the couponId string, checks for instance of MultiCode Coupon, otherwise throws exception
        Parameters:
        couponId - a string to be used to find MultiCode coupon
        Returns:
        - an instance of MultiCodeCouponModel
      • getCouponById

        public AbstractCouponModel getCouponById​(java.lang.String couponId)
        Given the couponId string, checks for instance of Coupon, otherwise throws exception
        Parameters:
        couponId - a string to be used to find Coupon
        Returns:
        AbstractCouponModel - an instance of AbstractCouponModel
      • getCouponDao

        protected CouponDao getCouponDao()
      • setCouponDao

        public void setCouponDao​(CouponDao couponDao)