public class

CachingWorkflowDescriptorStore

extends Object
implements WorkflowDescriptorStore
java.lang.Object
   ↳ com.atlassian.jira.workflow.CachingWorkflowDescriptorStore

Class Overview

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)

Summary

Public Constructors
CachingWorkflowDescriptorStore(WorkflowDescriptorStore delegate, CacheManager cacheManager)
Public Methods
List<JiraWorkflowDTO> getAllJiraWorkflowDTOs()
Returns a list of all the workflows stored in the underlying store.
ImmutableWorkflowDescriptor getWorkflow(String name)
Retrieves a com.opensymphony.workflow.loader.WorkflowDescriptor from the underlying store.
String[] getWorkflowNames()
Returns an array of all the workflowNames stored.
@EventListener void onClearCache(ClearCacheEvent event)
boolean removeWorkflow(String name)
Removes a workflow from the underlying store.
boolean saveWorkflow(String name, WorkflowDescriptor workflowDescriptor, boolean replace)
Saves or updates a workflowDescriptor.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.workflow.WorkflowDescriptorStore

Public Constructors

public CachingWorkflowDescriptorStore (WorkflowDescriptorStore delegate, CacheManager cacheManager)

Public Methods

public List<JiraWorkflowDTO> getAllJiraWorkflowDTOs ()

Returns a list of all the workflows stored in the underlying store.

Returns

public ImmutableWorkflowDescriptor getWorkflow (String name)

Retrieves a com.opensymphony.workflow.loader.WorkflowDescriptor from the underlying store. Returns null if no WorkflowDescriptor can be found

Parameters
name The workflow name
Returns
  • Null or the matching WorkflowDescriptor
Throws
FactoryException

public String[] getWorkflowNames ()

Returns an array of all the workflowNames stored.

Returns
  • an array of all the workflowNames stored.

@EventListener public void onClearCache (ClearCacheEvent event)

public boolean removeWorkflow (String name)

Removes a workflow from the underlying store.

Parameters
name The workflow name
Returns
  • true if any records were delete, false otherwise

public boolean saveWorkflow (String name, WorkflowDescriptor workflowDescriptor, boolean replace)

Saves 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).

Parameters
name The name of the workflow
workflowDescriptor The com.opensymphony.workflow.loader.WorkflowDescriptor to save/update in the underlying store
replace 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