Class JpaCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>
- java.lang.Object
 - 
- com.broadleafcommerce.bulk.provider.jpa.repository.JpaCustomizedBulkUpdateRepository<D>
 
 
- 
- All Implemented Interfaces:
 CustomizedBulkUpdateRepository<D>,com.broadleafcommerce.common.extension.DomainTypeAware,com.broadleafcommerce.common.messaging.notification.NotificationStateRepository,com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment
public class JpaCustomizedBulkUpdateRepository<D extends JpaBulkUpdate> extends Object implements CustomizedBulkUpdateRepository<D>, com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment
- Author:
 - Samarth Dhruva (samarthd)
 
 
- 
- 
Constructor Summary
Constructors Constructor Description JpaCustomizedBulkUpdateRepository(com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment notificationFragment) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.persistence.criteria.PredicatebuildIdFilter(String bulkUpdateId, javax.persistence.criteria.Root<D> bulkUpdateEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)protected javax.persistence.criteria.PredicatebuildStatusFilter(String status, javax.persistence.criteria.Root<D> bulkUpdateEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)protected javax.persistence.criteria.PredicatebuildStatusInFilter(Collection<String> statuses, javax.persistence.criteria.Root<D> bulkUpdateEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware>findNotificationReadyMembers(Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType)Class<D>getDomainType()protected javax.persistence.EntityManagergetEntityManager()protected com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragmentgetNotificationFragment()DinitializeCreateSandboxNotificationState(String bulkUpdateId)Atomically initializes theNotificationStateforCreateSandboxRequestProducer.TYPEon the given bulk update if it is found to have aBulkUpdate.statusofBulkUpdateStatus.PROCESSING.DinitializeDeleteSandboxNotificationState(String bulkUpdateId)Atomically initializes theNotificationStateforDeleteSandboxRequestProducer.TYPEon the given bulk update if it is found to have aBulkUpdate.statusofBulkUpdateStatus.ERROR.protected voidinitializeNotificationState(D entity, String notificationStateName, Instant changeTimestamp)Objectsave(Object entity)List<Object>saveAll(Iterable<?> entities)DsetContainedErrors(D bulkUpdate)Atomically finds and updates the given bulk update: finds the bulk update with the ID matching the givenbulkUpdate, sets the bulk update'sBulkUpdate.errorsto the errors contained within the givenbulkUpdate, setsBulkUpdate.statustoBulkUpdateStatus.ERROR, and renewsBulkUpdate.lastUpdated.booleansetFailedNotificationAttempt(Object nativeId, String messageType, int attemptCount, Instant nextAttempt, Class<?> entityType, boolean stopped)DsetFinishedStatus(String bulkUpdateId)Atomically sets theBulkUpdate.statustoBulkUpdateStatus.FINISHEDand renewsBulkUpdate.lastUpdatedif the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING.booleansetNotificationAcknowledged(Object nativeId, String messageType, int attemptCount, Class<?> entityType)DsetNumberOfRecordsProcessed(String bulkUpdateId, long numberOfRecordsProcessed)Atomically sets theBulkUpdate.numberOfRecordsProcessedto the given value and renewsBulkUpdate.lastUpdatedif the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING.DsetProcessingStatus(String bulkUpdateId)Atomically updateBulkUpdate.statustoBulkUpdateStatus.PROCESSINGand renewBulkUpdate.lastUpdatedif the currentBulkUpdate.statusisBulkUpdateStatus.REQUESTED. 
 - 
 
- 
- 
Method Detail
- 
getDomainType
public Class<D> getDomainType()
- Specified by:
 getDomainTypein interfacecom.broadleafcommerce.common.extension.DomainTypeAware
 
- 
setNotificationAcknowledged
public boolean setNotificationAcknowledged(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Class<?> entityType)- Specified by:
 setNotificationAcknowledgedin interfacecom.broadleafcommerce.common.messaging.notification.NotificationStateRepository
 
- 
setFailedNotificationAttempt
public boolean setFailedNotificationAttempt(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Instant nextAttempt, @NonNull Class<?> entityType, boolean stopped)- Specified by:
 setFailedNotificationAttemptin interfacecom.broadleafcommerce.common.messaging.notification.NotificationStateRepository
 
- 
findNotificationReadyMembers
@NonNull public Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware> findNotificationReadyMembers(Object lastProcessedNativeId, int pageSize, @NonNull String messageType, @NonNull Duration faultThreshold, @NonNull Class<?> entityType)
- Specified by:
 findNotificationReadyMembersin interfacecom.broadleafcommerce.common.messaging.notification.NotificationStateRepository
 
- 
setProcessingStatus
@Nullable @Transactional public D setProcessingStatus(String bulkUpdateId)
Description copied from interface:CustomizedBulkUpdateRepositoryAtomically updateBulkUpdate.statustoBulkUpdateStatus.PROCESSINGand renewBulkUpdate.lastUpdatedif the currentBulkUpdate.statusisBulkUpdateStatus.REQUESTED.- Specified by:
 setProcessingStatusin interfaceCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>- Parameters:
 bulkUpdateId- the ID of the bulk update to modify- Returns:
 - the updated 
BulkUpdateif found and updated,nullotherwise 
 
- 
buildIdFilter
protected javax.persistence.criteria.Predicate buildIdFilter(String bulkUpdateId, javax.persistence.criteria.Root<D> bulkUpdateEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
 
- 
buildStatusFilter
protected javax.persistence.criteria.Predicate buildStatusFilter(String status, javax.persistence.criteria.Root<D> bulkUpdateEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
 
- 
setContainedErrors
@Nullable @Transactional public D setContainedErrors(D bulkUpdate)
Description copied from interface:CustomizedBulkUpdateRepositoryAtomically finds and updates the given bulk update: finds the bulk update with the ID matching the givenbulkUpdate, sets the bulk update'sBulkUpdate.errorsto the errors contained within the givenbulkUpdate, setsBulkUpdate.statustoBulkUpdateStatus.ERROR, and renewsBulkUpdate.lastUpdated. No other values frombulkUpdateare applied.The change is applied only if the bulk update is found to have a
BulkUpdate.statusofBulkUpdateStatus.REQUESTEDorBulkUpdateStatus.PROCESSING.- Specified by:
 setContainedErrorsin interfaceCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>- Parameters:
 bulkUpdate- a bulk update object containing the errors to set- Returns:
 - the updated bulk update if found and updated, 
nullotherwise 
 
- 
buildStatusInFilter
protected javax.persistence.criteria.Predicate buildStatusInFilter(Collection<String> statuses, javax.persistence.criteria.Root<D> bulkUpdateEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
 
- 
setNumberOfRecordsProcessed
@Nullable @Transactional public D setNumberOfRecordsProcessed(String bulkUpdateId, long numberOfRecordsProcessed)
Description copied from interface:CustomizedBulkUpdateRepositoryAtomically sets theBulkUpdate.numberOfRecordsProcessedto the given value and renewsBulkUpdate.lastUpdatedif the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING.- Specified by:
 setNumberOfRecordsProcessedin interfaceCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>- Parameters:
 bulkUpdateId- the ID of the bulk update to modifynumberOfRecordsProcessed- the new value to set forBulkUpdate.numberOfRecordsProcessed- Returns:
 - the updated 
BulkUpdateif found and updated,nullotherwise 
 
- 
setFinishedStatus
@Nullable @Transactional public D setFinishedStatus(String bulkUpdateId)
Description copied from interface:CustomizedBulkUpdateRepositoryAtomically sets theBulkUpdate.statustoBulkUpdateStatus.FINISHEDand renewsBulkUpdate.lastUpdatedif the bulk update is found and has aBulkUpdate.statusofBulkUpdateStatus.PROCESSING.- Specified by:
 setFinishedStatusin interfaceCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>- Parameters:
 bulkUpdateId- the ID of the bulk update to modify- Returns:
 - the updated 
BulkUpdateif found and updated,nullotherwise 
 
- 
initializeCreateSandboxNotificationState
@Nullable @Transactional public D initializeCreateSandboxNotificationState(String bulkUpdateId)
Description copied from interface:CustomizedBulkUpdateRepositoryAtomically initializes theNotificationStateforCreateSandboxRequestProducer.TYPEon the given bulk update if it is found to have aBulkUpdate.statusofBulkUpdateStatus.PROCESSING.- Specified by:
 initializeCreateSandboxNotificationStatein interfaceCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>- Parameters:
 bulkUpdateId- the ID of the bulk update to modify- Returns:
 - the updated 
BulkUpdateif found and updated,nullotherwise 
 
- 
initializeNotificationState
protected void initializeNotificationState(D entity, String notificationStateName, Instant changeTimestamp)
 
- 
initializeDeleteSandboxNotificationState
@Nullable @Transactional public D initializeDeleteSandboxNotificationState(String bulkUpdateId)
Description copied from interface:CustomizedBulkUpdateRepositoryAtomically initializes theNotificationStateforDeleteSandboxRequestProducer.TYPEon the given bulk update if it is found to have aBulkUpdate.statusofBulkUpdateStatus.ERROR.- Specified by:
 initializeDeleteSandboxNotificationStatein interfaceCustomizedBulkUpdateRepository<D extends JpaBulkUpdate>- Parameters:
 bulkUpdateId- the ID of the bulk update to modify- Returns:
 - the updated 
BulkUpdateif found and updated,nullotherwise 
 
- 
getNotificationFragment
@NonNull protected com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment getNotificationFragment()
 
- 
getEntityManager
protected javax.persistence.EntityManager getEntityManager()
 
 - 
 
 -