Class DefaultPriceDataUsageDetailService<P extends PriceDataUsageDetail>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.pricing.service.DefaultPriceDataUsageDetailService<P>
- Type Parameters:
P
- a class that is/extendsPriceDataUsageDetail
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
,PriceDataUsageDetailService<P>
public class DefaultPriceDataUsageDetailService<P extends PriceDataUsageDetail>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements PriceDataUsageDetailService<P>
Default implementation of
PriceDataUsageDetailService
.- Author:
- karanjariwala
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPriceDataUsageDetailService
(PriceDataUsageDetailRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveAllByIds
(@NonNull List<String> contextIds, @NonNull String archivalReason, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Archives all thePriceDataUsageDetail
whose ids are given in the contextIds list.protected org.springframework.data.domain.Page<P>
convertFromDomain
(org.springframework.data.domain.Page<com.broadleafcommerce.data.tracking.core.Trackable> trackables, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected @NonNull PriceDataUsageDetailRepository<com.broadleafcommerce.data.tracking.core.Trackable>
void
markRevertibleAllByIds
(@NonNull List<String> contextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Sets revertible=true for all thePriceDataUsageDetail
whose ids are given in the contextIds list.int
purgeOutdatedPriceDataUsageDetails
(@NonNull Duration outdatedPriceDataUsageDetailTimeout, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deletes allPriceDataUsageDetails
withPriceDataUsageDetail.getUsageDate()
before theoutdatedPriceDataUsageDetailTimeout
.org.springframework.data.domain.Page<P>
readAllByPriceDataIdIn
(@NonNull Collection<String> priceDataIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<P>
readAllByTransactionReferenceTypeAndTransactionReferenceId
(@NonNull String transactionReferenceType, @NonNull String transactionReferenceId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads aPage
ofPriceDataUsageDetail
based on the transactionReferenceType and transactionReferenceId.org.springframework.data.domain.Page<P>
readAllRevertibleOlderThan
(Instant usageDate, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetches a page ofPriceDataUsageDetail
that are "revertible"(revertible=true) and before the specified datevoid
updateRevertibleByReferenceId
(String transactionReferenceType, String transactionReferenceId, Boolean revertible, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Sets revertible for thePriceDataUsageDetail
that matches criteriaMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Constructor Details
-
DefaultPriceDataUsageDetailService
public DefaultPriceDataUsageDetailService(PriceDataUsageDetailRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
-
-
Method Details
-
readAllByTransactionReferenceTypeAndTransactionReferenceId
public org.springframework.data.domain.Page<P> readAllByTransactionReferenceTypeAndTransactionReferenceId(@NonNull @NonNull String transactionReferenceType, @NonNull @NonNull String transactionReferenceId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
Reads aPage
ofPriceDataUsageDetail
based on the transactionReferenceType and transactionReferenceId.- Specified by:
readAllByTransactionReferenceTypeAndTransactionReferenceId
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
transactionReferenceType
- the referenceType of the transaction (e.g. CART)transactionReferenceId
- the referenceId of the transaction (e.g. cartId)page
- the pagecontextInfo
- the context info- Returns:
- Page of
PriceDataUsageDetail
-
archiveAllByIds
public void archiveAllByIds(@NonNull @NonNull List<String> contextIds, @NonNull @NonNull String archivalReason, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
Archives all thePriceDataUsageDetail
whose ids are given in the contextIds list.- Specified by:
archiveAllByIds
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
contextIds
- the ids to deletearchivalReason
- the reason for archivalcontextInfo
- the context info- See Also:
-
markRevertibleAllByIds
public void markRevertibleAllByIds(@NonNull @NonNull List<String> contextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
Sets revertible=true for all thePriceDataUsageDetail
whose ids are given in the contextIds list.- Specified by:
markRevertibleAllByIds
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
contextIds
- the ids to markcontextInfo
- the context info
-
updateRevertibleByReferenceId
public void updateRevertibleByReferenceId(String transactionReferenceType, String transactionReferenceId, Boolean revertible, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
Sets revertible for thePriceDataUsageDetail
that matches criteria- Specified by:
updateRevertibleByReferenceId
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
transactionReferenceType
- the transactionReferenceType to restrict querytransactionReferenceId
- the transactionReferenceId to restrict queryrevertible
- the value of revertible to setcontextInfo
- the context info
-
readAllByPriceDataIdIn
public org.springframework.data.domain.Page<P> readAllByPriceDataIdIn(@NonNull @NonNull Collection<String> priceDataIds, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
- Specified by:
readAllByPriceDataIdIn
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
priceDataIds
- the id of thePriceData
page
- the pagecontextInfo
- the context info- Returns:
- Page of
PriceDataUsageDetail
-
purgeOutdatedPriceDataUsageDetails
public int purgeOutdatedPriceDataUsageDetails(@NonNull @NonNull Duration outdatedPriceDataUsageDetailTimeout, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
Deletes allPriceDataUsageDetails
withPriceDataUsageDetail.getUsageDate()
before theoutdatedPriceDataUsageDetailTimeout
.Used for cleanup of obsolete data
- Specified by:
purgeOutdatedPriceDataUsageDetails
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
outdatedPriceDataUsageDetailTimeout
- the duration before which the data is to be clearedcontextInfo
- the context info- Returns:
- the number of rows deleted
-
readAllRevertibleOlderThan
public org.springframework.data.domain.Page<P> readAllRevertibleOlderThan(Instant usageDate, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PriceDataUsageDetailService
Fetches a page ofPriceDataUsageDetail
that are "revertible"(revertible=true) and before the specified date- Specified by:
readAllRevertibleOlderThan
in interfacePriceDataUsageDetailService<P extends PriceDataUsageDetail>
- Parameters:
usageDate
- - the date(instant) before usageDatepageable
- - page infocontextInfo
- - the context info- Returns:
- the page of
PriceDataUsageDetail
-
convertFromDomain
protected org.springframework.data.domain.Page<P> convertFromDomain(org.springframework.data.domain.Page<com.broadleafcommerce.data.tracking.core.Trackable> trackables, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getRepository
@NonNull protected @NonNull PriceDataUsageDetailRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends PriceDataUsageDetail>
-