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
ConstructorDescriptionDefaultBatchService
(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.BatchCompletionRecord
void
createAndProcess
(Batch batch) deleteBatchesByImportId
(List<String> importIds) Delete the batches that match the corresponding import idsprotected 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 aBatch
(specified inBatchCompletion.batchId
) based upon the information received in aBatchCompletion
and 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, 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() -
createAndProcess
- Specified by:
createAndProcess
in interfaceBatchService<P extends Batch>
-
updateProcessingBatchFromCompletion
@Nullable public P updateProcessingBatchFromCompletion(com.broadleafcommerce.common.dataimport.messaging.BatchCompletion batchCompletion) Description copied from interface:BatchService
Updates aBatch
(specified inBatchCompletion.batchId
) based upon the information received in aBatchCompletion
and assuming that the persisted batch isBatchStatus.PROCESSING
.This will set
Batch.completed
to the current time, and update allBatchItems
based on the information in the correspondingBatchCompletionRecords
.- Specified by:
updateProcessingBatchFromCompletion
in interfaceBatchService<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
-
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
Description copied from interface:BatchService
Delete the batches that match the corresponding import ids- Specified by:
deleteBatchesByImportId
in 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()
-