Interface AlternateLifecycleSharedCodeAuditSummaryRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- Type Parameters:
D
- The repository entity type
- All Known Subinterfaces:
JpaSharedCodeAuditSummaryRepository<D>
,SharedCodeAuditSummaryRepository<D>
- All Known Implementing Classes:
JpaAlternateLifecycleSharedCodeAuditSummaryRepository
public interface AlternateLifecycleSharedCodeAuditSummaryRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
Provides an alternate path for handling persistence for
SharedCodeAuditSummary
.
Implementations should safely handle creation and update with guaranteed accurate count
incrementing under load.-
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.
-
Method Details
-
createOrUpdateAndIncrement
@Policy(operationTypes={CREATE,UPDATE}) D createOrUpdateAndIncrement(String offerCodeId, String offerCode, @Nullable javax.money.MonetaryAmount totalSavings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create an instance ofSharedCodeAuditSummary
, or atomically update an existing one. This flow also will not end up creating duplicate summaries for the same code.- 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
-