Class JpaCustomizedInventoryTransactionRepository<D extends JpaInventoryTransaction>

java.lang.Object
com.broadleafcommerce.inventory.provider.jpa.repository.JpaCustomizedInventoryTransactionRepository<D>
All Implemented Interfaces:
CustomizedInventoryTransactionRepository<D>, org.springframework.beans.factory.InitializingBean

public class JpaCustomizedInventoryTransactionRepository<D extends JpaInventoryTransaction> extends Object implements CustomizedInventoryTransactionRepository<D>, org.springframework.beans.factory.InitializingBean
  • Field Details

  • Constructor Details

    • JpaCustomizedInventoryTransactionRepository

      public JpaCustomizedInventoryTransactionRepository(com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager typeManager, JpaInventoryTenantQueryHelper tenantQueryHelper)
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • enhancedFindByContextId

      @Policy(operationTypes=READ) @NonNull public Optional<D> enhancedFindByContextId(@NonNull String contextId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedInventoryTransactionRepository
      Reads an Inventory Transaction by Context ID. This method supports ignoring application filters by setting the attribute "INCLUDE_APPLICATION_ID_PREDICATE" to false in ContextInfo.additionalProperties.
      Specified by:
      enhancedFindByContextId in interface CustomizedInventoryTransactionRepository<D extends JpaInventoryTransaction>
      Parameters:
      contextId - The context id of the entity to retrieve.
      contextInfo - The context of the request.
      Returns:
      An optional containing the entity that matches the given context ID, or an empty Optional if an entity is not found.
    • enhancedFindByDateCreatedBeforeAndTransactionTypeIn

      @Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> enhancedFindByDateCreatedBeforeAndTransactionTypeIn(Instant maxCreatedDate, Set<String> transactionTypes, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedInventoryTransactionRepository
      Reads a page of inventory transactions created before a certain date and of certain transaction types. Supports returning transactions from all applications in the current tenant if the attribute "INCLUDE_APPLICATION_ID_PREDICATE" is false in ContextInfo.additionalProperties.
      Specified by:
      enhancedFindByDateCreatedBeforeAndTransactionTypeIn in interface CustomizedInventoryTransactionRepository<D extends JpaInventoryTransaction>
      Parameters:
      maxCreatedDate - Find transactions created before this date.
      transactionTypes - Find transactions with one of the given transactionTypes.
      pageable - 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.
    • getDataTrackingPredicates

      protected List<jakarta.persistence.criteria.Predicate> getDataTrackingPredicates(Map<String,Object> params, jakarta.persistence.criteria.CriteriaQuery<D> criteria, jakarta.persistence.criteria.Root<D> root, Class<D> managedType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Get predicates for tenant, archived, active dates, query hints, and query enhancements. This does not add any application filters.
      Parameters:
      params - Map of parameter names to values for the query.
      criteria - The CriteriaQuery that is being created.
      root - The root of the query being created.
      managedType - The type that the repository manages.
      contextInfo - The context of the request.
      Returns:
      List of Predicates for data tracking fields.
    • getDateCreatedPredicate

      protected jakarta.persistence.criteria.Predicate getDateCreatedPredicate(Instant maxCreatedDate, Map<String,Object> params, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root)
      Get a predicate for WHERE dateCreated < maxCreatedDate
      Parameters:
      maxCreatedDate - Filter for records created before or on this Instant.
      params - Map of parameter names to values for the query.
      builder - The CriteriaBuilder for the query.
      root - The root of the query being created.
      Returns:
      A Predicate to filter for records created before the given Instant.
    • getTransactionTypePredicate

      protected jakarta.persistence.criteria.Predicate getTransactionTypePredicate(Set<String> transactionTypes, Map<String,Object> params, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root)
      Get a predicate for WHERE transactionType IN :transactionTypes
      Parameters:
      transactionTypes - Filter for records with one of the given transaction types.
      params - Map of parameter names to values for the query.
      builder - The CriteriaBuilder for the query.
      root - The root of the query being created.
      Returns:
      A Predicate to filter by transaction type.
    • getManagedType

      public Class<D> getManagedType()
      Gets the type that the repository manages.
      Returns:
      the type that this repository manages
    • getTypeManager

      protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager getTypeManager()
    • getTenantQueryHelper

      protected JpaInventoryTenantQueryHelper getTenantQueryHelper()
    • getRepository

      protected InventoryTransactionRepository<D> getRepository()
    • setRepository

      @Autowired @Lazy public void setRepository(InventoryTransactionRepository<D> repository)
    • getEntityManager

      protected jakarta.persistence.EntityManager getEntityManager()