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
ConstructorsConstructorDescriptionDefaultBatchService(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 TypeMethodDescriptionprotected com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecordvoidcreateAndProcess(Batch batch) deleteAllByImportIdInBatch(List<String> importIds) Delete the batches that match the corresponding import ids using a single query.protected com.broadleafcommerce.common.messaging.notification.NotificationManagerprotected ImportBatchRepository<com.broadleafcommerce.data.tracking.core.Identifiable>protected com.broadleafcommerce.common.extension.TypeFactoryprotected voidupdateBatchItemAndDependents(BatchItem batchItem, Map<String, com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord> correlationIdsToCompletionRecords) protected voidupdateBatchItemFromCompletionRecord(BatchItem toUpdate, com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord completionRecord) updateProcessingBatchFromCompletion(com.broadleafcommerce.common.dataimport.messaging.BatchCompletion batchCompletion) Updates aBatch(specified inBatchCompletion.batchId) based upon the information received in aBatchCompletionand assuming that the persisted batch isBatchStatus.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, updateAllAllowingPartialSuccessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.dataimport.service.BatchService
deleteBatchesByImportIdMethods 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() -
createAndProcess
- Specified by:
createAndProcessin interfaceBatchService<P extends Batch>
-
updateProcessingBatchFromCompletion
@Nullable public P updateProcessingBatchFromCompletion(com.broadleafcommerce.common.dataimport.messaging.BatchCompletion batchCompletion) Description copied from interface:BatchServiceUpdates aBatch(specified inBatchCompletion.batchId) based upon the information received in aBatchCompletionand assuming that the persisted batch isBatchStatus.PROCESSING.This will set
Batch.completedto the current time, and update allBatchItemsbased on the information in the correspondingBatchCompletionRecords.- Specified by:
updateProcessingBatchFromCompletionin interfaceBatchService<P extends Batch>- Parameters:
batchCompletion- the batch completion received from a resource tier service- Returns:
- the updated
Batchor null if the batch could not be updated or was not in a processing state - See Also:
-
updateBatchItemAndDependents
-
buildErrorCompletionRecordForUnackedItem
protected com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord buildErrorCompletionRecordForUnackedItem(BatchItem batchItem) -
updateBatchItemFromCompletionRecord
protected void updateBatchItemFromCompletionRecord(BatchItem toUpdate, com.broadleafcommerce.common.dataimport.messaging.BatchCompletionRecord completionRecord) -
deleteAllByImportIdInBatch
Description copied from interface:BatchServiceDelete the batches that match the corresponding import ids using a single query.- Specified by:
deleteAllByImportIdInBatchin interfaceBatchService<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()
-