Class DefaultInventoryTransactionService<T extends InventoryTransaction>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<T>
com.broadleafcommerce.inventory.service.DefaultInventoryTransactionService<T>
- Type Parameters:
T-
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<T>,InventoryTransactionService<T>
public class DefaultInventoryTransactionService<T extends InventoryTransaction>
extends com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<T>
implements InventoryTransactionService<T>
Service to save / retrieve
InventoryTransaction records.- Author:
- Kelly Tisdell (ktisdell)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultInventoryTransactionService(InventoryTransactionRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionvoidenhancedDelete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) EssentiallyCrudEntityHelper.delete(java.lang.String, com.broadleafcommerce.data.tracking.core.context.ContextInfo, com.broadleafcommerce.data.tracking.core.TrackableRepository<com.broadleafcommerce.data.tracking.core.Trackable>)that has been adapted to work withCustomizedInventoryTransactionRepository.enhancedFindByContextId(String, ContextInfo)to support the INCLUDE_APPLICATION_ID_PREDICATE context attribute to ignore the application filtering.org.springframework.data.domain.Page<T>enhancedReadByDateCreatedBeforeAndTransactionTypeIn(Instant maxCreatedDate, Set<String> transactionTypes, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads a page of inventory transactions created before a certain date and of certain transaction types.protected com.broadleafcommerce.data.tracking.core.transition.PropagationHelperUtilityprotected InventoryTransactionRepository<com.broadleafcommerce.data.tracking.core.Trackable>Inventory Repository (or DAO).org.springframework.data.domain.Page<T>readByBatchId(String batchId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads a paginated list ofInventoryTransactionrecords based on batchId.org.springframework.data.domain.Page<T>readByDateCreatedBeforeAndTransactionTypeIn(Instant maxCreatedDate, Set<String> transactionTypes, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads a page of inventory transactions created before a certain date and of certain transaction types.readByReferenceNumberAndTransactionTypes(String referenceNumber, Set<String> transactionTypes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list ofInventoryTransactionrecords for 1 or more transaction type with the same referenceNumber.readByReferenceNumbersAndTransactionTypes(List<String> referenceNumbers, Set<String> transactionTypes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list ofInventoryTransactionrecords for 1 or more transaction type with for the given reference numbers.org.springframework.data.domain.Page<T>readBySkuInventoryId(String skuInventoryId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ReadsInventoryTransactionrecords bySkuInventory#getContextId().org.springframework.data.domain.Page<T>readBySkuInventoryIdAndTransactionType(String skuInventoryId, String transactionType, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readByTransactionTypeAndReferenceNumber(String transactionType, String referenceNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ReadsInventoryTransactionrecords byInventoryTransactionTypeand a referenceNumber.readByTransactionTypeAndReferenceNumberAndDateProcessedIsNull(String transactionType, String referenceNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ReadsInventoryTransactionrecords byInventoryTransactionTypeand a referenceNumber where the processed date is null.readReservationTransactionsBySkuInventoryIdAndReferenceNumber(String skuInventoryId, String referenceNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list ofInventoryTransactionrecords that have 1 or more transaction types for the sameSkuInventory.getId()and reference number.voidsetPropagationHelperUtility(com.broadleafcommerce.data.tracking.core.transition.PropagationHelperUtility propagationHelperUtility) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
-
Constructor Details
-
DefaultInventoryTransactionService
public DefaultInventoryTransactionService(InventoryTransactionRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper) - Parameters:
repository-helper-
-
-
Method Details
-
readBySkuInventoryId
public org.springframework.data.domain.Page<T> readBySkuInventoryId(String skuInventoryId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReadsInventoryTransactionrecords bySkuInventory#getContextId().- Specified by:
readBySkuInventoryIdin interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
-
readBySkuInventoryIdAndTransactionType
public org.springframework.data.domain.Page<T> readBySkuInventoryIdAndTransactionType(String skuInventoryId, String transactionType, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionService- Specified by:
readBySkuInventoryIdAndTransactionTypein interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
- See Also:
-
readByTransactionTypeAndReferenceNumber
public List<T> readByTransactionTypeAndReferenceNumber(@NonNull String transactionType, @NonNull String referenceNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReadsInventoryTransactionrecords byInventoryTransactionTypeand a referenceNumber. The referenceNumber could be anything, but typically a unique identifier across a tenant (e.g. Fulfillment Group Item ID, Purchase Order Item ID, etc.)- Specified by:
readByTransactionTypeAndReferenceNumberin interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
-
readByTransactionTypeAndReferenceNumberAndDateProcessedIsNull
public List<T> readByTransactionTypeAndReferenceNumberAndDateProcessedIsNull(@NonNull String transactionType, @NonNull String referenceNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReadsInventoryTransactionrecords byInventoryTransactionTypeand a referenceNumber where the processed date is null. The referenceNumber could be anything, but typically a sales order number, a PO number, or another document number. This allows you to search for records that have not been processed yet.- Specified by:
readByTransactionTypeAndReferenceNumberAndDateProcessedIsNullin interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
-
readReservationTransactionsBySkuInventoryIdAndReferenceNumber
public List<T> readReservationTransactionsBySkuInventoryIdAndReferenceNumber(String skuInventoryId, String referenceNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReturns a list ofInventoryTransactionrecords that have 1 or more transaction types for the sameSkuInventory.getId()and reference number.- Specified by:
readReservationTransactionsBySkuInventoryIdAndReferenceNumberin interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
-
readByReferenceNumberAndTransactionTypes
public List<T> readByReferenceNumberAndTransactionTypes(@NonNull String referenceNumber, @NonNull Set<String> transactionTypes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReturns a list ofInventoryTransactionrecords for 1 or more transaction type with the same referenceNumber.- Specified by:
readByReferenceNumberAndTransactionTypesin interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
-
readByReferenceNumbersAndTransactionTypes
public List<T> readByReferenceNumbersAndTransactionTypes(@NonNull List<String> referenceNumbers, @NonNull Set<String> transactionTypes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReturns a list ofInventoryTransactionrecords for 1 or more transaction type with for the given reference numbers.- Specified by:
readByReferenceNumbersAndTransactionTypesin interfaceInventoryTransactionService<T extends InventoryTransaction>- Parameters:
referenceNumbers- the reference numbers to search fortransactionTypes- the transaction types to search forcontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
InventoryTransactionrecords that have 1 or more transaction types for the given reference numbers
-
readByBatchId
public org.springframework.data.domain.Page<T> readByBatchId(@NonNull String batchId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReads a paginated list ofInventoryTransactionrecords based on batchId.- Specified by:
readByBatchIdin interfaceInventoryTransactionService<T extends InventoryTransaction>- Returns:
-
readByDateCreatedBeforeAndTransactionTypeIn
public org.springframework.data.domain.Page<T> readByDateCreatedBeforeAndTransactionTypeIn(Instant maxCreatedDate, Set<String> transactionTypes, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReads a page of inventory transactions created before a certain date and of certain transaction types.- Specified by:
readByDateCreatedBeforeAndTransactionTypeInin interfaceInventoryTransactionService<T extends InventoryTransaction>
-
enhancedReadByDateCreatedBeforeAndTransactionTypeIn
public org.springframework.data.domain.Page<T> enhancedReadByDateCreatedBeforeAndTransactionTypeIn(Instant maxCreatedDate, Set<String> transactionTypes, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryTransactionServiceReads a page of inventory transactions created before a certain date and of certain transaction types. This method supports the INCLUDE_APPLICATION_ID_PREDICATE context attribute to ignore the application filtering. SeeJpaInventoryTenantQueryHelper.buildContextFilters(com.broadleafcommerce.data.tracking.core.context.ContextInfo, jakarta.persistence.criteria.CriteriaQuery<D>, java.util.Map<java.lang.String, java.lang.Object>, jakarta.persistence.criteria.Root<D>, java.lang.Class<D>)for more information.- Specified by:
enhancedReadByDateCreatedBeforeAndTransactionTypeInin interfaceInventoryTransactionService<T extends InventoryTransaction>- Parameters:
maxCreatedDate- Find transactions created before this date.transactionTypes- Find transactions with one of the given transactionTypes.page- Sublist of filtered transactions.contextInfo- The contextInfo of the request.- Returns:
- Inventory transactions created before the given date, with one of the given statuses, belonging to any application of the tenant from the context.
-
enhancedDelete
public void enhancedDelete(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:InventoryTransactionServiceEssentiallyCrudEntityHelper.delete(java.lang.String, com.broadleafcommerce.data.tracking.core.context.ContextInfo, com.broadleafcommerce.data.tracking.core.TrackableRepository<com.broadleafcommerce.data.tracking.core.Trackable>)that has been adapted to work withCustomizedInventoryTransactionRepository.enhancedFindByContextId(String, ContextInfo)to support the INCLUDE_APPLICATION_ID_PREDICATE context attribute to ignore the application filtering. SeeJpaInventoryTenantQueryHelper.buildContextFilters(com.broadleafcommerce.data.tracking.core.context.ContextInfo, jakarta.persistence.criteria.CriteriaQuery<D>, java.util.Map<java.lang.String, java.lang.Object>, jakarta.persistence.criteria.Root<D>, java.lang.Class<D>)for more information.- Specified by:
enhancedDeletein interfaceInventoryTransactionService<T extends InventoryTransaction>- Parameters:
id- The ID of theInventoryTransactionto delete (archive).context- The context of the request.
-
getRepository
@NonNull protected InventoryTransactionRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()Inventory Repository (or DAO).- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<T extends InventoryTransaction>
-
getPropagationHelperUtility
@Nullable protected com.broadleafcommerce.data.tracking.core.transition.PropagationHelperUtility getPropagationHelperUtility() -
setPropagationHelperUtility
@Autowired public void setPropagationHelperUtility(@Nullable com.broadleafcommerce.data.tracking.core.transition.PropagationHelperUtility propagationHelperUtility)
-