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 Object
implements CouponWsFacades<D>
Abstract implementation of CouponWsFacades interface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidassertCouponModelType(AbstractCouponModel couponModel, String couponId) protected voidassertCouponNotActive(AbstractCouponModel couponModel, String message) protected SearchPageDatabuildSearchPageData(PaginationData pagination, List<SortData> sorts) 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 ofSearchPageDatacreateCoupon(D coupon) Creates the coupon, given the coupon data.protected abstract McreateCouponModel(D couponWsDTO) protected CouponDaoprotected abstract StringgetCouponId(String couponCode) protected abstract PaginatedGenericDao<M>getCoupons(PaginationData pagination, List<SortData> sorts) Returns a restricted size list (page) of available couponsprotected CouponServiceprotected Converter<CouponResponse,CouponValidationResponseWsDTO> getCouponWsDTO(String couponId) Given the couponId string, returns the coupon DTO, otherwise throws exceptionprotected CouponWsUtilsprotected ModelServiceprotected UserServicevoidsetCouponDao(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(String couponId, Boolean active) Updates status of a coupon identified by it couponIdvalidateCoupon(String couponCode) Validates the given couponId, throws an exception if coupon id is invalidvalidateCoupon(String couponCode, String customerId) Validates the given couponId for the given customer, throws an exception if coupon id or customer id is invalid
-
Constructor Details
-
AbstractCouponWsFacades
public AbstractCouponWsFacades()
-
-
Method Details
-
getCouponWsDTO
@Cacheable(value="couponWsCache", key="T(de.hybris.platform.webservicescommons.cache.CacheKeyGenerator).generateKey(false,false,\'getCouponWsDTO\',#value)") public D getCouponWsDTO(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
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
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
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
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
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
-
updateCouponModel
-
convert
-
createCouponModel
-
getCouponPaginatedGenericDao
-
getCouponId
-
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
-
getCoupons
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
-
getModelService
-
setModelService
-
getCouponDao
-
setCouponDao
-
getCouponWsUtils
-
setCouponWsUtils
-
getCouponService
-
setCouponService
-
getUserService
-
setUserService
-
getCouponValidationResponseWsDTOConverter
protected Converter<CouponResponse,CouponValidationResponseWsDTO> getCouponValidationResponseWsDTOConverter() -
setCouponValidationResponseWsDTOConverter
public void setCouponValidationResponseWsDTOConverter(Converter<CouponResponse, CouponValidationResponseWsDTO> couponValidationResponseWsDTOConverter)
-