Package com.atlassian.jira.workflow
Class CachingWorkflowDescriptorStore
java.lang.Object
com.atlassian.jira.workflow.CachingWorkflowDescriptorStore
- All Implemented Interfaces:
InitializingComponent,WorkflowDescriptorStore
public class CachingWorkflowDescriptorStore
extends Object
implements WorkflowDescriptorStore, InitializingComponent
Used to cache workflowDescriptors in JIRA. This caches
ImmutableWorkflowDescriptors.
These objects are very heavy weight and ideally we would not cache them, but it is the only way to
quickly give JIRA access to workflow objects. This is because the safe thing to cache is the workflow XML string but
converting this to an object graph will be expensive. Also please note that the implementation of
ImmutableWorkflowDescriptor cannot guarantee 100% immutability.
This is essentially replacing the store in the JiraWorkflowFactory, but it adds
some more concurrency controls to ensure consistency with the underlying store (such as the
OfBizWorkflowDescriptorStore)
- Since:
- v3.13
-
Constructor Summary
ConstructorsConstructorDescriptionCachingWorkflowDescriptorStore(WorkflowDescriptorStore delegate, com.atlassian.cache.CacheManager cacheManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after all the beans are constructed and the ApplicationContext is fully populated.Returns a list of all the workflows stored in the underlying store.getWorkflow(String name) Retrieves aWorkflowDescriptorfrom the underlying store.String[]Returns an array of all the workflowNames stored.voidonClearCache(ClearCacheEvent event) voidbooleanremoveWorkflow(String name) Removes a workflow from the underlying store.booleansaveWorkflow(String name, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, boolean replace) Saves or updates a workflowDescriptor.
-
Constructor Details
-
CachingWorkflowDescriptorStore
public CachingWorkflowDescriptorStore(WorkflowDescriptorStore delegate, com.atlassian.cache.CacheManager cacheManager)
-
-
Method Details
-
afterInstantiation
Description copied from interface:InitializingComponentCalled after all the beans are constructed and the ApplicationContext is fully populated. Order of execution is order of bean creation, driven by InitializingComponentProcessor.- Specified by:
afterInstantiationin interfaceInitializingComponent- Throws:
Exception
-
onClearCache
-
onWorkflowDescriptorXmlUpdatedEvent
@EventListener public void onWorkflowDescriptorXmlUpdatedEvent(WorkflowDescriptorXmlUpdatedEvent event) -
getWorkflow
public ImmutableWorkflowDescriptor getWorkflow(@Nonnull String name) throws com.opensymphony.workflow.FactoryException Description copied from interface:WorkflowDescriptorStoreRetrieves aWorkflowDescriptorfrom the underlying store. Returns null if no WorkflowDescriptor can be found- Specified by:
getWorkflowin interfaceWorkflowDescriptorStore- Parameters:
name- The workflow name- Returns:
- Null or the matching WorkflowDescriptor
- Throws:
com.opensymphony.workflow.FactoryException- If there's an error constructing the WorkflowDescriptor from its underlying representation
-
removeWorkflow
Description copied from interface:WorkflowDescriptorStoreRemoves a workflow from the underlying store.- Specified by:
removeWorkflowin interfaceWorkflowDescriptorStore- Parameters:
name- The workflow name- Returns:
- true if any records were delete, false otherwise
-
saveWorkflow
public boolean saveWorkflow(@Nonnull String name, @Nonnull com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, boolean replace) throws DataAccessException Description copied from interface:WorkflowDescriptorStoreSaves or updates a workflowDescriptor. If the descriptor already exists, and the replace flag is true, an update will be done. Otherwise, this method will simply create a new value in the database (if none exists yet).- Specified by:
saveWorkflowin interfaceWorkflowDescriptorStore- Parameters:
name- The name of the workflowworkflowDescriptor- TheWorkflowDescriptorto save/update in the underlying storereplace- true if an update should be done, if the workflow already exists, false otherwise- Returns:
- true if the update was carried out successfully, false otherwise
- Throws:
DataAccessException- If there was a problem, storing the workflowdescriptor
-
getWorkflowNames
Description copied from interface:WorkflowDescriptorStoreReturns an array of all the workflowNames stored.- Specified by:
getWorkflowNamesin interfaceWorkflowDescriptorStore- Returns:
- an array of all the workflowNames stored.
-
getAllJiraWorkflowDTOs
Description copied from interface:WorkflowDescriptorStoreReturns a list of all the workflows stored in the underlying store.- Specified by:
getAllJiraWorkflowDTOsin interfaceWorkflowDescriptorStore- Returns:
- A list of
JiraWorkflowDTOs
-