T - as Promotionpublic class DefaultPromotionService<T extends Promotion> extends Object implements PromotionService<T>
PromotionService
Order)
ChangeGenerator; it will also generate Events of TypeStandardOperation.#EDIT, Promotion}StandardOperation.#DELETE, Promotion}StandardOperation.#EDIT, PromotionForUser}StandardOperation.#DELETE, PromotionForUser}StandardOperation.#ADD, List of PromotionForUser, Object ...context}StandardOperation.#DELETE, List of PromotionForUser, Object ...context}StandardOperation.#NOTIFY, List of PromotionForUser, Object ...context}| Constructor and Description |
|---|
DefaultPromotionService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(ChangeListener changeListener)
Allow Notify all
ChangeListeners about a change |
int |
delete(PromotionForUser promotionForUser) |
void |
delete(T promotion) |
int |
deleteCoupons(List<String> userCouponIds,
Promotion promotion,
Object... context) |
void |
generateCoupons(List<String> userCouponIds,
Promotion promotion,
Object... context) |
List |
getListeners()
Get list directly.
|
PromotionDaoImpl<T> |
getPromotionDao() |
T |
load(String promotionName)
Load by Promotion Name
|
void |
notifyAllListeners(List<String> userCouponIds,
Promotion promotion,
Object... context)
Allow notifications using the coupon Id notation; notify all users of the Coupons about something.
|
void |
notifyAllListeners(Object object)
Whenever a node is selected/updated, it also notifies its listeners.
|
PromotionForUser |
save(PromotionForUser promotionForUser) |
T |
save(T promotion) |
List<PromotionForUser> |
search(List<String> codes)
For provided list of Codes, get
Promotions |
List<PromotionForUser> |
search(String userId)
Fpr a given user Id get all the Active Promotions
|
List<PromotionForUser> |
search(String userId,
List<String> codes)
For provided list of Codes, get
Promotions for a given userId |
PromotionForUser |
search(String userId,
String promotionName)
Search for a
PromotionForUser |
void |
setListeners(List listeners)
Set list directly.
|
void |
setPromotionDao(PromotionDaoImpl<T> promotionDao) |
protected PromotionForUser |
stringToPromotionUser(String userCouponId,
boolean generateCoupon)
Takes in a list of Strings.
|
Collection<PromotionForUser> |
validate(Collection<PromotionForUser> promotionForUsers)
Ensure the passed collection contains valid entities; returns back only valid entities.
|
public T load(String promotionName)
PromotionServiceload in interface PromotionService<T extends Promotion>public T save(T promotion)
save in interface PromotionService<T extends Promotion>promotion - as Promotionpublic void delete(T promotion)
delete in interface PromotionService<T extends Promotion>promotion - as Promotionpublic PromotionForUser save(PromotionForUser promotionForUser)
save in interface PromotionService<T extends Promotion>promotionForUser - as PromotionForUserpublic int delete(PromotionForUser promotionForUser)
delete in interface PromotionService<T extends Promotion>promotionForUser - as PromotionForUserpublic PromotionForUser search(String userId, String promotionName)
PromotionServicePromotionForUsersearch in interface PromotionService<T extends Promotion>userId - as StringpromotionName - as StringPromotionForUserpublic List<PromotionForUser> search(String userId)
PromotionServicesearch in interface PromotionService<T extends Promotion>public List<PromotionForUser> search(List<String> codes)
PromotionServicePromotionssearch in interface PromotionService<T extends Promotion>codes - as List of Stringpublic List<PromotionForUser> search(String userId, List<String> codes)
PromotionServicePromotions for a given userIdsearch in interface PromotionService<T extends Promotion>userId - as Stringcodes - as List of Stringprotected PromotionForUser stringToPromotionUser(String userCouponId, boolean generateCoupon)
Promotion#getCode() ; the part
before ":" delimiter is considered as the user iduserCouponId - generateCoupon - boolean; if true will Generate a COUPON code if none found@Transactional(readOnly=false) public void generateCoupons(List<String> userCouponIds, Promotion promotion, Object... context)
generateCoupons in interface PromotionService<T extends Promotion>userCouponIds - as Lit of of Strings. if the String contains :code then it will consider that the Promotion#getCode() ; the part
before ":" delimiter is considered as the user idcontext - as varargs, as context to pass to the ChangeListeners@Transactional(readOnly=false) public int deleteCoupons(List<String> userCouponIds, Promotion promotion, Object... context)
deleteCoupons in interface PromotionService<T extends Promotion>userCouponIds - as Lit of of Strings. if the String contains :code then it will consider that the Promotion#getCode() ; the part
before ":" delimiter is considered as the user idcontext - as varargs, as context to pass to the ChangeListeners@Transactional(readOnly=true) public Collection<PromotionForUser> validate(Collection<PromotionForUser> promotionForUsers) throws javax.validation.ValidationException
PromotionServicevalidate in interface PromotionService<T extends Promotion>javax.validation.ValidationExceptionpublic void notifyAllListeners(List<String> userCouponIds, Promotion promotion, Object... context) throws javax.validation.ValidationException, PartialTransactionException
PromotionServicenotifyAllListeners in interface PromotionService<T extends Promotion>javax.validation.ValidationExceptionPartialTransactionExceptionpublic PromotionDaoImpl<T> getPromotionDao()
public void setPromotionDao(PromotionDaoImpl<T> promotionDao)
public void addChangeListener(ChangeListener changeListener)
ChangeGeneratorChangeListeners about a changeaddChangeListener in interface ChangeGenerator<Object>public void notifyAllListeners(Object object)
ChangeGeneratornotifyAllListeners in interface ChangeGenerator<Object>public List getListeners()
ChangeGeneratorgetListeners in interface ChangeGenerator<Object>public void setListeners(List listeners)
ChangeGeneratorsetListeners in interface ChangeGenerator<Object>Copyright © 2018. All rights reserved.