T
- as Promotion
public 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
ChangeListener s 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
Promotion s |
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
Promotion s 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)
PromotionService
load
in interface PromotionService<T extends Promotion>
public T save(T promotion)
save
in interface PromotionService<T extends Promotion>
promotion
- as Promotion
public void delete(T promotion)
delete
in interface PromotionService<T extends Promotion>
promotion
- as Promotion
public PromotionForUser save(PromotionForUser promotionForUser)
save
in interface PromotionService<T extends Promotion>
promotionForUser
- as PromotionForUser
public int delete(PromotionForUser promotionForUser)
delete
in interface PromotionService<T extends Promotion>
promotionForUser
- as PromotionForUser
public PromotionForUser search(String userId, String promotionName)
PromotionService
PromotionForUser
search
in interface PromotionService<T extends Promotion>
userId
- as StringpromotionName
- as StringPromotionForUser
public List<PromotionForUser> search(String userId)
PromotionService
search
in interface PromotionService<T extends Promotion>
public List<PromotionForUser> search(List<String> codes)
PromotionService
Promotion
ssearch
in interface PromotionService<T extends Promotion>
codes
- as List of Stringpublic List<PromotionForUser> search(String userId, List<String> codes)
PromotionService
Promotion
s 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 ChangeListener
s@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 ChangeListener
s@Transactional(readOnly=true) public Collection<PromotionForUser> validate(Collection<PromotionForUser> promotionForUsers) throws javax.validation.ValidationException
PromotionService
validate
in interface PromotionService<T extends Promotion>
javax.validation.ValidationException
public void notifyAllListeners(List<String> userCouponIds, Promotion promotion, Object... context) throws javax.validation.ValidationException, PartialTransactionException
PromotionService
notifyAllListeners
in interface PromotionService<T extends Promotion>
javax.validation.ValidationException
PartialTransactionException
public PromotionDaoImpl<T> getPromotionDao()
public void setPromotionDao(PromotionDaoImpl<T> promotionDao)
public void addChangeListener(ChangeListener changeListener)
ChangeGenerator
ChangeListener
s about a changeaddChangeListener
in interface ChangeGenerator<Object>
public void notifyAllListeners(Object object)
ChangeGenerator
notifyAllListeners
in interface ChangeGenerator<Object>
public List getListeners()
ChangeGenerator
getListeners
in interface ChangeGenerator<Object>
public void setListeners(List listeners)
ChangeGenerator
setListeners
in interface ChangeGenerator<Object>
Copyright © 2018. All rights reserved.