Class JpaCustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>

java.lang.Object
com.broadleafcommerce.dataimport.provider.jpa.repository.JpaCustomizedImportBatchItemCompletionRepository<D>
All Implemented Interfaces:
com.broadleafcommerce.common.extension.DomainTypeAware, com.broadleafcommerce.common.messaging.notification.NotificationStateRepository, com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment, CustomizedImportBatchItemCompletionRepository<D>

@Repository public class JpaCustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion> extends Object implements CustomizedImportBatchItemCompletionRepository<D>, com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment
Author:
Samarth Dhruva (samarthd)
  • Constructor Details

    • JpaCustomizedImportBatchItemCompletionRepository

      public JpaCustomizedImportBatchItemCompletionRepository(com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment notificationStateRepository)
  • Method Details

    • getDomainType

      public Class<D> getDomainType()
      Specified by:
      getDomainType in interface com.broadleafcommerce.common.extension.DomainTypeAware
    • save

      @Transactional("importTransactionManager") public Object save(Object entity)
    • saveAll

      @Transactional("importTransactionManager") public List<Object> saveAll(Iterable<?> entities)
    • findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber

      public Stream<D> findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String importId, @Nullable Collection<String> correlationIdIn, @Nullable Collection<String> topLevelParentCorrelationIdIn)
      Description copied from interface: CustomizedImportBatchItemCompletionRepository
      For the given importId, returns all batch item completion records which either have a BatchItemCompletion.correlationId that matches one of the given correlationIdIn values or a BatchItemCompletion.topLevelParentCorrelationId that matches one of the given topLevelParentCorrelationIdIn values.

      Results must be sorted by BatchItemCompletion.lineNumber in ascending order.

      Specified by:
      findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber in interface CustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>
      Parameters:
      importId - the ID of the import which results should be filtered by
      correlationIdIn - a list of correlation IDs that are valid to return in the result (optional)
      topLevelParentCorrelationIdIn - a list of top level parent correlation IDs that are valid to return in the result (optional)
      Returns:
      all records which either have a BatchItemCompletion.correlationId that matches one of the given correlationIdIn values or a BatchItemCompletion.topLevelParentCorrelationId that matches one of the given topLevelParentCorrelationIdIn values, sorted by BatchItemCompletion.lineNumber in ascending order
    • initializeForIndexing

      @Deprecated(since="1.8.2", forRemoval=true) @Transactional("importTransactionManager") public D initializeForIndexing(String batchItemCompletionId, com.broadleafcommerce.data.tracking.core.messaging.search.BatchIndexableType type, List<String> idsToIndex)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: CustomizedImportBatchItemCompletionRepository
      If the import is found, atomically initializes the NotificationState for BatchIndexRequestProducer.TYPE, and renews Import.getLastUpdated().
      Specified by:
      initializeForIndexing in interface CustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>
      Parameters:
      batchItemCompletionId - the ID of the BatchItemCompletion instance to modify
      type - The indexable type for the import
      idsToIndex - The repository entity ids to index
      Returns:
      the updated Import if found and updated, null otherwise
    • initializeForIndexing

      @Transactional("importTransactionManager") public D initializeForIndexing(String batchItemCompletionId, String batchIndexableType, List<String> idsToIndex)
      Description copied from interface: CustomizedImportBatchItemCompletionRepository
      If the import is found, atomically initializes the NotificationState for BatchIndexRequestProducer.TYPE, and renews Import.getLastUpdated().
      Specified by:
      initializeForIndexing in interface CustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>
      Parameters:
      batchItemCompletionId - the ID of the BatchItemCompletion instance to modify
      batchIndexableType - The indexable type for the import
      idsToIndex - The repository entity ids to index
      Returns:
      the updated Import if found and updated, null otherwise
    • setNotificationAcknowledged

      public boolean setNotificationAcknowledged(Object nativeId, String messageType, int attemptCount, Class<?> entityType)
      Specified by:
      setNotificationAcknowledged in interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
    • setFailedNotificationAttempt

      public boolean setFailedNotificationAttempt(Object nativeId, String messageType, int attemptCount, Instant nextAttempt, Class<?> entityType, boolean stopped)
      Specified by:
      setFailedNotificationAttempt in interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
    • findNotificationReadyMembers

      public Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware> findNotificationReadyMembers(Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType)
      Specified by:
      findNotificationReadyMembers in interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
    • initializeIndexNotificationState

      @Deprecated(since="1.8.2", forRemoval=true) protected void initializeIndexNotificationState(D entity, Instant changeTimestamp, com.broadleafcommerce.data.tracking.core.messaging.search.BatchIndexableType type, List<String> idsToIndex)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      entity - the entity to initialize the notification state on
      changeTimestamp - the change timestamp to set on the notification state
      type - the batch indexable type to set on the message
      idsToIndex - the IDs to index to set on the message
    • initializeIndexNotificationState

      protected void initializeIndexNotificationState(D entity, Instant changeTimestamp, String batchIndexableType, List<String> idsToIndex)
      Initializes the BatchIndexRequestProducer.TYPE notification state on the given entity.
      Parameters:
      entity - the entity to initialize the notification state on
      changeTimestamp - the change timestamp to set on the notification state
      batchIndexableType - the batch indexable type to set on the message
      idsToIndex - the IDs to index to set on the message
    • initializeNotificationState

      protected com.broadleafcommerce.common.messaging.notification.domain.NotificationState initializeNotificationState(D entity, String notificationStateName, Instant changeTimestamp)
    • buildIdFilter

      protected javax.persistence.criteria.Predicate buildIdFilter(String batchItemCompletionId, javax.persistence.criteria.Root<D> root, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • countByCorrelationIdInOrTopLevelParentIdIn

      protected Long countByCorrelationIdInOrTopLevelParentIdIn(String importId, @Nullable Collection<String> correlationIdIn, @Nullable Collection<String> topLevelParentCorrelationIdIn)
      Has the same criteria filters as findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String, Collection, Collection), and is used for its paging implementation.
      Parameters:
      importId - the ID of the import which results should be filtered by
      correlationIdIn - a list of correlation IDs that are valid to return in the result (optional)
      topLevelParentCorrelationIdIn - a list of top level parent correlation IDs that are valid to return in the result (optional)
      Returns:
      the number of results expected to be returned by findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String, Collection, Collection)
    • applyImportIdCorrelationIdTopLevelParentCorrelationIdFilters

      protected void applyImportIdCorrelationIdTopLevelParentCorrelationIdFilters(String importId, @Nullable Collection<String> correlationIdIn, @Nullable Collection<String> topLevelParentCorrelationIdIn, javax.persistence.criteria.Root<D> batchItemCompletionEntity, javax.persistence.criteria.CriteriaQuery<?> criteria, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
      Parameters:
      importId - the ID of the import which results should be filtered by
      correlationIdIn - a list of correlation IDs that are valid to return in the result (optional)
      topLevelParentCorrelationIdIn - a list of top level parent correlation IDs that are valid to return in the result (optional)
      batchItemCompletionEntity - the root entity on which the query will be performed
      criteria - the criteria query to which the filters will be applied
      criteriaBuilder - the criteria builder used to generate parameters/predicates
      parameterValues - a map of parameter names to argument values that will be used to run the query. Any parameter values required to perform the query should be added to this map.
    • buildImportIdFilter

      protected javax.persistence.criteria.Predicate buildImportIdFilter(javax.persistence.criteria.Root<D> batchItemCompletionEntity, String importId, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • buildCorrelationIdInFilter

      protected javax.persistence.criteria.Predicate buildCorrelationIdInFilter(Collection<String> correlationIdIn, javax.persistence.criteria.Root<D> batchItemCompletionEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • buildTopLevelParentCorrelationIdInFilter

      protected javax.persistence.criteria.Predicate buildTopLevelParentCorrelationIdInFilter(Collection<String> topLevelParentCorrelationIdIn, javax.persistence.criteria.Root<D> batchItemCompletionEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • getEntityManager

      protected javax.persistence.EntityManager getEntityManager()