Class DefaultOfferOptInService<P extends OfferOptIn>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.promotion.offer.service.DefaultOfferOptInService<P>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>,OfferOptInService<P>,EventListener,org.springframework.context.ApplicationListener<PromotionCacheInvalidationEvent>
public class DefaultOfferOptInService<P extends OfferOptIn>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements OfferOptInService<P>, org.springframework.context.ApplicationListener<PromotionCacheInvalidationEvent>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultOfferOptInService(OfferOptInRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionbuildOptIn(Offer offer, boolean isMutable) Build an opt-in for the given offer.protected com.broadleafcommerce.common.extension.cache.CacheStateManagerprotected com.broadleafcommerce.common.extension.TypeFactoryvoidorg.springframework.data.domain.Page<P>readAllByOfferIds(Collection<String> offerIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all optIns matched against their related offers.readByOfferId(String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the optIn matched against its related offer.replace(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) voidsetCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) update(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecutionMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Field Details
-
CACHE_BY_IDS
- See Also:
-
CACHE_BY_ID
- See Also:
-
-
Constructor Details
-
DefaultOfferOptInService
public DefaultOfferOptInService(OfferOptInRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
-
-
Method Details
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<P extends OfferOptIn>
-
readAllByOfferIds
public org.springframework.data.domain.Page<P> readAllByOfferIds(Collection<String> offerIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OfferOptInServiceFind all optIns matched against their related offers.- Specified by:
readAllByOfferIdsin interfaceOfferOptInService<P extends OfferOptIn>- Parameters:
offerIds- The ids of the offersfilters- Any RSQL filters to apply for refining the querypageInfo- The paging informationcontextInfo- The tenant contenxt information- Returns:
- A page of opt in query results
-
readByOfferId
public Optional<P> readByOfferId(String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OfferOptInServiceFind the optIn matched against its related offer.- Specified by:
readByOfferIdin interfaceOfferOptInService<P extends OfferOptIn>- Parameters:
offerId- The id of the offercontextInfo- The tenant contenxt information- Returns:
- A page of opt in query results
-
update
public P update(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
updatein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends OfferOptIn>- Overrides:
updatein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends OfferOptIn>
-
replace
public P replace(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
replacein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends OfferOptIn>- Overrides:
replacein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends OfferOptIn>
-
buildOptIn
Description copied from interface:OfferOptInServiceBuild an opt-in for the given offer.- Specified by:
buildOptInin interfaceOfferOptInService<P extends OfferOptIn>- Parameters:
offer- The offer to build the opt-in forisMutable- Whether the opt-in should be mutable or not- Returns:
- The built opt-in
-
getCacheStateManager
@Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager() -
setCacheStateManager
@Autowired(required=false) public void setCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-