Class DefaultBulkOperationService<P extends BulkOperation>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
com.broadleafcommerce.catalog.service.bulkoperation.DefaultBulkOperationService<P>
- All Implemented Interfaces:
BulkOperationService<P>
,com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
public class DefaultBulkOperationService<P extends BulkOperation>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
implements BulkOperationService<P>
-
Constructor Summary
ConstructorDescriptionDefaultBulkOperationService
(BulkOperationRepository<com.broadleafcommerce.data.tracking.core.Identifiable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper, BulkOperationItemService<BulkOperationItem> bulkOperationItemService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<OperationStatusHistory>
buildOperationStatusHistory
(List<OperationStatusHistory> previousHistory, String newStatus, String newSubStatus, Instant updateTime) protected List<com.broadleafcommerce.bulk.v2.domain.BulkOperationItemResponse>
convertBulkOperationItemsToResponse
(List<BulkOperationItem> bulkOperationItems) protected com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse
convertBulkOperationToResponse
(BulkOperation bulkOperation) protected List<com.broadleafcommerce.bulk.v2.domain.OperationStatusHistoryResponse>
convertOperationStatusHistoryToResponse
(List<OperationStatusHistory> operationStatusHistories) createBulkOperationFromRequest
(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates a bulk operation from the givenBulkOperationRequest
.protected BulkOperationItem
createBulkOperationItem
(BulkOperation bulkOperation, String entityId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) int
deleteAllByIdIn
(@NonNull Collection<String> ids) Deletes all theBulkOperations
matching the given IDs.protected BulkOperationItemService<BulkOperationItem>
protected BulkOperationRepository<com.broadleafcommerce.data.tracking.core.Identifiable>
protected com.broadleafcommerce.common.extension.TypeFactory
com.broadleafcommerce.bulk.v2.domain.InitializeItemResponse
initializeBatchOfItems
(com.broadleafcommerce.bulk.v2.domain.InitializeItemRequest initializeItemRequest, P bulkOperation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Initializes the batch of items on theInitializeItemRequest
.com.broadleafcommerce.bulk.v2.domain.InitializeItemResponse
initializeInclusionItems
(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, P bulkOperation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Initializes the list of inclusion items on theBulkOperationRequest
.readAllByUpdateDateBeforeAndStatusIn
(@NonNull Instant threshold, @NonNull Collection<String> statuses) Retrieves allBulkOperations
last updated before the given threshold.updateStatusAndSubStatus
(String status, String subStatus, P bulkOperation) Updates the bulk operation's status, substatus, and status history.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
-
DefaultBulkOperationService
public DefaultBulkOperationService(BulkOperationRepository<com.broadleafcommerce.data.tracking.core.Identifiable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper, BulkOperationItemService<BulkOperationItem> bulkOperationItemService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
updateStatusAndSubStatus
public P updateStatusAndSubStatus(@Nullable String status, @Nullable String subStatus, P bulkOperation) Description copied from interface:BulkOperationService
Updates the bulk operation's status, substatus, and status history.- Specified by:
updateStatusAndSubStatus
in interfaceBulkOperationService<P extends BulkOperation>
- Parameters:
status
- the new status, if anysubStatus
- the new substatus, if anybulkOperation
- the bulk operation to update- Returns:
- the updated bulk operation
-
initializeInclusionItems
public com.broadleafcommerce.bulk.v2.domain.InitializeItemResponse initializeInclusionItems(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, P bulkOperation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:BulkOperationService
Initializes the list of inclusion items on theBulkOperationRequest
.- Specified by:
initializeInclusionItems
in interfaceBulkOperationService<P extends BulkOperation>
- Parameters:
bulkOperationRequest
- theBulkOperationRequest
to initialize the included itemsbulkOperation
- the bulk operation for these itemscontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- the
InitializeItemResponse
for the items initialized
-
initializeBatchOfItems
public com.broadleafcommerce.bulk.v2.domain.InitializeItemResponse initializeBatchOfItems(com.broadleafcommerce.bulk.v2.domain.InitializeItemRequest initializeItemRequest, P bulkOperation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:BulkOperationService
Initializes the batch of items on theInitializeItemRequest
.- Specified by:
initializeBatchOfItems
in interfaceBulkOperationService<P extends BulkOperation>
- Parameters:
initializeItemRequest
- theInitializeItemRequest
to initialize the itemsbulkOperation
- the bulk operation for these itemscontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- the
InitializeItemResponse
for the batch of items initialized
-
readAllByUpdateDateBeforeAndStatusIn
public List<P> readAllByUpdateDateBeforeAndStatusIn(@NonNull @NonNull Instant threshold, @NonNull @NonNull Collection<String> statuses) Description copied from interface:BulkOperationService
Retrieves allBulkOperations
last updated before the given threshold.- Specified by:
readAllByUpdateDateBeforeAndStatusIn
in interfaceBulkOperationService<P extends BulkOperation>
- Parameters:
threshold
- The date before which to retrieveBulkOperations
statuses
- Collection ofOperationStatuses
to restrict the retrievedBulkOperations
by.- Returns:
- All
BulkOperations
last updated before the given threshold.
-
deleteAllByIdIn
Description copied from interface:BulkOperationService
Deletes all theBulkOperations
matching the given IDs.- Specified by:
deleteAllByIdIn
in interfaceBulkOperationService<P extends BulkOperation>
- Parameters:
ids
- IDs of theBulkOperations
to delete.- Returns:
- The number deleted.
-
createBulkOperationFromRequest
public P createBulkOperationFromRequest(com.broadleafcommerce.bulk.v2.domain.BulkOperationRequest bulkOperationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:BulkOperationService
Creates a bulk operation from the givenBulkOperationRequest
.- Specified by:
createBulkOperationFromRequest
in interfaceBulkOperationService<P extends BulkOperation>
- Parameters:
bulkOperationRequest
- theBulkOperationRequest
to createcontextInfo
- context surrounding sandboxing and multitenant state- Returns:
-
createBulkOperationItem
protected BulkOperationItem createBulkOperationItem(BulkOperation bulkOperation, String entityId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
convertBulkOperationToResponse
protected com.broadleafcommerce.bulk.v2.domain.BulkOperationResponse convertBulkOperationToResponse(BulkOperation bulkOperation) -
convertOperationStatusHistoryToResponse
protected List<com.broadleafcommerce.bulk.v2.domain.OperationStatusHistoryResponse> convertOperationStatusHistoryToResponse(List<OperationStatusHistory> operationStatusHistories) -
convertBulkOperationItemsToResponse
protected List<com.broadleafcommerce.bulk.v2.domain.BulkOperationItemResponse> convertBulkOperationItemsToResponse(List<BulkOperationItem> bulkOperationItems) -
buildOperationStatusHistory
protected List<OperationStatusHistory> buildOperationStatusHistory(List<OperationStatusHistory> previousHistory, String newStatus, String newSubStatus, Instant updateTime) -
getBulkOperationItemService
-
getRepository
protected BulkOperationRepository<com.broadleafcommerce.data.tracking.core.Identifiable> getRepository()- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends BulkOperation>
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-