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 void
assertCouponModelType(AbstractCouponModel couponModel, java.lang.String couponId)
protected void
assertCouponNotActive(AbstractCouponModel couponModel, java.lang.String message)
protected SearchPageData
buildSearchPageData(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 ofSearchPageData
protected <S extends AbstractCouponModel>
SearchPageData<D>convertSearchPageData(SearchPageData<S> source)
Converts the result ofSearchPageData
D
createCoupon(D coupon)
Creates the coupon, given the coupon data.protected abstract M
createCouponModel(D couponWsDTO)
protected CouponDao
getCouponDao()
protected abstract java.lang.String
getCouponId(java.lang.String couponCode)
protected abstract PaginatedGenericDao<M>
getCouponPaginatedGenericDao()
SearchPageData
getCoupons(PaginationData pagination, java.util.List<SortData> sorts)
Returns a restricted size list (page) of available couponsprotected CouponService
getCouponService()
protected Converter<CouponResponse,CouponValidationResponseWsDTO>
getCouponValidationResponseWsDTOConverter()
D
getCouponWsDTO(java.lang.String couponId)
Given the couponId string, returns the coupon DTO, otherwise throws exceptionprotected CouponWsUtils
getCouponWsUtils()
protected ModelService
getModelService()
protected UserService
getUserService()
void
setCouponDao(CouponDao couponDao)
void
setCouponService(CouponService couponService)
void
setCouponValidationResponseWsDTOConverter(Converter<CouponResponse,CouponValidationResponseWsDTO> couponValidationResponseWsDTOConverter)
void
setCouponWsUtils(CouponWsUtils couponWsUtils)
void
setModelService(ModelService modelService)
void
setUserService(UserService userService)
void
updateCoupon(D coupon)
Updates the coupon identified by it couponIdprotected abstract M
updateCouponModel(D couponWsDTO)
void
updateCouponStatus(java.lang.String couponId, java.lang.Boolean active)
Updates status of a coupon identified by it couponIdCouponValidationResponseWsDTO
validateCoupon(java.lang.String couponCode)
Validates the given couponId, throws an exception if coupon id is invalidCouponValidationResponseWsDTO
validateCoupon(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:CouponWsFacades
Given the couponId string, returns the coupon DTO, otherwise throws exception- Specified by:
getCouponWsDTO
in 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:CouponWsFacades
Creates the coupon, given the coupon data. Throws exception otherwise- Specified by:
createCoupon
in 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:CouponWsFacades
Updates the coupon identified by it couponId- Specified by:
updateCoupon
in 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:CouponWsFacades
Updates status of a coupon identified by it couponId- Specified by:
updateCouponStatus
in 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:CouponWsFacades
Validates the given couponId, throws an exception if coupon id is invalid- Specified by:
validateCoupon
in 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:CouponWsFacades
Validates the given couponId for the given customer, throws an exception if coupon id or customer id is invalid- Specified by:
validateCoupon
in 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:CouponWsFacades
Returns a restricted size list (page) of available coupons- Specified by:
getCoupons
in interfaceCouponWsFacades<D extends AbstractCouponWsDTO>
- Parameters:
pagination
- - pagination instructionssorts
- - sort instructions- Returns:
- - an instance of
SearchPageData
containing 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)
-
-