Class DefaultBatchItemCompletionService<P extends BatchItemCompletion>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
com.broadleafcommerce.dataimport.service.DefaultBatchItemCompletionService<P>
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>, BatchItemCompletionService<P>

public class DefaultBatchItemCompletionService<P extends BatchItemCompletion> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P> implements BatchItemCompletionService<P>
Author:
Samarth Dhruva (samarthd)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultBatchItemCompletionService(ImportBatchItemCompletionRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected P
    convertFrom(String importId, BatchItem completedBatchItem, String topLevelParentCorrelationId)
     
    createAllFromBatchItems(String importId, List<BatchItem> completedBatchItems)
    Accepts a list of completed BatchItems and creates a BatchItemCompletion for each of them.
    Delete the batch item completions that match the corresponding ids
    findByImportIdAndStatusAndCorrelationIdIn(String importId, String status, Set<String> referencedCorrelationIds)
    Finds and returns all of the item completions whose BatchItemCompletion.importId matches the given importId, BatchItemCompletion.status the given status and BatchItemCompletion.correlationId the set of correlation ids.
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    org.springframework.data.domain.Page<P>
    readAllByImportId(String importId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
    Finds and returns all of the item completions whose BatchItemCompletion.importId matches the given value.
    Finds and returns all of the item completions whose BatchItemCompletion.importId matches the given importId and BatchItemCompletion.status given status.
    Read a list of batch item completions for the provided import id.
    readByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String importId, Collection<String> correlationIdIn, Collection<String> topLevelParentCorrelationIdIn)
    For the given importId, returns all batch item completion records which either have a BatchItemCompletion.correlationId that matches one of the given correlationIdIn values or a BatchItemCompletion.topLevelParentCorrelationId that matches one of the given topLevelParentCorrelationIdIn values.

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

    getRsqlHelper, readAll, readAll, readAll, readAll

    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

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

    readAll, readAll, readAll, readAll
  • Constructor Details

    • DefaultBatchItemCompletionService

      public DefaultBatchItemCompletionService(ImportBatchItemCompletionRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • getRepository

      @NonNull protected ImportBatchItemCompletionRepository<?> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends BatchItemCompletion>
    • createAllFromBatchItems

      public List<P> createAllFromBatchItems(String importId, List<BatchItem> completedBatchItems)
      Description copied from interface: BatchItemCompletionService
      Accepts a list of completed BatchItems and creates a BatchItemCompletion for each of them.
      Specified by:
      createAllFromBatchItems in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      importId - the ID of the import which the batch items belong to
      completedBatchItems - a list of completed batch items
      Returns:
      all of the created batch item completions
    • convertFrom

      protected P convertFrom(String importId, BatchItem completedBatchItem, @Nullable String topLevelParentCorrelationId)
    • readAllByImportId

      public org.springframework.data.domain.Page<P> readAllByImportId(String importId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
      Description copied from interface: BatchItemCompletionService
      Finds and returns all of the item completions whose BatchItemCompletion.importId matches the given value.
      Specified by:
      readAllByImportId in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      importId - the ID of the import whose batch item completions should be returned
      filters - additional filters used to restrict results. Cannot be null - use EmptyNode if no additional filters should be applied.
      pageable - information about which page of results should be returned from the database
      Returns:
      all of the item completions for the given import
    • readAllByImportIdAndStatus

      public Stream<P> readAllByImportIdAndStatus(String importId, String status)
      Description copied from interface: BatchItemCompletionService
      Finds and returns all of the item completions whose BatchItemCompletion.importId matches the given importId and BatchItemCompletion.status given status.
      Specified by:
      readAllByImportIdAndStatus in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      importId - the ID of the import whose batch item completions should be returned
      status - the status of the record to retrieve
      Returns:
      all of the item completions for the given import and status
    • readByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber

      public Stream<P> readByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String importId, @Nullable Collection<String> correlationIdIn, @Nullable Collection<String> topLevelParentCorrelationIdIn)
      Description copied from interface: BatchItemCompletionService
      For the given importId, returns all batch item completion records which either have a BatchItemCompletion.correlationId that matches one of the given correlationIdIn values or a BatchItemCompletion.topLevelParentCorrelationId that matches one of the given topLevelParentCorrelationIdIn values.

      Results must be sorted by BatchItemCompletion.lineNumber in ascending order.

      Specified by:
      readByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      importId - the ID of the import which results should be filtered by
      correlationIdIn - a list of correlation IDs that are valid to return in the result (optional). If not supplied, results will not be filtered by this field.
      topLevelParentCorrelationIdIn - a list of top level parent correlation IDs that are valid to return in the result (optional). If not supplied, results will not be filtered by this field.
      Returns:
      all records which either have a BatchItemCompletion.correlationId that matches one of the given correlationIdIn values or a BatchItemCompletion.topLevelParentCorrelationId that matches one of the given topLevelParentCorrelationIdIn values, sorted by BatchItemCompletion.lineNumber in ascending order
    • findByImportIdAndStatusAndCorrelationIdIn

      public List<P> findByImportIdAndStatusAndCorrelationIdIn(String importId, String status, Set<String> referencedCorrelationIds)
      Description copied from interface: BatchItemCompletionService
      Finds and returns all of the item completions whose BatchItemCompletion.importId matches the given importId, BatchItemCompletion.status the given status and BatchItemCompletion.correlationId the set of correlation ids.
      Specified by:
      findByImportIdAndStatusAndCorrelationIdIn in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      importId - the ID of the import whose batch item completions should be returned
      status - the status of the record to retrieve
      referencedCorrelationIds - the set of correlation ids
      Returns:
      all of the item completions for the given import and status
    • readBatchItemCompletionIdsByImportIdForPurge

      public List<String> readBatchItemCompletionIdsByImportIdForPurge(String importId, int batchSize)
      Description copied from interface: BatchItemCompletionService
      Read a list of batch item completions for the provided import id. The default implementation of this method starts at page 0 with the intention that these batches are getting purged after each call, which would result in a new set of BatchItemCompletion entities.
      Specified by:
      readBatchItemCompletionIdsByImportIdForPurge in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      importId - the import id to match batch item completions against
      batchSize - the batch size for results returned
      Returns:
      a list of batch item completions for the provided import id
    • deleteBatchItemCompletionsById

      public Long deleteBatchItemCompletionsById(List<String> ids)
      Description copied from interface: BatchItemCompletionService
      Delete the batch item completions that match the corresponding ids
      Specified by:
      deleteBatchItemCompletionsById in interface BatchItemCompletionService<P extends BatchItemCompletion>
      Parameters:
      ids - the list of ids to delete
      Returns:
      the number of batch item completions deleted
    • getTypeFactory

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