Class AbstractCouponWsFacades<D extends AbstractCouponWsDTO,M extends AbstractCouponModel>
- java.lang.Object
-
- de.hybris.platform.couponwebservices.facades.impl.AbstractCouponWsFacades<D,M>
-
- All Implemented Interfaces:
CouponWsFacades<D>
- Direct Known Subclasses:
DefaultMultiCodeCouponWsFacades,DefaultSingleCodeCouponWsFacades
public abstract class AbstractCouponWsFacades<D extends AbstractCouponWsDTO,M extends AbstractCouponModel> extends java.lang.Object implements CouponWsFacades<D>
Abstract implementation of CouponWsFacades interface
-
-
Constructor Summary
Constructors Constructor Description AbstractCouponWsFacades()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidassertCouponModelType(AbstractCouponModel couponModel, java.lang.String couponId)protected voidassertCouponNotActive(AbstractCouponModel couponModel, java.lang.String message)protected SearchPageDatabuildSearchPageData(PaginationData pagination, java.util.List<SortData> sorts)protected abstract java.util.Optional<D>convert(AbstractCouponModel couponModel)protected <S extends AbstractCouponModel>
SearchPageData<D>convertSearchPageData(SearchPageData<S> source)Converts the result ofSearchPageDataprotected <S extends AbstractCouponModel>
SearchPageData<D>convertSearchPageData(SearchPageData<S> source)Converts the result ofSearchPageDataDcreateCoupon(D coupon)Creates the coupon, given the coupon data.protected abstract McreateCouponModel(D couponWsDTO)protected CouponDaogetCouponDao()protected abstract java.lang.StringgetCouponId(java.lang.String couponCode)protected abstract PaginatedGenericDao<M>getCouponPaginatedGenericDao()SearchPageDatagetCoupons(PaginationData pagination, java.util.List<SortData> sorts)Returns a restricted size list (page) of available couponsprotected CouponServicegetCouponService()protected Converter<CouponResponse,CouponValidationResponseWsDTO>getCouponValidationResponseWsDTOConverter()DgetCouponWsDTO(java.lang.String couponId)Given the couponId string, returns the coupon DTO, otherwise throws exceptionprotected CouponWsUtilsgetCouponWsUtils()protected ModelServicegetModelService()protected UserServicegetUserService()voidsetCouponDao(CouponDao couponDao)voidsetCouponService(CouponService couponService)voidsetCouponValidationResponseWsDTOConverter(Converter<CouponResponse,CouponValidationResponseWsDTO> couponValidationResponseWsDTOConverter)voidsetCouponWsUtils(CouponWsUtils couponWsUtils)voidsetModelService(ModelService modelService)voidsetUserService(UserService userService)voidupdateCoupon(D coupon)Updates the coupon identified by it couponIdprotected abstract MupdateCouponModel(D couponWsDTO)voidupdateCouponStatus(java.lang.String couponId, java.lang.Boolean active)Updates status of a coupon identified by it couponIdCouponValidationResponseWsDTOvalidateCoupon(java.lang.String couponCode)Validates the given couponId, throws an exception if coupon id is invalidCouponValidationResponseWsDTOvalidateCoupon(java.lang.String couponCode, java.lang.String customerId)Validates the given couponId for the given customer, throws an exception if coupon id or customer id is invalid
-
-
-
Method Detail
-
getCouponWsDTO
@Cacheable(value="couponWsCache", key="T(de.hybris.platform.webservicescommons.cache.CacheKeyGenerator).generateKey(false,false,\'getCouponWsDTO\',#value)") public D getCouponWsDTO(java.lang.String couponId)Description copied from interface:CouponWsFacadesGiven the couponId string, returns the coupon DTO, otherwise throws exception- Specified by:
getCouponWsDTOin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
couponId- a string to be used to find a coupon- Returns:
- - an instance of coupon DTO
-
createCoupon
public D createCoupon(D coupon)
Description copied from interface:CouponWsFacadesCreates the coupon, given the coupon data. Throws exception otherwise- Specified by:
createCouponin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
coupon- - data to create coupon with- Returns:
- - a new instance of coupon
-
updateCoupon
public void updateCoupon(D coupon)
Description copied from interface:CouponWsFacadesUpdates the coupon identified by it couponId- Specified by:
updateCouponin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
coupon- - data to update coupon with
-
updateCouponStatus
public void updateCouponStatus(java.lang.String couponId, java.lang.Boolean active)Description copied from interface:CouponWsFacadesUpdates status of a coupon identified by it couponId- Specified by:
updateCouponStatusin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
couponId- - identifier of a coupon to set statusactive- - coupon status to set
-
validateCoupon
public CouponValidationResponseWsDTO validateCoupon(java.lang.String couponCode)
Description copied from interface:CouponWsFacadesValidates the given couponId, throws an exception if coupon id is invalid- Specified by:
validateCouponin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
couponCode- a string to be used to validate a coupon- Returns:
- - an instance of
CouponValidationResponseWsDTO
-
validateCoupon
public CouponValidationResponseWsDTO validateCoupon(java.lang.String couponCode, java.lang.String customerId)
Description copied from interface:CouponWsFacadesValidates the given couponId for the given customer, throws an exception if coupon id or customer id is invalid- Specified by:
validateCouponin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
couponCode- a string to be used to validate a couponcustomerId- the user id- Returns:
- - an instance of
CouponValidationResponseWsDTO
-
assertCouponModelType
protected abstract void assertCouponModelType(AbstractCouponModel couponModel, java.lang.String couponId)
-
convert
protected abstract java.util.Optional<D> convert(AbstractCouponModel couponModel)
-
getCouponPaginatedGenericDao
protected abstract PaginatedGenericDao<M> getCouponPaginatedGenericDao()
-
getCouponId
protected abstract java.lang.String getCouponId(java.lang.String couponCode)
-
convertSearchPageData
protected <S extends AbstractCouponModel> SearchPageData<D> convertSearchPageData(SearchPageData<S> source)
Converts the result ofSearchPageData- Type Parameters:
S- original type of searchPageData's results- Parameters:
source- searchPageData containing original results- Returns:
- converted SearchPageData
-
convertSearchPageData
protected <S extends AbstractCouponModel> SearchPageData<D> convertSearchPageData(SearchPageData<S> source)
Converts the result ofSearchPageData- Type Parameters:
S- original type of searchPageData's results- Parameters:
source- searchPageData containing original results- Returns:
- converted SearchPageData
-
assertCouponNotActive
protected void assertCouponNotActive(AbstractCouponModel couponModel, java.lang.String message)
-
getCoupons
public SearchPageData getCoupons(PaginationData pagination, java.util.List<SortData> sorts)
Description copied from interface:CouponWsFacadesReturns a restricted size list (page) of available coupons- Specified by:
getCouponsin interfaceCouponWsFacades<D extends AbstractCouponWsDTO>- Parameters:
pagination- - pagination instructionssorts- - sort instructions- Returns:
- - an instance of
SearchPageDatacontaining a list of coupons, registered in the system
-
buildSearchPageData
protected SearchPageData buildSearchPageData(PaginationData pagination, java.util.List<SortData> sorts)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getCouponDao
protected CouponDao getCouponDao()
-
setCouponDao
public void setCouponDao(CouponDao couponDao)
-
getCouponWsUtils
protected CouponWsUtils getCouponWsUtils()
-
setCouponWsUtils
public void setCouponWsUtils(CouponWsUtils couponWsUtils)
-
getCouponService
protected CouponService getCouponService()
-
setCouponService
public void setCouponService(CouponService couponService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getCouponValidationResponseWsDTOConverter
protected Converter<CouponResponse,CouponValidationResponseWsDTO> getCouponValidationResponseWsDTOConverter()
-
setCouponValidationResponseWsDTOConverter
public void setCouponValidationResponseWsDTOConverter(Converter<CouponResponse,CouponValidationResponseWsDTO> couponValidationResponseWsDTOConverter)
-
-