Class JpaAlternateLifecycleOfferAuditSummaryRepository<D extends JpaOfferAuditSummary>
java.lang.Object
com.broadleafcommerce.promotion.offer.provider.jpa.repository.JpaAlternateLifecycleOfferAuditSummaryRepository<D>
- All Implemented Interfaces:
AlternateLifecycleOfferAuditSummaryRepository<D>
public class JpaAlternateLifecycleOfferAuditSummaryRepository<D extends JpaOfferAuditSummary>
extends Object
implements AlternateLifecycleOfferAuditSummaryRepository<D>
-
Constructor Summary
ConstructorsConstructorDescriptionJpaAlternateLifecycleOfferAuditSummaryRepository(org.springframework.transaction.support.TransactionTemplate template, org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateAndIncrement(String offerId, javax.money.MonetaryAmount totalSavings, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create an instance ofOfferAuditSummary, or atomically update an existing one.findAllByOfferIdIn(Set<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Override the default spring handling for the query method.findByOfferId(String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Override the default spring handling for the query method.Deprecated, for removal: This API element is subject to removal in a future version.protected JpaPromotionQueryHelperprotected JpaOfferAuditSummaryRepository<D>protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManagerprotected voidhandleConstraintViolation(javax.money.MonetaryAmount totalSavings, org.springframework.transaction.TransactionStatus status, String id) protected DnarrowResult(String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, List<D> results) voidsetJpaPromotionQueryHelper(JpaPromotionQueryHelper jpaPromotionQueryHelper) voidsetRepository(JpaOfferAuditSummaryRepository<D> repository) voidsetRepositoryEntityTypeManager(com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)
-
Constructor Details
-
JpaAlternateLifecycleOfferAuditSummaryRepository
public JpaAlternateLifecycleOfferAuditSummaryRepository(org.springframework.transaction.support.TransactionTemplate template, org.springframework.core.env.Environment environment)
-
-
Method Details
-
findAllByOfferIdIn
public List<D> findAllByOfferIdIn(@NonNull Set<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Override the default spring handling for the query method.
Possible that multiple instances for the same offer exist (e.g. in active/active datacenter scenarios with replication). If detected, collapse the results returned under a single summary per offer that matches the current context.- Parameters:
offerIds- The offers associated with the target summariescontextInfo- The tenant information for the request context- Returns:
- Any collapsed summaries associated with the offer codes
-
findByOfferId
@Nullable public D findByOfferId(@NonNull String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Override the default spring handling for the query method.
Possible that multiple instances for the same offer exist (e.g. in active/active datacenter scenarios with replication). If detected, collapse the results returned under a single summary that matches the current context.- Parameters:
offerId- The offer associated with the target summarycontextInfo- The tenant information for the request context- Returns:
- Any collapsed summaries associated with the offer codes
-
createOrUpdateAndIncrement
public D createOrUpdateAndIncrement(String offerId, @Nullable javax.money.MonetaryAmount totalSavings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AlternateLifecycleOfferAuditSummaryRepositoryCreate an instance ofOfferAuditSummary, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same offer.- Specified by:
createOrUpdateAndIncrementin interfaceAlternateLifecycleOfferAuditSummaryRepository<D extends JpaOfferAuditSummary>- Parameters:
offerId- The id of the related offertotalSavings- The total savings applied to record for this offercontextInfo- Any tenant related information for the request context- Returns:
- The created or updated summary
-
handleConstraintViolation
protected void handleConstraintViolation(@Nullable javax.money.MonetaryAmount totalSavings, org.springframework.transaction.TransactionStatus status, String id) -
getEntityClass
@Deprecated(forRemoval=true, since="3.0.3, 3.1.0") @NotNull protected @NotNull Class<D> getEntityClass()Deprecated, for removal: This API element is subject to removal in a future version.Method had a hardcoded entity reference that prevents from accepting extended entities, usegetManagedType()instead. -
getManagedType
-
narrowResult
-
setRepositoryEntityTypeManager
@Autowired @Lazy public void setRepositoryEntityTypeManager(com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager) -
getRepositoryEntityTypeManager
protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager getRepositoryEntityTypeManager() -
setRepository
-
getRepository
-
getJpaPromotionQueryHelper
-
setJpaPromotionQueryHelper
-
getManagedType()instead.