Class JpaAlternateLifecycleSharedCodeAuditSummaryRepository<D extends JpaSharedCodeAuditSummary>
java.lang.Object
com.broadleafcommerce.promotion.offer.provider.jpa.repository.JpaAlternateLifecycleSharedCodeAuditSummaryRepository<D>
- All Implemented Interfaces:
AlternateLifecycleSharedCodeAuditSummaryRepository<D>
public class JpaAlternateLifecycleSharedCodeAuditSummaryRepository<D extends JpaSharedCodeAuditSummary>
extends Object
implements AlternateLifecycleSharedCodeAuditSummaryRepository<D>
-
Constructor Summary
ConstructorsConstructorDescriptionJpaAlternateLifecycleSharedCodeAuditSummaryRepository(org.springframework.transaction.support.TransactionTemplate template, String suffix) JpaAlternateLifecycleSharedCodeAuditSummaryRepository(org.springframework.transaction.support.TransactionTemplate template, org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateAndIncrement(String offerCodeId, String offerCode, javax.money.MonetaryAmount totalSavings, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create an instance ofSharedCodeAuditSummary, or atomically update an existing one.findAllByOfferCodeIdIn(Set<String> offerCodeIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Override the default spring handling for the query method.findByOfferCodeId(String offerCodeId, 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 jakarta.persistence.EntityManagerprotected JpaPromotionQueryHelperprotected JpaSharedCodeAuditSummaryRepository<D>protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManagerprotected voidhandleConstraintViolation(javax.money.MonetaryAmount totalSavings, org.springframework.transaction.TransactionStatus status, String id) protected DnarrowResult(String offerCodeId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, List<D> results) voidsetJpaPromotionQueryHelper(JpaPromotionQueryHelper jpaPromotionQueryHelper) voidsetRepository(JpaSharedCodeAuditSummaryRepository<D> repository) voidsetRepositoryEntityTypeManager(com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)
-
Constructor Details
-
JpaAlternateLifecycleSharedCodeAuditSummaryRepository
public JpaAlternateLifecycleSharedCodeAuditSummaryRepository(org.springframework.transaction.support.TransactionTemplate template, org.springframework.core.env.Environment environment) -
JpaAlternateLifecycleSharedCodeAuditSummaryRepository
public JpaAlternateLifecycleSharedCodeAuditSummaryRepository(org.springframework.transaction.support.TransactionTemplate template, String suffix)
-
-
Method Details
-
findAllByOfferCodeIdIn
public List<D> findAllByOfferCodeIdIn(@NonNull Set<String> offerCodeIds, @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 code exist (e.g. in active/active datacenter scenarios with replication). If detected, collapse the results returned under a single summary per offer code that matches the current context.- Parameters:
offerCodeIds- The offer codes associated with the target summariescontextInfo- The tenant information for the request context- Returns:
- Any collapsed summaries associated with the offer codes
-
findByOfferCodeId
@Nullable public D findByOfferCodeId(@NonNull String offerCodeId, @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 code 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:
offerCodeId- The offer code 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 offerCodeId, String offerCode, @Nullable javax.money.MonetaryAmount totalSavings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AlternateLifecycleSharedCodeAuditSummaryRepositoryCreate an instance ofSharedCodeAuditSummary, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same code.- Specified by:
createOrUpdateAndIncrementin interfaceAlternateLifecycleSharedCodeAuditSummaryRepository<D extends JpaSharedCodeAuditSummary>- Parameters:
offerCodeId- The id of the related codeofferCode- The string value of the related codetotalSavings- The total savings applied to record for this codecontextInfo- 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. -
narrowResult
-
getManagedType
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager() -
setRepositoryEntityTypeManager
@Autowired @Lazy public void setRepositoryEntityTypeManager(com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager) -
getRepositoryEntityTypeManager
protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager getRepositoryEntityTypeManager() -
getRepository
-
getJpaPromotionQueryHelper
-
setJpaPromotionQueryHelper
-
getManagedType()instead.