Interface BulkUpdateService<P extends BulkUpdate>
- All Superinterfaces:
- com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
- All Known Implementing Classes:
- DefaultBulkUpdateService
public interface BulkUpdateService<P extends BulkUpdate>
extends com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
Service API for 
BulkUpdates. Supported by BulkUpdateRepository.- Author:
- Samarth Dhruva (samarthd)
- 
Method SummaryModifier and TypeMethodDescriptionnotifyOfCreateSandboxRequest(String bulkUpdateId) Acquires a lock on the givenbulkUpdateId, and if the bulkUpdate is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING, atomically initializes itsNotificationStateforCreateSandboxRequestProducer.TYPEand renewsBulkUpdate.lastUpdated.notifyOfDeleteSandboxRequest(String bulkUpdateId) Acquires a lock on the givenbulkUpdateId, and if the bulkUpdate is found and has aBulkUpdate.statusofBulkUpdateStatus.ERROR, atomically initializes itsNotificationStateforDeleteSandboxRequestProducer.TYPEand renewsBulkUpdate.lastUpdated.org.springframework.data.domain.Page<P>readByTargetAndApplicationId(String target, String applicationId, org.springframework.data.domain.Pageable pageable) Reads the bulk updates with the givenBulkUpdate.targetandBulkUpdate.applicationId.Reads the bulk updates which are incomplete (those with statusBulkUpdateStatus.REQUESTEDorBulkUpdateStatus.PROCESSING) whoseBulkUpdate.lastUpdatedis before the givencutoff.readIncompleteLastUpdatedBeforeAndTenantId(Instant cutoff, String tenantId) Reads the bulk updates which are incomplete (those with statusBulkUpdateStatus.REQUESTEDorBulkUpdateStatus.PROCESSING) whoseBulkUpdate.lastUpdatedis before the givencutoff.booleansetContainedErrors(P bulkUpdate) Atomically finds and updates the given bulk update: finds the bulk update with the ID matching the givenbulkUpdate, sets the bulk update'sBulkUpdate.errorsto the errors contained within the givenbulkUpdate, setsBulkUpdate.statustoBulkUpdateStatus.ERROR, and renewsBulkUpdate.lastUpdated.booleansetFinishedStatus(String bulkUpdateId) Acquires a lock on the givenbulkUpdateId, and if the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING, atomically sets theBulkUpdate.statustoBulkUpdateStatus.FINISHEDand renewsBulkUpdate.lastUpdatedbooleansetNumberOfRecordsProcessed(String bulkUpdateId, long numberOfRecordsProcessed) Acquires a lock on the givenbulkUpdateId, and if the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING, atomically setsBulkUpdate.numberOfRecordsProcessedto the given value and renewsBulkUpdate.lastUpdated.setProcessingStatus(String bulkUpdateId) Acquires a lock on the givenbulkUpdateId, and if it is found to have aBulkUpdate.statusofBulkUpdateStatus.REQUESTED, atomically updates theBulkUpdate.statustoBulkUpdateStatus.PROCESSINGand renewsBulkUpdate.lastUpdated.Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityServicecreate, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
- 
Method Details- 
setProcessingStatusAcquires a lock on the givenbulkUpdateId, and if it is found to have aBulkUpdate.statusofBulkUpdateStatus.REQUESTED, atomically updates theBulkUpdate.statustoBulkUpdateStatus.PROCESSINGand renewsBulkUpdate.lastUpdated.- Parameters:
- bulkUpdateId- the ID of the bulk update to find and update
- Returns:
- the updated BulkUpdateif successfully found and updated,nullotherwise
- Throws:
- com.broadleafcommerce.common.messaging.exception.ResourceLockException- if the lock could not be acquired
 
- 
setContainedErrorsAtomically finds and updates the given bulk update: finds the bulk update with the ID matching the givenbulkUpdate, sets the bulk update'sBulkUpdate.errorsto the errors contained within the givenbulkUpdate, setsBulkUpdate.statustoBulkUpdateStatus.ERROR, and renewsBulkUpdate.lastUpdated. No other values frombulkUpdateare applied.The change is applied only if the bulk update is found to have a BulkUpdate.statusofBulkUpdateStatus.REQUESTEDorBulkUpdateStatus.PROCESSING.- Parameters:
- bulkUpdate- a bulk update object containing the errors to set
- Returns:
- true if the change was successfully applied, false otherwise
 
- 
setNumberOfRecordsProcessedAcquires a lock on the givenbulkUpdateId, and if the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING, atomically setsBulkUpdate.numberOfRecordsProcessedto the given value and renewsBulkUpdate.lastUpdated.- Parameters:
- bulkUpdateId- the ID of the bulk update to modify
- numberOfRecordsProcessed- the new value to set for- BulkUpdate.numberOfRecordsProcessed
- Returns:
- true if the update was successfully performed, false otherwise
- Throws:
- com.broadleafcommerce.common.messaging.exception.ResourceLockException- if the lock could not be acquired
 
- 
setFinishedStatusAcquires a lock on the givenbulkUpdateId, and if the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING, atomically sets theBulkUpdate.statustoBulkUpdateStatus.FINISHEDand renewsBulkUpdate.lastUpdated- Parameters:
- bulkUpdateId- the ID of the bulk update to modify
- Returns:
- true if the update was successfully performed, false otherwise
- Throws:
- com.broadleafcommerce.common.messaging.exception.ResourceLockException- if the lock could not be acquired
 
- 
notifyOfCreateSandboxRequestAcquires a lock on the givenbulkUpdateId, and if the bulkUpdate is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING, atomically initializes itsNotificationStateforCreateSandboxRequestProducer.TYPEand renewsBulkUpdate.lastUpdated.If the update is successful, calls NotificationManager.handle(NotificationStateRepository, NotificationStateAware, String)for theCreateSandboxRequestProducer.TYPE.- Parameters:
- bulkUpdateId- the ID of the bulk update to modify
- Returns:
- the updated BulkUpdateif successfully found and updated,nullotherwise
- Throws:
- com.broadleafcommerce.common.messaging.exception.ResourceLockException- if the lock could not be acquired
 
- 
notifyOfDeleteSandboxRequestAcquires a lock on the givenbulkUpdateId, and if the bulkUpdate is found and has aBulkUpdate.statusofBulkUpdateStatus.ERROR, atomically initializes itsNotificationStateforDeleteSandboxRequestProducer.TYPEand renewsBulkUpdate.lastUpdated.If the update is successful, calls NotificationManager.handle(NotificationStateRepository, NotificationStateAware, String)for theDeleteSandboxRequestProducer.TYPE.- Parameters:
- bulkUpdateId- the ID of the bulk update to modify
- Returns:
- the updated BulkUpdateif successfully found and updated,nullotherwise
- Throws:
- com.broadleafcommerce.common.messaging.exception.ResourceLockException- if the lock could not be acquired
 
- 
readByTargetAndApplicationIdorg.springframework.data.domain.Page<P> readByTargetAndApplicationId(@NonNull String target, @Nullable String applicationId, @NonNull org.springframework.data.domain.Pageable pageable) Reads the bulk updates with the givenBulkUpdate.targetandBulkUpdate.applicationId.- Parameters:
- target- the- BulkUpdate.targetto filter by
- applicationId- the- BulkUpdate.applicationIdto filter results by. Note that if this is- null, only bulk updates with- nullapplication IDs will be returned.
- pageable- information about which page of results to return from the database
- Returns:
- the bulk updates with the given BulkUpdate.target
 
- 
readIncompleteLastUpdatedBeforeReads the bulk updates which are incomplete (those with statusBulkUpdateStatus.REQUESTEDorBulkUpdateStatus.PROCESSING) whoseBulkUpdate.lastUpdatedis before the givencutoff.- Parameters:
- cutoff- the results will be filtered to only include those updates whose- BulkUpdate.lastUpdatedis before this value
- Returns:
- the bulk updates which are incomplete and have a BulkUpdate.lastUpdatedbefore the givencutoff
 
- 
readIncompleteLastUpdatedBeforeAndTenantIdReads the bulk updates which are incomplete (those with statusBulkUpdateStatus.REQUESTEDorBulkUpdateStatus.PROCESSING) whoseBulkUpdate.lastUpdatedis before the givencutoff.- Parameters:
- cutoff- the results will be filtered to only include those updates whose- BulkUpdate.lastUpdatedis before this value
- tenantId- the tenant id that this bulk update operation was initiated from
- Returns:
- the bulk updates which are incomplete and have a BulkUpdate.lastUpdatedbefore the givencutoffandtenantId
 
 
-