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
ConstructorsConstructorDescriptionDefaultBatchItemCompletionService(ImportBatchItemCompletionRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected PconvertFrom(String importId, BatchItem completedBatchItem, String topLevelParentCorrelationId) createAllFromBatchItems(String importId, List<BatchItem> completedBatchItems) Accepts a list of completedBatchItemsand creates aBatchItemCompletionfor each of them.deleteAllByIdInBatch(List<String> ids) Delete the batch item completions that match the corresponding ids using a single query.findByImportIdAndStatusAndCorrelationIdIn(String importId, String status, Set<String> referencedCorrelationIds) Finds and returns all of the item completions whoseBatchItemCompletion.importIdmatches the given importId,BatchItemCompletion.statusthe given status andBatchItemCompletion.correlationIdthe set of correlation ids.protected ImportBatchItemCompletionRepository<?>protected com.broadleafcommerce.common.extension.TypeFactoryorg.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 whoseBatchItemCompletion.importIdmatches the given value.readAllByImportIdAndStatus(String importId, String status) Finds and returns all of the item completions whoseBatchItemCompletion.importIdmatches the given importId andBatchItemCompletion.statusgiven status.readBatchItemCompletionIdsByImportIdForPurge(List<String> importIds, int batchSize) Read a list of batch item completion ids for the provided import ids.readByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String importId, Collection<String> correlationIdIn, Collection<String> topLevelParentCorrelationIdIn) For the givenimportId, returns all batch item completion records which either have aBatchItemCompletion.correlationIdthat matches one of the givencorrelationIdInvalues or aBatchItemCompletion.topLevelParentCorrelationIdthat matches one of the giventopLevelParentCorrelationIdInvalues.Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods 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.BatchItemCompletionService
deleteBatchItemCompletionsById, readBatchItemCompletionIdsByImportIdForPurgeMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccessMethods 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
- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends BatchItemCompletion>
-
createAllFromBatchItems
Description copied from interface:BatchItemCompletionServiceAccepts a list of completedBatchItemsand creates aBatchItemCompletionfor each of them.- Specified by:
createAllFromBatchItemsin interfaceBatchItemCompletionService<P extends BatchItemCompletion>- Parameters:
importId- the ID of the import which the batch items belong tocompletedBatchItems- a list of completed batch items- Returns:
- all of the created batch item completions
-
convertFrom
-
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:BatchItemCompletionServiceFinds and returns all of the item completions whoseBatchItemCompletion.importIdmatches the given value.- Specified by:
readAllByImportIdin interfaceBatchItemCompletionService<P extends BatchItemCompletion>- Parameters:
importId- the ID of the import whose batch item completions should be returnedfilters- additional filters used to restrict results. Cannot be null - useEmptyNodeif 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
Description copied from interface:BatchItemCompletionServiceFinds and returns all of the item completions whoseBatchItemCompletion.importIdmatches the given importId andBatchItemCompletion.statusgiven status.- Specified by:
readAllByImportIdAndStatusin interfaceBatchItemCompletionService<P extends BatchItemCompletion>- Parameters:
importId- the ID of the import whose batch item completions should be returnedstatus- 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:BatchItemCompletionServiceFor the givenimportId, returns all batch item completion records which either have aBatchItemCompletion.correlationIdthat matches one of the givencorrelationIdInvalues or aBatchItemCompletion.topLevelParentCorrelationIdthat matches one of the giventopLevelParentCorrelationIdInvalues.Results must be sorted by
BatchItemCompletion.lineNumberin ascending order.- Specified by:
readByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumberin interfaceBatchItemCompletionService<P extends BatchItemCompletion>- Parameters:
importId- the ID of the import which results should be filtered bycorrelationIdIn- 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.correlationIdthat matches one of the givencorrelationIdInvalues or aBatchItemCompletion.topLevelParentCorrelationIdthat matches one of the giventopLevelParentCorrelationIdInvalues, sorted byBatchItemCompletion.lineNumberin ascending order
-
findByImportIdAndStatusAndCorrelationIdIn
public List<P> findByImportIdAndStatusAndCorrelationIdIn(String importId, String status, Set<String> referencedCorrelationIds) Description copied from interface:BatchItemCompletionServiceFinds and returns all of the item completions whoseBatchItemCompletion.importIdmatches the given importId,BatchItemCompletion.statusthe given status andBatchItemCompletion.correlationIdthe set of correlation ids.- Specified by:
findByImportIdAndStatusAndCorrelationIdInin interfaceBatchItemCompletionService<P extends BatchItemCompletion>- Parameters:
importId- the ID of the import whose batch item completions should be returnedstatus- the status of the record to retrievereferencedCorrelationIds- the set of correlation ids- Returns:
- all of the item completions for the given import and status
-
readBatchItemCompletionIdsByImportIdForPurge
public List<String> readBatchItemCompletionIdsByImportIdForPurge(List<String> importIds, int batchSize) Description copied from interface:BatchItemCompletionServiceRead a list of batch item completion ids for the provided import ids.- Specified by:
readBatchItemCompletionIdsByImportIdForPurgein interfaceBatchItemCompletionService<P extends BatchItemCompletion>- Parameters:
importIds- the import ids to match batch item completions againstbatchSize- the batch size for results returned- Returns:
- a list of batch item completion ids for the provided import id
-
deleteAllByIdInBatch
Description copied from interface:BatchItemCompletionServiceDelete the batch item completions that match the corresponding ids using a single query.- Specified by:
deleteAllByIdInBatchin interfaceBatchItemCompletionService<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()
-