Interface BulkUpdateManager

All Known Implementing Classes:
DefaultBulkUpdateManager

public interface BulkUpdateManager
While 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 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 a BulkUpdate and persist it in the data store.

      Will send a ProcessBulkUpdateRequest message to request that the update be processed.

      Parameters:
      request - a request to perform a BulkUpdate.

      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 the ContextInfo.

      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 populate BulkUpdate.getTarget().
      filterString - the filter string that should be used to find the records to update. Used to populate BulkUpdate.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 the request failed validation
      IllegalArgumentException - if request is null or target is blank
      com.broadleafcommerce.data.tracking.core.exception.NotVisibleException - if the final determined updating context is not visible by the current user
      com.broadleafcommerce.data.tracking.core.exception.NotMutableException - if the final determined updating context is not mutable by the current user
    • processBulkUpdate

      void processBulkUpdate(BulkUpdate bulkUpdate)
      Performs a BulkUpdate, processing the requested records in batches and updating the status for the BulkUpdate as it goes.

      Note: this method should always be called with the result of BulkUpdateService.setProcessingStatus(String) if the value is not null.

      The BulkUpdateManager will delegate processing to the first BulkUpdateProcessor for which BulkUpdateProcessor.canHandle(BulkUpdate) returns true. Thus if more than one BulkUpdateProcessor can 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 of BulkUpdateService.setProcessingStatus(String) if it is not null