Interface BulkUpdateManager
- All Known Implementing Classes:
DefaultBulkUpdateManager
BulkUpdateService is purely in charge of CRUD-related operations on
BulkUpdate, this service is a higher level abstraction that performs the surrounding
logic of processing bulk update operations. This includes processing requests and emitting the
required messages for the relevant microservices (such as the sandbox service). It internally
delegates to BulkUpdateService for CRUD operations.
Resource services should directly interact with this manager rather than the
BulkUpdateService for update processing.
For actual processing of updates, the manager delegates to BulkUpdateProcessor.
- Author:
- Samarth Dhruva (samarthd)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioninitiateBulkUpdate(BulkUpdateRequest request, String target, String filterString, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method accepts a bulk update request and the context of the request to build aBulkUpdateand persist it in the data store.voidprocessBulkUpdate(BulkUpdate bulkUpdate) Performs aBulkUpdate, processing the requested records in batches and updating the status for theBulkUpdateas it goes.
-
Method Details
-
initiateBulkUpdate
BulkUpdate initiateBulkUpdate(BulkUpdateRequest request, String target, @Nullable String filterString, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method accepts a bulk update request and the context of the request to build aBulkUpdateand persist it in the data store.Will send a
ProcessBulkUpdateRequestmessage to request that the update be processed.- Parameters:
request- a request to perform aBulkUpdate.For each of the "updating context" fields describing where the operation will be performed, the default implementation will first check if the field is supplied in
BulkUpdateRequest, and if not, use the value from theContextInfo.target- the target of the bulk update. This is some value that can be mapped to a particular domain by the logic performing an update, rather than explicitly requiring the fully qualified classname. Used to populateBulkUpdate.getTarget().filterString- the filter string that should be used to find the records to update. Used to populateBulkUpdate.getFilterString().contextInfo- context information surrounding sandboxing and multitenant state. This is the context from which the operation itself is being initiated.- Returns:
- The created
BulkUpdate. - Throws:
com.broadleafcommerce.common.error.validation.ValidationException- if therequestfailed validationIllegalArgumentException- ifrequestis null ortargetis blankcom.broadleafcommerce.data.tracking.core.exception.NotVisibleException- if the final determined updating context is not visible by the current usercom.broadleafcommerce.data.tracking.core.exception.NotMutableException- if the final determined updating context is not mutable by the current user
-
processBulkUpdate
Performs aBulkUpdate, processing the requested records in batches and updating the status for theBulkUpdateas it goes.Note: this method should always be called with the result of
BulkUpdateService.setProcessingStatus(String)if the value is not null.The
BulkUpdateManagerwill delegate processing to the firstBulkUpdateProcessorfor whichBulkUpdateProcessor.canHandle(BulkUpdate)returns true. Thus if more than oneBulkUpdateProcessorcan handle a request, the bean registered with the higher priority will be used.- Parameters:
bulkUpdate- the bulk update to perform - this should always be the result ofBulkUpdateService.setProcessingStatus(String)if it is not null
-