Class CatalogBulkOperationHandler

java.lang.Object
com.broadleafcommerce.bulkoperations.service.handler.CatalogBulkOperationHandler
All Implemented Interfaces:
BulkOperationHandler

public class CatalogBulkOperationHandler extends Object implements BulkOperationHandler
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Random
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CatalogBulkOperationHandler(CatalogProvider<? extends CatalogItem> catalogProvider, com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender sender, BulkOperationsProviderProperties properties, com.broadleafcommerce.bulk.v2.messaging.sandbox.CreateSandboxRequestProducer createSandboxRequestProducer, com.broadleafcommerce.bulk.v2.messaging.BulkOpsInitializeItemsRequestProducer bulkOpsInitializeItemsRequestProducer, org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canHandle(String operationType, String entityType)
    Determines if this handler can handle the bulk operation request.
    protected void
    createSandboxForBulkOperation(String sandboxId, com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Sends the CreateSandboxRequest message to create a sandbox to contain the catalog changes from this bulk operation.
    protected String
     
    protected com.broadleafcommerce.bulk.v2.messaging.BulkOpsInitializeItemsRequestProducer
     
    protected CatalogProvider<? extends CatalogItem>
     
    protected com.broadleafcommerce.bulk.v2.messaging.sandbox.CreateSandboxRequestProducer
     
    protected org.springframework.context.MessageSource
     
     
    protected String
    getSandboxDescription(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected String
    getSandboxName(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse
    handle(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Handles this bulk operation request for the specified entity or operation type.
    protected void
    initializeItems(com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse bulkOperationResponse, com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Sends the BulkOpsInitializeItemsRequest message to initialize bulk operation items.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SECURE_RANDOM

      protected static final Random SECURE_RANDOM
  • Constructor Details

    • CatalogBulkOperationHandler

      public CatalogBulkOperationHandler(CatalogProvider<? extends CatalogItem> catalogProvider, com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender sender, BulkOperationsProviderProperties properties, com.broadleafcommerce.bulk.v2.messaging.sandbox.CreateSandboxRequestProducer createSandboxRequestProducer, com.broadleafcommerce.bulk.v2.messaging.BulkOpsInitializeItemsRequestProducer bulkOpsInitializeItemsRequestProducer, org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • canHandle

      public boolean canHandle(String operationType, @Nullable String entityType)
      Description copied from interface: BulkOperationHandler
      Determines if this handler can handle the bulk operation request.
      Specified by:
      canHandle in interface BulkOperationHandler
      Parameters:
      operationType - the operation type of the bulk operation request
      entityType - the entity type being updated by the bulk operation request
      Returns:
      true, if this handler is able to handle the bulk operation
    • handle

      public com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse handle(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: BulkOperationHandler
      Handles this bulk operation request for the specified entity or operation type.
      Specified by:
      handle in interface BulkOperationHandler
      Parameters:
      bulkOperationRequest - the bulk operation request DTO
      contextInfo - context information surrounding sandboxing/multitenant state
      Returns:
      the bulk operation response DTO for the created bulk operation
    • createSandboxForBulkOperation

      protected void createSandboxForBulkOperation(String sandboxId, com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Sends the CreateSandboxRequest message to create a sandbox to contain the catalog changes from this bulk operation.
      Parameters:
      sandboxId - the ID of the sandbox to create
      bulkOperationRequest - the bulk operation request DTO
      contextInfo - context information surrounding sandboxing/multitenant state
    • generateRandomHexColor

      protected String generateRandomHexColor()
    • getSandboxName

      protected String getSandboxName(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getSandboxDescription

      protected String getSandboxDescription(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • initializeItems

      protected void initializeItems(com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse bulkOperationResponse, com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Sends the BulkOpsInitializeItemsRequest message to initialize bulk operation items.
      Parameters:
      bulkOperationResponse - the response DTO for the bulk operation creation
      bulkOperationRequest - the request DTO containing search and operation information
      contextInfo - context information surrounding sandboxing/multitenant state
    • getCatalogProvider

      protected CatalogProvider<? extends CatalogItem> getCatalogProvider()
    • getSender

      protected com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender getSender()
    • getProperties

      protected BulkOperationsProviderProperties getProperties()
    • getCreateSandboxRequestProducer

      protected com.broadleafcommerce.bulk.v2.messaging.sandbox.CreateSandboxRequestProducer getCreateSandboxRequestProducer()
    • getBulkOpsInitializeItemsRequestProducer

      protected com.broadleafcommerce.bulk.v2.messaging.BulkOpsInitializeItemsRequestProducer getBulkOpsInitializeItemsRequestProducer()
    • getMessageSource

      protected org.springframework.context.MessageSource getMessageSource()
    • getTypeFactory

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