Class DefaultBulkOperationService<P extends BulkOperation>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
com.broadleafcommerce.catalog.service.bulkoperation.DefaultBulkOperationService<P>
All Implemented Interfaces:
BulkOperationService<P>, com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>

public class DefaultBulkOperationService<P extends BulkOperation> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P> implements BulkOperationService<P>
  • Constructor Details

    • DefaultBulkOperationService

      public DefaultBulkOperationService(BulkOperationRepository<com.broadleafcommerce.data.tracking.core.Identifiable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper, BulkOperationItemService<BulkOperationItem> bulkOperationItemService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • updateStatusAndSubStatus

      public P updateStatusAndSubStatus(@Nullable String status, @Nullable String subStatus, P bulkOperation)
      Description copied from interface: BulkOperationService
      Updates the bulk operation's status, substatus, and status history.
      Specified by:
      updateStatusAndSubStatus in interface BulkOperationService<P extends BulkOperation>
      Parameters:
      status - the new status, if any
      subStatus - the new substatus, if any
      bulkOperation - the bulk operation to update
      Returns:
      the updated bulk operation
    • initializeInclusionItems

      public com.broadleafcommerce.bulk.v2.domain.InitializeItemResponse initializeInclusionItems(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, P bulkOperation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: BulkOperationService
      Initializes the list of inclusion items on the BulkOperationRequest.
      Specified by:
      initializeInclusionItems in interface BulkOperationService<P extends BulkOperation>
      Parameters:
      bulkOperationRequest - the BulkOperationRequest to initialize the included items
      bulkOperation - the bulk operation for these items
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      the InitializeItemResponse for the items initialized
    • initializeBatchOfItems

      public com.broadleafcommerce.bulk.v2.domain.InitializeItemResponse initializeBatchOfItems(com.broadleafcommerce.bulk.v2.domain.InitializeItemRequest initializeItemRequest, P bulkOperation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: BulkOperationService
      Initializes the batch of items on the InitializeItemRequest.
      Specified by:
      initializeBatchOfItems in interface BulkOperationService<P extends BulkOperation>
      Parameters:
      initializeItemRequest - the InitializeItemRequest to initialize the items
      bulkOperation - the bulk operation for these items
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      the InitializeItemResponse for the batch of items initialized
    • readAllByUpdateDateBeforeAndStatusIn

      public List<P> readAllByUpdateDateBeforeAndStatusIn(@NonNull @NonNull Instant threshold, @NonNull @NonNull Collection<String> statuses)
      Description copied from interface: BulkOperationService
      Retrieves all BulkOperations last updated before the given threshold.
      Specified by:
      readAllByUpdateDateBeforeAndStatusIn in interface BulkOperationService<P extends BulkOperation>
      Parameters:
      threshold - The date before which to retrieve BulkOperations
      statuses - Collection of OperationStatuses to restrict the retrieved BulkOperations by.
      Returns:
      All BulkOperations last updated before the given threshold.
    • deleteAllByIdIn

      public int deleteAllByIdIn(@NonNull @NonNull Collection<String> ids)
      Description copied from interface: BulkOperationService
      Deletes all the BulkOperations matching the given IDs.
      Specified by:
      deleteAllByIdIn in interface BulkOperationService<P extends BulkOperation>
      Parameters:
      ids - IDs of the BulkOperations to delete.
      Returns:
      The number deleted.
    • createBulkOperationFromRequest

      public P createBulkOperationFromRequest(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: BulkOperationService
      Creates a bulk operation from the given BulkOperationRequest.
      Specified by:
      createBulkOperationFromRequest in interface BulkOperationService<P extends BulkOperation>
      Parameters:
      bulkOperationRequest - the BulkOperationRequest to create
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
    • createBulkOperationItem

      protected BulkOperationItem createBulkOperationItem(BulkOperation bulkOperation, String entityId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • convertBulkOperationToResponse

      protected com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse convertBulkOperationToResponse(BulkOperation bulkOperation)
    • convertOperationStatusHistoryToResponse

      protected List<com.broadleafcommerce.bulk.v2.domain.OperationStatusHistoryResponse> convertOperationStatusHistoryToResponse(List<OperationStatusHistory> operationStatusHistories)
    • convertBulkOperationItemsToResponse

      protected List<com.broadleafcommerce.bulk.v2.domain.BulkOperationItemResponse> convertBulkOperationItemsToResponse(List<BulkOperationItem> bulkOperationItems)
    • buildOperationStatusHistory

      protected List<OperationStatusHistory> buildOperationStatusHistory(List<OperationStatusHistory> previousHistory, String newStatus, String newSubStatus, Instant updateTime)
    • getBulkOperationItemService

      @NonNull protected BulkOperationItemService<BulkOperationItem> getBulkOperationItemService()
    • getRepository

      protected BulkOperationRepository<com.broadleafcommerce.data.tracking.core.Identifiable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends BulkOperation>
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()