Class DefaultBatchService<P extends Batch>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.dataimport.service.DefaultBatchService<P>
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>, BatchService<P>

public class DefaultBatchService<P extends Batch> extends com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P> implements BatchService<P>
Author:
Phillip Verheyden (phillipuniverse)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultBatchService(ImportBatchRepository<com.broadleafcommerce.data.tracking.core.Identifiable> repository, com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityHelper helper, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord
     
    void
     
    Delete the batches that match the corresponding import ids
    protected com.broadleafcommerce.common.messaging.notification.NotificationManager
     
    protected ImportBatchRepository<com.broadleafcommerce.data.tracking.core.Identifiable>
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected void
    updateBatchItemAndDependents(BatchItem batchItem, Map<String,com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord> correlationIdsToCompletionRecords)
     
    protected void
    updateBatchItemFromCompletionRecord(BatchItem toUpdate, com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord completionRecord)
     
    updateProcessingBatchFromCompletion(com.broadleafcommerce.common.dataimport.messaging.BatchCompletion batchCompletion)
    Updates a Batch (specified in BatchCompletion.batchId) based upon the information received in a BatchCompletion and assuming that the persisted batch is BatchStatus.PROCESSING.

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService

    convertFromPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
  • Constructor Details

    • DefaultBatchService

      public DefaultBatchService(ImportBatchRepository<com.broadleafcommerce.data.tracking.core.Identifiable> repository, com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityHelper helper, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • getRepository

      @NonNull protected ImportBatchRepository<com.broadleafcommerce.data.tracking.core.Identifiable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends Batch>
    • createAndProcess

      public void createAndProcess(Batch batch)
      Specified by:
      createAndProcess in interface BatchService<P extends Batch>
    • updateProcessingBatchFromCompletion

      @Nullable public P updateProcessingBatchFromCompletion(com.broadleafcommerce.common.dataimport.messaging.BatchCompletion batchCompletion)
      Description copied from interface: BatchService
      Updates a Batch (specified in BatchCompletion.batchId) based upon the information received in a BatchCompletion and assuming that the persisted batch is BatchStatus.PROCESSING.

      This will set Batch.completed to the current time, and update all BatchItems based on the information in the corresponding BatchCompletionRecords.

      Specified by:
      updateProcessingBatchFromCompletion in interface BatchService<P extends Batch>
      Parameters:
      batchCompletion - the batch completion received from a resource tier service
      Returns:
      the updated Batch or null if the batch could not be updated or was not in a processing state
      See Also:
    • updateBatchItemAndDependents

      protected void updateBatchItemAndDependents(BatchItem batchItem, Map<String,com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord> correlationIdsToCompletionRecords)
    • buildErrorCompletionRecordForUnackedItem

      protected com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord buildErrorCompletionRecordForUnackedItem(BatchItem batchItem)
    • updateBatchItemFromCompletionRecord

      protected void updateBatchItemFromCompletionRecord(BatchItem toUpdate, com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord completionRecord)
    • deleteBatchesByImportId

      public Long deleteBatchesByImportId(List<String> importIds)
      Description copied from interface: BatchService
      Delete the batches that match the corresponding import ids
      Specified by:
      deleteBatchesByImportId in interface BatchService<P extends Batch>
      Parameters:
      importIds - the list of import ids to delete against
      Returns:
      the number of batches deleted
    • getNotificationManager

      @NonNull protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()
    • getTypeFactory

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