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 Summary
ConstructorDescriptionJpaCustomizedImportBatchItemCompletionRepository
(com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment notificationStateRepository) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyImportIdCorrelationIdTopLevelParentCorrelationIdFilters
(String importId, Collection<String> correlationIdIn, Collection<String> topLevelParentCorrelationIdIn, javax.persistence.criteria.Root<D> batchItemCompletionEntity, javax.persistence.criteria.CriteriaQuery<?> criteria, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) Creates and applies thePredicates
required forfindByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String, Collection, Collection)
.protected javax.persistence.criteria.Predicate
buildCorrelationIdInFilter
(Collection<String> correlationIdIn, javax.persistence.criteria.Root<D> batchItemCompletionEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) protected javax.persistence.criteria.Predicate
buildIdFilter
(String batchItemCompletionId, javax.persistence.criteria.Root<D> root, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) protected javax.persistence.criteria.Predicate
buildImportIdFilter
(javax.persistence.criteria.Root<D> batchItemCompletionEntity, String importId, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) protected javax.persistence.criteria.Predicate
buildTopLevelParentCorrelationIdInFilter
(Collection<String> topLevelParentCorrelationIdIn, javax.persistence.criteria.Root<D> batchItemCompletionEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) protected Long
countByCorrelationIdInOrTopLevelParentIdIn
(String importId, Collection<String> correlationIdIn, Collection<String> topLevelParentCorrelationIdIn) Has the same criteria filters asfindByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String, Collection, Collection)
, and is used for its paging implementation.findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber
(String importId, Collection<String> correlationIdIn, Collection<String> topLevelParentCorrelationIdIn) For the givenimportId
, returns all batch item completion records which either have aBatchItemCompletion.correlationId
that matches one of the givencorrelationIdIn
values or aBatchItemCompletion.topLevelParentCorrelationId
that matches one of the giventopLevelParentCorrelationIdIn
values.Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware>
findNotificationReadyMembers
(Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType) protected javax.persistence.EntityManager
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.initializeForIndexing
(String batchItemCompletionId, String batchIndexableType, List<String> idsToIndex) If the import is found, atomically initializes theNotificationState
forBatchIndexRequestProducer.TYPE
, and renewsImport.getLastUpdated()
.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.protected void
initializeIndexNotificationState
(D entity, Instant changeTimestamp, String batchIndexableType, List<String> idsToIndex) Initializes theBatchIndexRequestProducer.TYPE
notification state on the given entity.protected com.broadleafcommerce.common.messaging.notification.domain.NotificationState
initializeNotificationState
(D entity, String notificationStateName, Instant changeTimestamp) boolean
setFailedNotificationAttempt
(Object nativeId, String messageType, int attemptCount, Instant nextAttempt, Class<?> entityType, boolean stopped) boolean
setNotificationAcknowledged
(Object nativeId, String messageType, int attemptCount, Class<?> entityType)
-
Constructor Details
-
JpaCustomizedImportBatchItemCompletionRepository
public JpaCustomizedImportBatchItemCompletionRepository(com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment notificationStateRepository)
-
-
Method Details
-
getDomainType
- Specified by:
getDomainType
in interfacecom.broadleafcommerce.common.extension.DomainTypeAware
-
save
-
saveAll
-
findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber
public Stream<D> findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String importId, @Nullable Collection<String> correlationIdIn, @Nullable Collection<String> topLevelParentCorrelationIdIn) Description copied from interface:CustomizedImportBatchItemCompletionRepository
For the givenimportId
, returns all batch item completion records which either have aBatchItemCompletion.correlationId
that matches one of the givencorrelationIdIn
values or aBatchItemCompletion.topLevelParentCorrelationId
that matches one of the giventopLevelParentCorrelationIdIn
values.Results must be sorted by
BatchItemCompletion.lineNumber
in ascending order.- Specified by:
findByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber
in interfaceCustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>
- 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)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 givencorrelationIdIn
values or aBatchItemCompletion.topLevelParentCorrelationId
that matches one of the giventopLevelParentCorrelationIdIn
values, sorted byBatchItemCompletion.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.replaced byinitializeForIndexing(String, String, List)
Description copied from interface:CustomizedImportBatchItemCompletionRepository
If the import is found, atomically initializes theNotificationState
forBatchIndexRequestProducer.TYPE
, and renewsImport.getLastUpdated()
.- Specified by:
initializeForIndexing
in interfaceCustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>
- Parameters:
batchItemCompletionId
- the ID of the BatchItemCompletion instance to modifytype
- The indexable type for the importidsToIndex
- 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 theNotificationState
forBatchIndexRequestProducer.TYPE
, and renewsImport.getLastUpdated()
.- Specified by:
initializeForIndexing
in interfaceCustomizedImportBatchItemCompletionRepository<D extends JpaBatchItemCompletion>
- Parameters:
batchItemCompletionId
- the ID of the BatchItemCompletion instance to modifybatchIndexableType
- The indexable type for the importidsToIndex
- 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 interfacecom.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 interfacecom.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 interfacecom.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 onchangeTimestamp
- the change timestamp to set on the notification statetype
- the batch indexable type to set on the messageidsToIndex
- the IDs to index to set on the message
-
initializeIndexNotificationState
protected void initializeIndexNotificationState(D entity, Instant changeTimestamp, String batchIndexableType, List<String> idsToIndex) Initializes theBatchIndexRequestProducer.TYPE
notification state on the given entity.- Parameters:
entity
- the entity to initialize the notification state onchangeTimestamp
- the change timestamp to set on the notification statebatchIndexableType
- the batch indexable type to set on the messageidsToIndex
- the IDs to index to set on the message
-
initializeNotificationState
-
buildIdFilter
-
countByCorrelationIdInOrTopLevelParentIdIn
protected Long countByCorrelationIdInOrTopLevelParentIdIn(String importId, @Nullable Collection<String> correlationIdIn, @Nullable Collection<String> topLevelParentCorrelationIdIn) Has the same criteria filters asfindByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String, Collection, Collection)
, and is used for its paging implementation.- 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)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) Creates and applies thePredicates
required forfindByCorrelationIdInOrTopLevelParentIdInOrderedByLineNumber(String, Collection, Collection)
.- 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)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 performedcriteria
- the criteria query to which the filters will be appliedcriteriaBuilder
- the criteria builder used to generate parameters/predicatesparameterValues
- 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
-
buildCorrelationIdInFilter
-
buildTopLevelParentCorrelationIdInFilter
-
getEntityManager
protected javax.persistence.EntityManager getEntityManager()
-
initializeForIndexing(String, String, List)