Class JpaCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
java.lang.Object
com.broadleafcommerce.sandbox.provider.jpa.repository.nontrackable.JpaCustomizedChangeSummaryRepository<D>
- All Implemented Interfaces:
com.broadleafcommerce.common.extension.DomainTypeAware
,com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
,com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment
,CustomizedChangeSummaryRepository<D>
public class JpaCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
extends Object
implements CustomizedChangeSummaryRepository<D>, com.broadleafcommerce.common.messaging.notification.NotificationStateRepositoryFragment
- Author:
- Jeff Fischer
-
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedChangeSummaryRepository
(com.broadleafcommerce.data.tracking.jpa.messaging.NotificationStateValueUpdater notificationFragment, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.RSQLVisitorHolder<?> rsqlVisitorHolder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveNotActiveChangeSummariesForSandbox
(String sandboxId) Archives theChangeSummary
for the specified sandbox id.void
batchTransition
(StateChangeOnlyBatchFlushContext flushContext) Given aStateChangeOnlyBatchFlushContext
containingChangeSummaryGroup
andChangeSummary
state change information, perform a batch update of the prescribed state.void
batchTransition
(SummaryBasedFlushContext flushContext) Given aPromoteBatchFlushContext
containingChangeSummary
transition information, update the state of all change summaries in a batch transaction.protected void
buildArchivedIsFalseOrNullPredicate
(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates) protected List<jakarta.persistence.criteria.Predicate>
buildCommonDivergentChangesFilters
(String sandbox, String author, jakarta.persistence.criteria.Root<D> root, jakarta.persistence.criteria.CriteriaBuilder builder, Map<String, Object> params) The base criteria used forfindDivergentChanges(List)
.protected void
buildSandboxPredicate
(String sandboxId, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) boolean
changesOwnedByAuthor
(@NonNull String author, List<String> changeSummaryIds) Whether all the ChangeSummary instances identified by the changeSummaryIds are owned by the requesting author.org.springframework.data.domain.Page<D>
findAllByAuthorAndSandbox
(@NonNull String author, @NonNull String sandbox, String[] statuses, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) Find all Change Summaries for the provided author and sandbox.org.springframework.data.domain.Page<D>
findAllByAuthorAndSandbox
(@NonNull String author, @NonNull String sandbox, String[] statuses, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all Change Summaries for the provided author and sandbox.findArchivedBySandbox
(String sandboxId) Find all archivedChangeSummary
for the provided sandbox id.findChangeSummariesByAuthor
(@NonNull String author, @NonNull String sandbox, @NonNull String state, List<String> status, List<String> ids) Find all records belonging to the current author, sandbox andChangeState
findChangeSummariesByAuthor
(@NonNull String author, @NonNull String sandbox, @NonNull String state, List<String> status, List<String> ids, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all records belonging to the current author, sandbox andChangeState
findChangeSummariesByIds
(List<String> changeSummaryIds) Find all records in the list of idsfindChangeSummariesByIds
(List<String> changeSummaryIds, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all records in the list of idsfindChangeSummariesByIds
(List<String> changeSummaryIds, List<String> states, List<String> statuses, @NonNull String sandbox) Find all records in the list of ids that also have the requested state.findChangeSummariesByIds
(List<String> changeSummaryIds, List<String> states, List<String> statuses, @NonNull String sandbox, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all records in the list of ids that also have the requested state.findChangeSummariesByIdsCount
(List<String> changeSummaryIds, List<String> states, List<String> statuses, @NonNull String sandbox) Find the count of all records in the list of ids that also have the requested state.findChangeSummary
(@NonNull ChangeSummaryRequest changeSummaryRequest) Find an existing record with the corresponding matching values that determine uniqueness.findChangeSummaryId
(@NonNull ChangeSummaryRequest changeSummaryRequest) Find an existing record id with the corresponding matching values that determine uniqueness.findChangeSummaryIdsByAuthor
(@NonNull String author, @NonNull String sandbox, @NonNull String state, List<String> status, List<String> ids) Find all record ids belonging to the current author, sandbox andChangeState
findCompletedTempSandboxByExample
(String changeSummaryId) Based on the example change summary id, check if the change summary refers to a temporary sandbox.findDeployFailedChangeSummaries
(@NonNull String deployId, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all records marked with statusERROR_DEPLOY
for the requesteddeployId
.findDivergentChanges
(List<D> summariesToFindDivergencesFor) Finds all diverged changes for each of the givensummariesToFindDivergencesFor
.findDivergentChangeSummariesByIds
(List<String> changeSummaryIds, @NonNull String sandbox) Find all identified records belonging to the current sandbox containing one or moreChangeDetail
values for which there is an unknown change already promoted by another user.findIdsByTransitionMarker
(@NonNull String transitionMarker) Find all the ids for change summaries whose transition marker field matchesfindIndexableChangeSummariesByIds
(List<String> changeSummaryIds, List<String> states, List<String> status, int limit) Find all records in the list of ids that also have the requested state and have not been acknowledged as indexed.long
findIndexableChangeSummariesByIdsCount
(List<String> changeSummaryIds, List<String> states, List<String> status) Find the count of all records in the list of ids that also have the requested state and have not been acknowledged as indexed.Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware>
findNotificationReadyMembers
(Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType) findSandboxChangeSummaries
(@NonNull String changeContainerName, String changeContainerId, @NonNull String sandbox, String catalog) Find all records with the corresponding matching values in theChangeState.PROMOTED
,ChangeState.APPROVED
, orChangeState.SCHEDULED
state.findSandboxChangeSummaries
(@NonNull String changeContainerName, String changeContainerId, @NonNull String sandbox, String catalog, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all records with the corresponding matching values in theChangeState.PROMOTED
,ChangeState.APPROVED
, orChangeState.SCHEDULED
state.findUserChangeSummaries
(@NonNull String changeContainerName, String changeContainerId, @NonNull String author, @NonNull String sandbox, String catalog, boolean scheduled) Find all user records with the corresponding matching values.findUserChangeSummaries
(@NonNull String changeContainerName, String changeContainerId, @NonNull String author, @NonNull String sandbox, String catalog, boolean scheduled, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all user records with the corresponding matching values.protected com.broadleafcommerce.common.extension.TypeFactory
protected JpaVendorNarrowingQueryCustomizer
boolean
hasLastGroupingReference
(String changeSummaryId) Determine if theJpaChangeSummary
instance has alastGroupRelation
value.protected void
insertNotificationStateMatchingValues
(@NonNull String containerId, @NonNull String name, @NonNull Class<?> entityType, @NonNull Map<String, Object> values) readByIdAndArchivedNot
(String id, boolean archived, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) TakesChangeSummary.getArchived()
into account when retrieving a group with the given ID.<S extends D>
Ssave
(S entity) boolean
setFailedNotificationAttempt
(Object nativeId, String messageType, int attemptCount, Instant nextAttempt, Class<?> entityType, boolean stopped) boolean
setNotificationAcknowledged
(Object nativeId, String messageType, int attemptCount, Class<?> entityType) void
setSandboxService
(SandboxService<Sandbox> sandboxService) void
setTypeFactory
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) void
setVendorNarrowingQueryCustomizerProvider
(org.springframework.beans.factory.ObjectProvider<JpaVendorNarrowingQueryCustomizer> vendorNarrowingQueryCustomizerProvider) If vendor processing is enabled, this bean will be injected and and used for vendor narrowing.boolean
updateVals
(@NonNull String changeSummaryId, List<String> whereStates, List<String> whereStatus, String messageType, Map<String, Object> vals) Update the fields for a record matching the id.boolean
updateVals
(@NonNull String changeSummaryId, List<String> whereStates, List<String> whereStatus, String messageType, Map<String, Object> vals, boolean insertNotificationStateIfMissing) Update the fields for a record matching the idvoid
updateVals
(@NonNull List<String> changeSummaryIds, String whereState, List<String> whereStatus, @NonNull Map<String, Object> vals) Update the fields for all non-archived records matching the idsvoid
updateVals
(@NonNull List<String> changeSummaryIds, List<String> whereStates, List<String> whereStatus, @NonNull Map<String, Object> vals) Update the fields for multiple records matching the idsprotected void
validateChangeSummariesNotActive
(String sandboxId)
-
Constructor Details
-
JpaCustomizedChangeSummaryRepository
public JpaCustomizedChangeSummaryRepository(com.broadleafcommerce.data.tracking.jpa.messaging.NotificationStateValueUpdater notificationFragment, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.RSQLVisitorHolder<?> rsqlVisitorHolder)
-
-
Method Details
-
save
- Specified by:
save
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
-
saveAll
-
findCompletedTempSandboxByExample
Description copied from interface:CustomizedChangeSummaryRepository
Based on the example change summary id, check if the change summary refers to a temporary sandbox. Return null if not. If so, find the count of remaining active ChangeSummary instances that also refer to that sandbox. A returned sandbox id indicates all ChangeSummary instances have completed their lifecycle and the sandbox can be archived. If there are still active ChangeSummary instances for the sandbox, null is returned.- Specified by:
findCompletedTempSandboxByExample
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryId
- The id of the ChangeSummary to check for temporary sandbox status.- Returns:
- null if not associated with a temporary sandbox, or some ChangeSummaries are still active against the sandbox. Otherwise, the sandbox id of the Sandbox that can be archived.
-
findAllByAuthorAndSandbox
public org.springframework.data.domain.Page<D> findAllByAuthorAndSandbox(@NonNull @NonNull String author, @NonNull @NonNull String sandbox, @Nullable String[] statuses, org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters) Description copied from interface:CustomizedChangeSummaryRepository
Find all Change Summaries for the provided author and sandbox.- Specified by:
findAllByAuthorAndSandbox
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
author
- the author of the change summaries to returnsandbox
- the sandbox associated to the change summaries to returnstatuses
- the list ofChangeStatusType
values for which aChangeSummary.getStatus()
should match one of. Optional.page
- pagination informationfilters
- the RSQLNode
used to restrict result- Returns:
- all Change Summaries for the provided author and sandbox and not matching the given archived status
-
findAllByAuthorAndSandbox
public org.springframework.data.domain.Page<D> findAllByAuthorAndSandbox(@NonNull @NonNull String author, @NonNull @NonNull String sandbox, @Nullable String[] statuses, org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all Change Summaries for the provided author and sandbox.- Specified by:
findAllByAuthorAndSandbox
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
author
- the author of the change summaries to returnsandbox
- the sandbox associated to the change summaries to returnstatuses
- the list ofChangeStatusType
values for which aChangeSummary.getStatus()
should match one of. Optional.page
- pagination informationfilters
- the RSQLNode
used to restrict resultvendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- all Change Summaries for the provided author and sandbox and not matching the given archived status
-
findIdsByTransitionMarker
Description copied from interface:CustomizedChangeSummaryRepository
Find all the ids for change summaries whose transition marker field matches- Specified by:
findIdsByTransitionMarker
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
transitionMarker
- A marker id representing a transition- Returns:
- All the ids for change summaries whose transition marker field matches
-
readByIdAndArchivedNot
public Optional<D> readByIdAndArchivedNot(String id, boolean archived, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
TakesChangeSummary.getArchived()
into account when retrieving a group with the given ID.- Specified by:
readByIdAndArchivedNot
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
id
- ID of the group to retrievearchived
-ChangeSummary.getArchived()
value to not matchvendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- A
ChangeSummary
matching the given ID and not matching the given archived status.
-
findChangeSummary
Description copied from interface:CustomizedChangeSummaryRepository
Find an existing record with the corresponding matching values that determine uniqueness.- Specified by:
findChangeSummary
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryRequest
- Request DTO to find a matching change summary- Returns:
- an optional matching record
-
findChangeSummaryId
public Optional<String> findChangeSummaryId(@NonNull @NonNull ChangeSummaryRequest changeSummaryRequest) Description copied from interface:CustomizedChangeSummaryRepository
Find an existing record id with the corresponding matching values that determine uniqueness.- Specified by:
findChangeSummaryId
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryRequest
- Request DTO to find a matching change summary- Returns:
- an optional matching record id
-
findChangeSummariesByAuthor
public Stream<D> findChangeSummariesByAuthor(@NonNull @NonNull String author, @NonNull @NonNull String sandbox, @NonNull @NonNull String state, @Nullable List<String> status, @Nullable List<String> ids) Description copied from interface:CustomizedChangeSummaryRepository
Find all records belonging to the current author, sandbox andChangeState
- Specified by:
findChangeSummariesByAuthor
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
author
-ChangeSummary.getAuthor()
sandbox
-ChangeSummary.getSandbox()
state
-ChangeSummary.getState()
status
- OptionalChangeSummary.getStatus()
ids
- Optional list of ids to filter by- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found.
-
findChangeSummariesByAuthor
public Stream<D> findChangeSummariesByAuthor(@NonNull @NonNull String author, @NonNull @NonNull String sandbox, @NonNull @NonNull String state, @Nullable List<String> status, @Nullable List<String> ids, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all records belonging to the current author, sandbox andChangeState
- Specified by:
findChangeSummariesByAuthor
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
author
-ChangeSummary.getAuthor()
sandbox
-ChangeSummary.getSandbox()
state
-ChangeSummary.getState()
status
- OptionalChangeSummary.getStatus()
ids
- Optional list of ids to filter byvendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found.
-
findChangeSummaryIdsByAuthor
public List<String> findChangeSummaryIdsByAuthor(@NonNull @NonNull String author, @NonNull @NonNull String sandbox, @NonNull @NonNull String state, @Nullable List<String> status, @Nullable List<String> ids) Description copied from interface:CustomizedChangeSummaryRepository
Find all record ids belonging to the current author, sandbox andChangeState
- Specified by:
findChangeSummaryIdsByAuthor
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
author
-ChangeSummary.getAuthor()
sandbox
-ChangeSummary.getSandbox()
state
-ChangeSummary.getState()
status
- OptionalChangeSummary.getStatus()
ids
- Optional list of ids to filter by- Returns:
- list of ids
-
findChangeSummariesByIds
public Stream<D> findChangeSummariesByIds(List<String> changeSummaryIds, List<String> states, @Nullable List<String> statuses, @NonNull @NonNull String sandbox) Description copied from interface:CustomizedChangeSummaryRepository
Find all records in the list of ids that also have the requested state.- Specified by:
findChangeSummariesByIds
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptystates
- the required matching stateChangeSummary.getState()
, cannot be emptystatuses
- optionalChangeSummary.getStatus()
to filter bysandbox
- sandbox to filter records by, cannot be null- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found
-
findChangeSummariesByIds
public Stream<D> findChangeSummariesByIds(List<String> changeSummaryIds, List<String> states, @Nullable List<String> statuses, @NonNull @NonNull String sandbox, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all records in the list of ids that also have the requested state.- Specified by:
findChangeSummariesByIds
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptystates
- the required matching stateChangeSummary.getState()
, cannot be emptystatuses
- optionalChangeSummary.getStatus()
to filter bysandbox
- sandbox to filter records by, cannot be nullvendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found
-
findChangeSummariesByIds
Description copied from interface:CustomizedChangeSummaryRepository
Find all records in the list of ids- Specified by:
findChangeSummariesByIds
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be empty- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found
-
findChangeSummariesByIds
public Stream<D> findChangeSummariesByIds(List<String> changeSummaryIds, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all records in the list of ids- Specified by:
findChangeSummariesByIds
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptyvendorNarrowing
- whether to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found
-
findChangeSummariesByIdsCount
public Long findChangeSummariesByIdsCount(List<String> changeSummaryIds, List<String> states, @Nullable List<String> statuses, @NonNull @NonNull String sandbox) Description copied from interface:CustomizedChangeSummaryRepository
Find the count of all records in the list of ids that also have the requested state.- Specified by:
findChangeSummariesByIdsCount
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptystates
- the required matching stateChangeSummary.getState()
, cannot be emptystatuses
- optionalChangeSummary.getStatus()
to filter bysandbox
- sandbox to filter records by, cannot be null- Returns:
- A Stream that can be iterated, possibly containing a large number or records or an empty stream if none found
-
findIndexableChangeSummariesByIds
public List<BatchIndexable> findIndexableChangeSummariesByIds(List<String> changeSummaryIds, List<String> states, @Nullable List<String> status, int limit) Description copied from interface:CustomizedChangeSummaryRepository
Find all records in the list of ids that also have the requested state and have not been acknowledged as indexed. Must be related to anIndexable
entity to qualify.- Specified by:
findIndexableChangeSummariesByIds
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptystates
- the required matching stateChangeSummary.getState()
, cannot be emptystatus
- optionalChangeSummary.getStatus()
to filter bylimit
- the max amount of records to return- Returns:
- The list of records
-
findIndexableChangeSummariesByIdsCount
public long findIndexableChangeSummariesByIdsCount(List<String> changeSummaryIds, List<String> states, @Nullable List<String> status) Description copied from interface:CustomizedChangeSummaryRepository
Find the count of all records in the list of ids that also have the requested state and have not been acknowledged as indexed. Must be related to anIndexable
entity to qualify.- Specified by:
findIndexableChangeSummariesByIdsCount
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptystates
- the required matching stateChangeSummary.getState()
, cannot be emptystatus
- optionalChangeSummary.getStatus()
to filter by- Returns:
- The count of matching records
-
findDivergentChangeSummariesByIds
public List<String> findDivergentChangeSummariesByIds(List<String> changeSummaryIds, @NonNull @NonNull String sandbox) Description copied from interface:CustomizedChangeSummaryRepository
Find all identified records belonging to the current sandbox containing one or moreChangeDetail
values for which there is an unknown change already promoted by another user.- Specified by:
findDivergentChangeSummariesByIds
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The requested list ofChangeSummary.getId()
, cannot be emptysandbox
- The sandbox for which change summaries should be filtered- Returns:
- The list of divergent
ChangeSummary.getId()
values, or an empty stream if none found
-
findDeployFailedChangeSummaries
public Stream<D> findDeployFailedChangeSummaries(@NonNull @NonNull String deployId, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all records marked with statusERROR_DEPLOY
for the requesteddeployId
.- Specified by:
findDeployFailedChangeSummaries
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
deployId
- The deployment to which the records are associatedvendorNarrowing
- Whether to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- Context information about sandboxing and multitenant state- Returns:
- All records marked with status
ERROR_DEPLOY
for the requesteddeployId
as a stream
-
updateVals
@Transactional("sandboxTransactionManager") public boolean updateVals(@NonNull @NonNull String changeSummaryId, @Nullable List<String> whereStates, @Nullable List<String> whereStatus, @Nullable String messageType, Map<String, Object> vals) Description copied from interface:CustomizedChangeSummaryRepository
Update the fields for a record matching the id.
Calling this method is the same as calling
CustomizedChangeSummaryRepository.updateVals(String, List, List, String, Map, boolean)
, but with theinsertNotificationStateIfMissing
parameter set tofalse
.- Specified by:
updateVals
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryId
- The id requested to mutatewhereStates
- The current state of the ChangeSummary to match. Can be emptywhereStatus
- list of status values that a ChangeSummary should match one or more of. Can be emptymessageType
- if some of thevals
target a notification state of a certain message type, this value should be supplied to filter to that state. Optional.vals
- Map of field to value changes to make to the ChangeSummary instance- Returns:
- Whether or not an update was performed. If no record found matching the id and state, will return false.
-
updateVals
@Transactional("sandboxTransactionManager") public boolean updateVals(@NonNull @NonNull String changeSummaryId, @Nullable List<String> whereStates, @Nullable List<String> whereStatus, @Nullable String messageType, Map<String, Object> vals, boolean insertNotificationStateIfMissing) Description copied from interface:CustomizedChangeSummaryRepository
Update the fields for a record matching the id- Specified by:
updateVals
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryId
- The id requested to mutatewhereStates
- The current state of the ChangeSummary to match. Can be emptywhereStatus
- list of status values that a ChangeSummary should match one or more of. Can be emptymessageType
- if some of thevals
target a notification state of a certain message type, this value should be supplied to filter to that state. Optional.vals
- Map of field to value changes to make to the ChangeSummary instanceinsertNotificationStateIfMissing
- ifvals
target a notification state andmessageType
is provided, this flag determines whether the flow will newly insert the notification state if it does not already exist in the datastore. In other words, when this flag is false, the flow will only try to update an existing notification state with the provided details invals
. When this flag istrue
, if the update attempt is unsuccessful because the notification state is missing, the flow will attempt to newly insert that state into the datastore.- Returns:
- Whether or not an update was performed. If no record found matching the id and state, will return false.
- See Also:
-
insertNotificationStateMatchingValues
-
batchTransition
@Transactional("sandboxTransactionManager") public void batchTransition(SummaryBasedFlushContext flushContext) Description copied from interface:CustomizedChangeSummaryRepository
Given aPromoteBatchFlushContext
containingChangeSummary
transition information, update the state of all change summaries in a batch transaction.- Specified by:
batchTransition
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
flushContext
- Context object containing all change summary transition to batch commit
-
batchTransition
@Transactional("sandboxTransactionManager") public void batchTransition(StateChangeOnlyBatchFlushContext flushContext) Description copied from interface:CustomizedChangeSummaryRepository
Given aStateChangeOnlyBatchFlushContext
containingChangeSummaryGroup
andChangeSummary
state change information, perform a batch update of the prescribed state. This does not involved changes to notification states and does not result in state related to sending messages.- Specified by:
batchTransition
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
flushContext
- Context containingChangeSummaryGroup
andChangeSummary
state change information
-
updateVals
@Transactional("sandboxTransactionManager") public void updateVals(@NonNull @NonNull List<String> changeSummaryIds, @Nullable String whereState, @Nullable List<String> whereStatus, @NonNull @NonNull Map<String, Object> vals) Description copied from interface:CustomizedChangeSummaryRepository
Update the fields for all non-archived records matching the ids- Specified by:
updateVals
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The ids requested to mutatewhereState
- The current state of the ChangeSummary to match. Optional.whereStatus
- list of status values that a ChangeSummary should match one or more of. Optional.vals
- Map of field to value changes to make to the ChangeSummary instance
-
updateVals
@Transactional("sandboxTransactionManager") public void updateVals(@NonNull @NonNull List<String> changeSummaryIds, @Nullable List<String> whereStates, @Nullable List<String> whereStatus, @NonNull @NonNull Map<String, Object> vals) Description copied from interface:CustomizedChangeSummaryRepository
Update the fields for multiple records matching the ids- Specified by:
updateVals
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryIds
- The ids requested to mutatewhereStates
- The validChangeState
value for whichChangeSummary.getState()
should matchwhereStatus
- The list ofChangeStatusType
values for whichChangeSummary.getStatus()
should match one or more of. Can be empty to indicate no filtrationvals
- Map of field to value changes to make to the ChangeSummary instance
-
changesOwnedByAuthor
Description copied from interface:CustomizedChangeSummaryRepository
Whether all the ChangeSummary instances identified by the changeSummaryIds are owned by the requesting author.- Specified by:
changesOwnedByAuthor
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
author
- The author making the request.ContextInfo.getAuthor()
changeSummaryIds
- The ids requested to mutate- Returns:
- Whether all the requested ids belong to ChangeSummary instances owned by the author
-
findSandboxChangeSummaries
public List<D> findSandboxChangeSummaries(@NonNull @NonNull String changeContainerName, @Nullable String changeContainerId, @NonNull @NonNull String sandbox, @Nullable String catalog) Description copied from interface:CustomizedChangeSummaryRepository
Find all records with the corresponding matching values in theChangeState.PROMOTED
,ChangeState.APPROVED
, orChangeState.SCHEDULED
state.- Specified by:
findSandboxChangeSummaries
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeContainerName
-SandboxChangeContainer.getName()
changeContainerId
-SandboxChangeContainer.getId()
sandbox
-ChangeSummary.getSandbox()
. Optional.catalog
-ChangeCatalogInfo.getContextId()
. Optional.- Returns:
- Find all records with the corresponding matching values in the
ChangeState.PROMOTED
,ChangeState.APPROVED
, orChangeState.SCHEDULED
state
-
findSandboxChangeSummaries
public List<D> findSandboxChangeSummaries(@NonNull @NonNull String changeContainerName, @Nullable String changeContainerId, @NonNull @NonNull String sandbox, @Nullable String catalog, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all records with the corresponding matching values in theChangeState.PROMOTED
,ChangeState.APPROVED
, orChangeState.SCHEDULED
state.- Specified by:
findSandboxChangeSummaries
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeContainerName
-SandboxChangeContainer.getName()
changeContainerId
-SandboxChangeContainer.getId()
sandbox
-ChangeSummary.getSandbox()
. Optional.catalog
-ChangeCatalogInfo.getContextId()
. Optional.vendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- Find all records with the corresponding matching values in the
ChangeState.PROMOTED
,ChangeState.APPROVED
, orChangeState.SCHEDULED
state
-
findUserChangeSummaries
public List<D> findUserChangeSummaries(@NonNull @NonNull String changeContainerName, @Nullable String changeContainerId, @NonNull @NonNull String author, @NonNull @NonNull String sandbox, @Nullable String catalog, boolean scheduled) Description copied from interface:CustomizedChangeSummaryRepository
Find all user records with the corresponding matching values.- Specified by:
findUserChangeSummaries
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeContainerName
-SandboxChangeContainer.getName()
changeContainerId
-SandboxChangeContainer.getId()
. Optional.author
-ChangeSummary.getAuthor()
sandbox
-ChangeSummary.getSandbox()
catalog
-ChangeCatalogInfo.getContextId()
. Optional.scheduled
- Applies to a user change summary that is in a scheduled for deploy stateChangeState.SCHEDULED
. This state can occur during aTransitionRequestManager.promoteDeploy(PromoteSummaries, ContextInfo, String)
flow (especially when there was an error during the deployment).- Returns:
- Find all user records with the corresponding matching values
-
findUserChangeSummaries
public List<D> findUserChangeSummaries(@NonNull @NonNull String changeContainerName, @Nullable String changeContainerId, @NonNull @NonNull String author, @NonNull @NonNull String sandbox, @Nullable String catalog, boolean scheduled, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedChangeSummaryRepository
Find all user records with the corresponding matching values.- Specified by:
findUserChangeSummaries
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeContainerName
-SandboxChangeContainer.getName()
changeContainerId
-SandboxChangeContainer.getId()
. Optional.author
-ChangeSummary.getAuthor()
sandbox
-ChangeSummary.getSandbox()
catalog
-ChangeCatalogInfo.getContextId()
. Optional.scheduled
- Applies to a user change summary that is in a scheduled for deploy stateChangeState.SCHEDULED
. This state can occur during aTransitionRequestManager.promoteDeploy(PromoteSummaries, ContextInfo, String)
flow (especially when there was an error during the deployment).vendorNarrowing
- whether to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- Find all user records with the corresponding matching values
-
findDivergentChanges
public Map<String,Set<DivergedChange>> findDivergentChanges(@Nullable List<D> summariesToFindDivergencesFor) Description copied from interface:CustomizedChangeSummaryRepository
Finds all diverged changes for each of the givensummariesToFindDivergencesFor
.Diverged changes are defined as being the list of changes that have been promoted in advance of a change summary. The base from which the change summary is derived has diverged as a result of these changes detected.
- Specified by:
findDivergentChanges
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
summariesToFindDivergencesFor
- All the summaries for which diverged changes need to be found. All of these summaries must have the sameChangeSummary.getAuthor()
and the sameChangeSummary.getSandbox()
. They must also all have anChangeSummary.getEntityType()
.- Returns:
- a map where the key is the ID of a requested summary and the value is the set of diverged changes that were found for it. If there were no diverged changes for a summary, the value for its key will be an empty set. If the input map is empty, the output map will also be empty.
-
getDomainType
- Specified by:
getDomainType
in interfacecom.broadleafcommerce.common.extension.DomainTypeAware
-
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(@Nullable Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType) - Specified by:
findNotificationReadyMembers
in interfacecom.broadleafcommerce.common.messaging.notification.NotificationStateRepository
-
archiveNotActiveChangeSummariesForSandbox
Description copied from interface:CustomizedChangeSummaryRepository
Archives theChangeSummary
for the specified sandbox id.- Specified by:
archiveNotActiveChangeSummariesForSandbox
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
sandboxId
- the sandbox id associated to the change summaries- See Also:
-
hasLastGroupingReference
Description copied from interface:CustomizedChangeSummaryRepository
Determine if theJpaChangeSummary
instance has alastGroupRelation
value.- Specified by:
hasLastGroupingReference
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
changeSummaryId
- The primary key value- Returns:
- Whether the lastGroupRelation is available
-
validateChangeSummariesNotActive
-
buildSandboxPredicate
-
buildArchivedIsFalseOrNullPredicate
-
findArchivedBySandbox
Description copied from interface:CustomizedChangeSummaryRepository
Find all archivedChangeSummary
for the provided sandbox id.- Specified by:
findArchivedBySandbox
in interfaceCustomizedChangeSummaryRepository<D extends JpaChangeSummary>
- Parameters:
sandboxId
- he sandbox id associated to the change summaries- Returns:
- the list of archived
ChangeSummary
-
buildCommonDivergentChangesFilters
protected List<jakarta.persistence.criteria.Predicate> buildCommonDivergentChangesFilters(String sandbox, String author, jakarta.persistence.criteria.Root<D> root, jakarta.persistence.criteria.CriteriaBuilder builder, Map<String, Object> params) The base criteria used forfindDivergentChanges(List)
.- Parameters:
sandbox
- the sandbox to matchauthor
- the author that the results must not matchroot
- the query rootbuilder
- the criteria builderparams
- a map of parameter values that will be supplied to the query. If this method defines new parameters, place their values in this map.- Returns:
- a list of base criteria used for
findDivergentChanges(List)
-
getVendorNarrowingQueryCustomizer
-
setSandboxService
-
setVendorNarrowingQueryCustomizerProvider
@Autowired public void setVendorNarrowingQueryCustomizerProvider(org.springframework.beans.factory.ObjectProvider<JpaVendorNarrowingQueryCustomizer> vendorNarrowingQueryCustomizerProvider) If vendor processing is enabled, this bean will be injected and and used for vendor narrowing.We leverage
ObjectProvider
here since we want both optional and lazy injection. This is to avoid a situation where the query customizer creates a circular dependency. -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-