Class SimpleWorkflowDaoImpl
java.lang.Object
com.broadleafcommerce.enterprise.workflow.dao.simple.SimpleWorkflowDaoImpl
- All Implemented Interfaces:
SimpleWorkflowDao
@Repository("blSimpleWorkflowDao")
public class SimpleWorkflowDaoImpl
extends Object
implements SimpleWorkflowDao
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.broadleafcommerce.enterprise.workflow.dao.simple.SimpleWorkflowDao
SimpleWorkflowDao.LeafWorkflowState, SimpleWorkflowDao.TransitionableCompositeKey, SimpleWorkflowDao.UserItemCompositeKey -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected jakarta.persistence.EntityManagerprotected booleanprotected BasicIdGeneratorServiceprotected SimpleTableMetadataDaoprotected com.broadleafcommerce.jobsevents.service.DatabaseSystemEventNodeprotected PlatformJDBCUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadvanceWorkflowItems(List<Long> workflowSandboxItemIds, Long targetSandBox) Archive spentWorkflowSandBoxIteminstances and create new ones at the target sandbox.voidarchiveWorkflowItems(List<Long> workflowIds, List<Long> entityItemIds) Archive a list ofWorkflowSandBoxItemandWorkflowEventinstances.voidvoidclearLinkedEntityItems(List<Long> ids) ArchiveEntityIteminstances based on a list of EntityItem ids.voidcompleteUsedWorkflowEvents(Set<Long> eventIds) Archive exhaustedWorkflowEventinstances.voidcompleteUsedWorkflowItems(List<Long> workflowSandboxItemIds) Archive exhaustedWorkflowSandBoxIteminstances.protected PreparedQuerycreatedActiveUserItemRejectStatement(Connection connection) protected PreparedQuerycreateEventToItemAssociationStatement(Connection connection) protected PreparedStatementcreateFetchEventStatusStatement(Connection connection, Set<Long> eventIds) protected jakarta.persistence.TypedQuery<jakarta.persistence.Tuple>protected jakarta.persistence.TypedQuery<jakarta.persistence.Tuple>protected jakarta.persistence.TypedQuery<jakarta.persistence.Tuple>createInheritedSandboxWorkflowItems(Set<String> workflowSandboxItemIds, List<SimpleWorkflowDao.LeafWorkflowState> leafWorkflowStates) EstablishWorkflowSandBoxIteminstances for items propagated into draft import sandboxes at the standard site level resulting from propagation.protected StringcreateOriginalEntityItemFetchStatement(List<Long> deployWorkflowIds) protected PreparedStatementprotected PreparedQuerycreateWorkflowEventDeployRestingStatement(Connection connection) protected PreparedQuerycreateWorkflowEventFailureStatement(Connection connection) protected PreparedQueryprotected PreparedStatementcreateWorkflowItemAdvanceStatement(Connection connection) protected PreparedQuerycreateWorkflowItemCompletionStatement(Connection connection) protected PreparedQuerycreateWorkflowItemErrorAddStatement(Connection connection) protected PreparedQuerycreateWorkflowItemFailureStatement(Connection connection) voidestablishEventAtRest(Long eventId, String message, boolean isCritical) UpdateWorkflowEventstatus to completion.voidestablishEventCompletion(List<Long> eventIds) Complete and archive aWorkflowEvent.voidestablishRejectForActiveUserItems(List<Long> workflowIds, String msg) Update the rejection message on userWorkflowSandBoxIteminstances on rejection when there is already an active user sandbox record.GivenWorkflowSandBoxItem.getGroupDescription()and sandbox information, determine if there is an active user sandbox record for one or more entities.Given entity and sandbox information, find allSimpleTransitionDao.ChangePackage.getDeployTransitionable(List<Long> workflowIds) For a given list ofWorkflowSandBoxItemids, retrieve a list ofSimpleTransitionDao.ChangePackageinstances that describe all the components necessary to determine and execute a sandbox deploy transition using a simple strategy.getLinkedEntityItems(List<Long> workflowIds) Find anyEntityItemids related to the passedWorkflowSandBoxItemids.getNumberOfInProgressItemsByEvent(Set<Long> events) Get a count of in progress WorkflowSandboxItems for a list of eventsgetOriginalEntityItems(List<Long> deployWorkflowIds) Given a list of deploying WorkflowSandboxItem ids, find theEntityIteminstances associated with the originating user changes.getPromotionTransitionable(List<Long> workflowIds) For a given list ofWorkflowSandBoxItemids, retrieve a list ofSimpleTransitionDao.ChangePackageinstances that describe all the components necessary to determine and execute a sandbox promotion transition using a simple strategy.voidinvalidateWorkflowEvents(List<Long> ids) Invalidate L2 cache for several WorkflowEventsvoidInvalidate L2 cache for several WorkflowSandboxItemsqualifiedWorkflowIds(List<Long> workflowIds) Determine what portion (if any) of a list ofWorkflowSandBoxItemprimary key values relate to state that already leveragesChangeDetailstate awareness, and should therefore utilize a "Simple" strategy approach for sandbox transitions.reverseTransitionWorkflowItems(List<Long> workflowSandBoxItemIds, Map<Long, Long> targetSandBoxByItem, String msg) MoveWorkflowSandBoxItembackward, rather than advancing.voidsetupFailedEventItems(List<Long> eventIds) Establish failure state for several eventsvoidsetupFailedWorkflowItems(String correlationId, Throwable exception, Throwable rootCause, List<Long> items) MarkWorkflowSandBoxIteminstances that failed replay
-
Field Details
-
em
protected jakarta.persistence.EntityManager em -
simpleTableMetadataDao
-
systemEventNode
protected com.broadleafcommerce.jobsevents.service.DatabaseSystemEventNode systemEventNode -
idGen
-
util
-
enabled
@Value("${sandbox.lifecycle.strategy.simple.enabled:true}") protected boolean enabled
-
-
Constructor Details
-
SimpleWorkflowDaoImpl
public SimpleWorkflowDaoImpl()
-
-
Method Details
-
archiveWorkflowItems
Description copied from interface:SimpleWorkflowDaoArchive a list ofWorkflowSandBoxItemandWorkflowEventinstances.- Specified by:
archiveWorkflowItemsin interfaceSimpleWorkflowDao- Parameters:
workflowIds- The ids for theWorkflowSandBoxItementities that should be archivedentityItemIds- The ids for theWorkflowEvententities that should be archived
-
getLinkedEntityItems
Description copied from interface:SimpleWorkflowDaoFind anyEntityItemids related to the passedWorkflowSandBoxItemids.- Specified by:
getLinkedEntityItemsin interfaceSimpleWorkflowDao- Parameters:
workflowIds- TheWorkflowSandBoxItemids to check- Returns:
- Any related
EntityItemids
-
getOriginalEntityItems
Description copied from interface:SimpleWorkflowDaoGiven a list of deploying WorkflowSandboxItem ids, find theEntityIteminstances associated with the originating user changes.- Specified by:
getOriginalEntityItemsin interfaceSimpleWorkflowDao- Parameters:
deployWorkflowIds- List of deploying WorkflowSandboxItem ids- Returns:
EntityIteminstances associated with the originating user changes
-
getAllTransitionablesByKey
public List<SimpleTransitionDao.ChangePackage> getAllTransitionablesByKey(List<SimpleWorkflowDao.TransitionableCompositeKey> keys) Description copied from interface:SimpleWorkflowDaoGiven entity and sandbox information, find allSimpleTransitionDao.ChangePackage. This may span multiple authors contributing changes to the same entity.- Specified by:
getAllTransitionablesByKeyin interfaceSimpleWorkflowDao- Parameters:
keys- Entity and sandbox information.- Returns:
- The list of
SimpleTransitionDao.ChangePackageinstances.
-
getActiveUserItems
Description copied from interface:SimpleWorkflowDaoGivenWorkflowSandBoxItem.getGroupDescription()and sandbox information, determine if there is an active user sandbox record for one or more entities.- Specified by:
getActiveUserItemsin interfaceSimpleWorkflowDao- Parameters:
keys- The list ofWorkflowSandBoxItem.getGroupDescription()and sandbox information to test for active user state- Returns:
- A map of
WorkflowSandBoxItem.getDescription()byWorkflowSandBoxItem.getId()denotingWorkflowSandBoxIteminstances related to active user sandbox state.
-
findApprovalItemByExample
- Specified by:
findApprovalItemByExamplein interfaceSimpleWorkflowDao
-
qualifiedWorkflowIds
Description copied from interface:SimpleWorkflowDaoDetermine what portion (if any) of a list ofWorkflowSandBoxItemprimary key values relate to state that already leveragesChangeDetailstate awareness, and should therefore utilize a "Simple" strategy approach for sandbox transitions.- Specified by:
qualifiedWorkflowIdsin interfaceSimpleWorkflowDao- Parameters:
workflowIds- The primary keys of the relevantWorkflowSandBoxIteminstances.- Returns:
- The portion of the passed ids that should utilize a simple strategy.
-
getPromotionTransitionable
Description copied from interface:SimpleWorkflowDaoFor a given list ofWorkflowSandBoxItemids, retrieve a list ofSimpleTransitionDao.ChangePackageinstances that describe all the components necessary to determine and execute a sandbox promotion transition using a simple strategy.- Specified by:
getPromotionTransitionablein interfaceSimpleWorkflowDao- Parameters:
workflowIds- The list ofWorkflowSandBoxItemids for which complete transition information should be retrieved.- Returns:
- The list of transitionable information suitable for informing a promotion transition.
-
getDeployTransitionable
Description copied from interface:SimpleWorkflowDaoFor a given list ofWorkflowSandBoxItemids, retrieve a list ofSimpleTransitionDao.ChangePackageinstances that describe all the components necessary to determine and execute a sandbox deploy transition using a simple strategy.- Specified by:
getDeployTransitionablein interfaceSimpleWorkflowDao- Parameters:
workflowIds- The list ofWorkflowSandBoxItemids for which complete transition information should be retrieved.- Returns:
- The list of transitionable information suitable for informing a deploy transition.
-
createInheritedSandboxWorkflowItems
public Map<String,Long> createInheritedSandboxWorkflowItems(Set<String> workflowSandboxItemIds, List<SimpleWorkflowDao.LeafWorkflowState> leafWorkflowStates) Description copied from interface:SimpleWorkflowDaoEstablishWorkflowSandBoxIteminstances for items propagated into draft import sandboxes at the standard site level resulting from propagation.- Specified by:
createInheritedSandboxWorkflowItemsin interfaceSimpleWorkflowDao- Parameters:
workflowSandboxItemIds- The ids for the deploying WorkflowSandboxItemsleafWorkflowStates- Descriptor information for the standard site workflow state- Returns:
- The new WorkflowSandboxItem id by the deploying WorkflowSandboxItem id
-
completeUsedWorkflowItems
Description copied from interface:SimpleWorkflowDaoArchive exhaustedWorkflowSandBoxIteminstances.- Specified by:
completeUsedWorkflowItemsin interfaceSimpleWorkflowDao- Parameters:
workflowSandboxItemIds- TheWorkflowSandBoxItemids to update.
-
invalidateWorkflowSandboxItems
Description copied from interface:SimpleWorkflowDaoInvalidate L2 cache for several WorkflowSandboxItems- Specified by:
invalidateWorkflowSandboxItemsin interfaceSimpleWorkflowDao- Parameters:
ids- The ids of the items to invalidate in cache
-
invalidateWorkflowEvents
Description copied from interface:SimpleWorkflowDaoInvalidate L2 cache for several WorkflowEvents- Specified by:
invalidateWorkflowEventsin interfaceSimpleWorkflowDao- Parameters:
ids- The ids of the workflow events to invalidate in cache
-
clearLinkedEntityItems
Description copied from interface:SimpleWorkflowDaoArchiveEntityIteminstances based on a list of EntityItem ids.- Specified by:
clearLinkedEntityItemsin interfaceSimpleWorkflowDao- Parameters:
ids- The list of ids for the EntityItem instances to archive
-
establishEventAtRest
Description copied from interface:SimpleWorkflowDaoUpdateWorkflowEventstatus to completion.- Specified by:
establishEventAtRestin interfaceSimpleWorkflowDao- Parameters:
eventId- The id of theWorkflowEventto updatemessage- The message to place on the eventisCritical- Mark whether or not the event is critical
-
establishEventCompletion
Description copied from interface:SimpleWorkflowDaoComplete and archive aWorkflowEvent.- Specified by:
establishEventCompletionin interfaceSimpleWorkflowDao- Parameters:
eventIds- The ids of theWorkflowEvents to update.
-
getNumberOfInProgressItemsByEvent
Description copied from interface:SimpleWorkflowDaoGet a count of in progress WorkflowSandboxItems for a list of events- Specified by:
getNumberOfInProgressItemsByEventin interfaceSimpleWorkflowDao- Parameters:
events- The events for which item status should be checked- Returns:
- Count of in progress items by WorkflowEvent id
-
associateWorkflowItemsToEvents
public void associateWorkflowItemsToEvents(List<Long> workflowSandboxItemIds, Long eventId, List<Long> siteIds) Description copied from interface:SimpleWorkflowDao- Specified by:
associateWorkflowItemsToEventsin interfaceSimpleWorkflowDao- Parameters:
workflowSandboxItemIds- TheWorkflowSandBoxIteminstances to associate to the event.eventId- TheWorkflowEventinstance to associate to the items.siteIds- The site id values (per item) used during the creation of each item.
-
advanceWorkflowItems
Description copied from interface:SimpleWorkflowDaoArchive spentWorkflowSandBoxIteminstances and create new ones at the target sandbox.- Specified by:
advanceWorkflowItemsin interfaceSimpleWorkflowDao- Parameters:
workflowSandboxItemIds- TheWorkflowSandBoxItemids to advance.targetSandBox- The target sandbox for the advanced items.- Returns:
- A map of old
WorkflowSandBoxItemid to newWorkflowSandBoxItemid.
-
reverseTransitionWorkflowItems
public Map<Long,Long> reverseTransitionWorkflowItems(List<Long> workflowSandBoxItemIds, Map<Long, Long> targetSandBoxByItem, String msg) Description copied from interface:SimpleWorkflowDaoMoveWorkflowSandBoxItembackward, rather than advancing. Usually used during a reject.- Specified by:
reverseTransitionWorkflowItemsin interfaceSimpleWorkflowDao- Parameters:
workflowSandBoxItemIds- TheWorkflowSandBoxItemids to move backward.targetSandBoxByItem- The target sandbox for the movement.msg- The message to go with the movement (usually the rejection message).- Returns:
- A map of old
WorkflowSandBoxItemid to newWorkflowSandBoxItemid.
-
establishRejectForActiveUserItems
Description copied from interface:SimpleWorkflowDaoUpdate the rejection message on userWorkflowSandBoxIteminstances on rejection when there is already an active user sandbox record. This would usually occur if a rejection takes place on a change, and the targeted user already has created another change on the same entity prior to the rejection.- Specified by:
establishRejectForActiveUserItemsin interfaceSimpleWorkflowDao- Parameters:
workflowIds- TheWorkflowSandBoxItemids to update.msg- The message to go with the movement (usually the rejection message).
-
setupFailedWorkflowItems
public void setupFailedWorkflowItems(String correlationId, Throwable exception, Throwable rootCause, List<Long> items) Description copied from interface:SimpleWorkflowDaoMarkWorkflowSandBoxIteminstances that failed replay- Specified by:
setupFailedWorkflowItemsin interfaceSimpleWorkflowDao- Parameters:
correlationId- Tie this failure to a message in the application logsexception- The caught exceptionrootCause- The root cause exceptionitems- List ofWorkflowSandBoxItemid
-
setupFailedEventItems
Description copied from interface:SimpleWorkflowDaoEstablish failure state for several events- Specified by:
setupFailedEventItemsin interfaceSimpleWorkflowDao- Parameters:
eventIds- The failed event ids
-
completeUsedWorkflowEvents
Description copied from interface:SimpleWorkflowDaoArchive exhaustedWorkflowEventinstances.- Specified by:
completeUsedWorkflowEventsin interfaceSimpleWorkflowDao- Parameters:
eventIds- TheWorkflowEventids to update.
-
createWorkflowItemCompletionStatement
protected PreparedQuery createWorkflowItemCompletionStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createEventToItemAssociationStatement
protected PreparedQuery createEventToItemAssociationStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createWorkflowEventPromotionRestingStatement
protected PreparedQuery createWorkflowEventPromotionRestingStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createFetchEventStatusStatement
protected PreparedStatement createFetchEventStatusStatement(Connection connection, Set<Long> eventIds) throws SQLException - Throws:
SQLException
-
createWorkflowEventDeployRestingStatement
protected PreparedQuery createWorkflowEventDeployRestingStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createWorkflowItemFailureStatement
protected PreparedQuery createWorkflowItemFailureStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createWorkflowEventFailureStatement
protected PreparedQuery createWorkflowEventFailureStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createWorkflowItemErrorAddStatement
protected PreparedQuery createWorkflowItemErrorAddStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createdActiveUserItemRejectStatement
protected PreparedQuery createdActiveUserItemRejectStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createWorkflowItemAdvanceStatement
protected PreparedStatement createWorkflowItemAdvanceStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createSandboxPropagationWorkflowItemStatement
protected PreparedStatement createSandboxPropagationWorkflowItemStatement(Connection connection) throws SQLException - Throws:
SQLException
-
createOriginalEntityItemFetchStatement
-
createFindAllChangesQuery
protected jakarta.persistence.TypedQuery<jakarta.persistence.Tuple> createFindAllChangesQuery() -
createFindByWorkflowIdsQuery
protected jakarta.persistence.TypedQuery<jakarta.persistence.Tuple> createFindByWorkflowIdsQuery() -
createFindDeployReadyByWorkflowIdsQuery
protected jakarta.persistence.TypedQuery<jakarta.persistence.Tuple> createFindDeployReadyByWorkflowIdsQuery()
-