public interface

WorkflowSchemeManager

implements SchemeManager
com.atlassian.jira.workflow.WorkflowSchemeManager
Known Indirect Subclasses

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.scheme.SchemeManager
Public Methods
void addWorkflowToScheme(GenericValue scheme, String workflowName, String issueTypeId)
AssignableWorkflowScheme.Builder assignableBuilder()
Return a builder that can be used to create a new AssignableWorkflowScheme.
AssignableWorkflowScheme cleanUpSchemeDraft(Project project, User user)
If the project's workflow scheme is only used by one project and if this scheme has a draft, then the draft is copied to a separate scheme and deleted.
void clearWorkflowCache()
AssignableWorkflowScheme copyDraft(DraftWorkflowScheme draft, User user, String newDescription)
@Nonnull DraftWorkflowScheme createDraft(ApplicationUser creator, DraftWorkflowScheme workflowScheme)
Create the passed draft workflow scheme.
@Nonnull DraftWorkflowScheme createDraftOf(ApplicationUser creator, AssignableWorkflowScheme workflowScheme)
Create a draft for the passed workflow scheme.
@Nonnull AssignableWorkflowScheme createScheme(AssignableWorkflowScheme workflowScheme)
Create a new workflow scheme.
boolean deleteWorkflowScheme(WorkflowScheme scheme)
Delete the passed workflow scheme.
DraftWorkflowScheme.Builder draftBuilder(AssignableWorkflowScheme parent)
Return a builder that can be used to create a new DraftWorkflowScheme for the passed workflow scheme.
Collection<String> getActiveWorkflowNames()
@Nonnull Iterable<AssignableWorkflowScheme> getAssignableSchemes()
Return all the assignable workflow schemes.
String getAssociationType()
GenericValue getDefaultEntity(GenericValue scheme)
AssignableWorkflowScheme getDefaultWorkflowScheme()
DraftWorkflowScheme getDraft(long id)
Return the draft workflow scheme with the given id.
DraftWorkflowScheme getDraftForParent(AssignableWorkflowScheme workflowScheme)
Return the draft workflow scheme for the passed workflow scheme.
String getEntityName()
List<GenericValue> getNonDefaultEntities(GenericValue scheme)
AssignableWorkflowScheme getParentForDraft(long draftSchemeId)
Return the original workflow scheme for the passed draft workflow scheme.
@Nonnull List<Project> getProjectsUsing(AssignableWorkflowScheme workflowScheme)
Return the list of projects that use the passed workflow scheme.
String getSchemeDesc()
String getSchemeEntityName()
Collection<GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.
Iterable<WorkflowScheme> getSchemesForWorkflowIncludingDrafts(JiraWorkflow workflow)
Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.
Map<StringString> getWorkflowMap(Project project)
Returns a map representation of a workflow scheme for a passed project.
String getWorkflowName(GenericValue scheme, String issueType)
Get the name of the workflow from the passed scheme associated with the passed issue type.
String getWorkflowName(Project project, String issueType)
Get the name of the workflow associated with the passed project and issue type.
GenericValue getWorkflowScheme(GenericValue project)
@Nullable AssignableWorkflowScheme getWorkflowSchemeObj(long id)
Return the workflow scheme with the passed id.
@Nullable AssignableWorkflowScheme getWorkflowSchemeObj(String name)
Return the workflow scheme with the passed name.
@Nonnull AssignableWorkflowScheme getWorkflowSchemeObj(Project project)
Return the workflow scheme associated with the passed project.
boolean hasDraft(AssignableWorkflowScheme workflowScheme)
Tells the caller if the passed workflow scheme has a draft.
boolean isActive(WorkflowScheme workflowScheme)
Return true if the passed workflow scheme is being used by a project.
boolean isUsingDefaultScheme(Project project)
Tells the caller if the passed project is using the default workflow scheme.
void replaceSchemeWithDraft(DraftWorkflowScheme draft)
DraftWorkflowScheme updateDraftWorkflowScheme(ApplicationUser user, DraftWorkflowScheme scheme)
Save changes to the passed draft workflow scheme.
void updateSchemesForRenamedWorkflow(String oldWorkflowName, String newWorkflowName)
Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.
AssignableWorkflowScheme updateWorkflowScheme(AssignableWorkflowScheme scheme)
Save changes to the passed workflow scheme.
<T> T waitForUpdatesToFinishAndExecute(AssignableWorkflowScheme scheme, Callable<T> task)
If the passed workflow scheme is currently being edited, then this method blocks until the editing is finished.
[Expand]
Inherited Methods
From interface com.atlassian.jira.scheme.SchemeManager

Public Methods

public void addWorkflowToScheme (GenericValue scheme, String workflowName, String issueTypeId)

Throws
GenericEntityException

public AssignableWorkflowScheme.Builder assignableBuilder ()

Return a builder that can be used to create a new AssignableWorkflowScheme.

Returns
  • the builder that can be used to create the new workflow scheme.

public AssignableWorkflowScheme cleanUpSchemeDraft (Project project, User user)

If the project's workflow scheme is only used by one project and if this scheme has a draft, then the draft is copied to a separate scheme and deleted.

Parameters
project project who's workflow scheme draft is to be copied to a separate scheme.
user the user making the changes.
Returns
  • copied scheme or null if it was not created.

public void clearWorkflowCache ()

public AssignableWorkflowScheme copyDraft (DraftWorkflowScheme draft, User user, String newDescription)

@Nonnull public DraftWorkflowScheme createDraft (ApplicationUser creator, DraftWorkflowScheme workflowScheme)

Create the passed draft workflow scheme. A draft can be created using the draftBuilder(AssignableWorkflowScheme) method.

  • A scheme that already has a draft.
  • A scheme that is not currently in the database.
  • The default workflow scheme
  • A draft workflow scheme.

Parameters
creator the user that is going to create the draft. This user is recorded as the person who last modified the new draftscheme.
workflowScheme the workflow scheme to create.
Returns
  • the new draft scheme.

@Nonnull public DraftWorkflowScheme createDraftOf (ApplicationUser creator, AssignableWorkflowScheme workflowScheme)

Create a draft for the passed workflow scheme. It is illegal to pass:

  • A scheme that already has a draft.
  • A scheme that is not currently in the database.
  • The default workflow scheme
  • A draft workflow scheme.

Parameters
creator the user that is going to create the draft. This user is recorded as the person who last modified the new draftscheme.
workflowScheme the workflow scheme to create a draft of. It cannot be a draft, the default scheme, a scheme that already has a draft or a scheme that is not already in the database (i.e. does not have an ID).
Returns
  • the new draft scheme.

@Nonnull public AssignableWorkflowScheme createScheme (AssignableWorkflowScheme workflowScheme)

Create a new workflow scheme.

Parameters
workflowScheme the workflow scheme to create a draft of. It cannot be a draft, the default scheme, a scheme that already has a draft or a scheme that is not already in the database (i.e. does not have an ID).
Returns
  • the new draft scheme.

public boolean deleteWorkflowScheme (WorkflowScheme scheme)

Delete the passed workflow scheme. It is illegal to delete an active scheme, the default scheme or a scheme that is not already in the database.

Parameters
scheme the scheme to delete. Cannot be the default scheme, active scheme or a scheme that is not already in the database.
Returns
  • true if the scheme was deleted; false otherwise.

public DraftWorkflowScheme.Builder draftBuilder (AssignableWorkflowScheme parent)

Return a builder that can be used to create a new DraftWorkflowScheme for the passed workflow scheme.

Returns
  • the builder that can be used to create the new workflow scheme.

public Collection<String> getActiveWorkflowNames ()

Returns
  • A collection of all workflow names currently active (ie assigned to schemes & associated with projects).
Throws
GenericEntityException
WorkflowException

@Nonnull public Iterable<AssignableWorkflowScheme> getAssignableSchemes ()

Return all the assignable workflow schemes.

Returns
  • a list of all the assignable workflow schemes.

public String getAssociationType ()

public GenericValue getDefaultEntity (GenericValue scheme)

Throws
GenericEntityException

public AssignableWorkflowScheme getDefaultWorkflowScheme ()

public DraftWorkflowScheme getDraft (long id)

Return the draft workflow scheme with the given id.

Parameters
id the id of the draft workflow scheme to be returned
Returns
  • the draft with the given id or null if it does not exist.

public DraftWorkflowScheme getDraftForParent (AssignableWorkflowScheme workflowScheme)

Return the draft workflow scheme for the passed workflow scheme.

Parameters
workflowScheme the workflow scheme whose draft is being sought.
Returns
  • the draft of the passed workflow scheme or null if it does not exist.

public String getEntityName ()

public List<GenericValue> getNonDefaultEntities (GenericValue scheme)

Throws
GenericEntityException

public AssignableWorkflowScheme getParentForDraft (long draftSchemeId)

Return the original workflow scheme for the passed draft workflow scheme.

Parameters
draftSchemeId the id of the draft workflow scheme whose parent is being sought.
Returns
  • the parent of the passed draft workflow scheme.

@Nonnull public List<Project> getProjectsUsing (AssignableWorkflowScheme workflowScheme)

Return the list of projects that use the passed workflow scheme.

Parameters
workflowScheme the workflow scheme to check.
Returns
  • the list of projects that use the passed workflow scheme.

public String getSchemeDesc ()

public String getSchemeEntityName ()

public Collection<GenericValue> getSchemesForWorkflow (JiraWorkflow workflow)

Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.

Parameters
workflow the workflow whose schemes must be returned
Returns
  • workflow schemes that the passed workflow is assigned to, not including draft schemes.

public Iterable<WorkflowScheme> getSchemesForWorkflowIncludingDrafts (JiraWorkflow workflow)

Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.

Parameters
workflow the workflow whose schemes must be returned
Returns
  • workflow schemes that the passed workflow is assigned to, including draft schemes.

public Map<StringString> getWorkflowMap (Project project)

Returns a map representation of a workflow scheme for a passed project. The returned map stores {issuetype -> workflowName}. A null issuetype points out the default workflow for the scheme.

Parameters
project the project whose scheme should be returned.
Returns
  • the map representation of a workflow scheme. Each key represents an issuetype which its associated value the name of the workflow assigned to that issue type. A null issuetype points out the default workflow for that scheme.

public String getWorkflowName (GenericValue scheme, String issueType)

Get the name of the workflow from the passed scheme associated with the passed issue type.

Parameters
scheme the scheme to search.
issueType the issue type used in the search.
Returns
  • the name of the workflow associated with the scheme and issue type.

public String getWorkflowName (Project project, String issueType)

Get the name of the workflow associated with the passed project and issue type.

Parameters
project the project used in the search.
issueType the issue type used in the search.
Returns
  • the name of the workflow associated with the passed project and issue type.

public GenericValue getWorkflowScheme (GenericValue project)

Throws
GenericEntityException

@Nullable public AssignableWorkflowScheme getWorkflowSchemeObj (long id)

Return the workflow scheme with the passed id.

Parameters
id the id to search.
Returns
  • the workflow scheme with the given id or null if no such scheme exists.

@Nullable public AssignableWorkflowScheme getWorkflowSchemeObj (String name)

Return the workflow scheme with the passed name.

Parameters
name the name to search.
Returns
  • the workflow scheme with the given name or null if no such scheme exists.

@Nonnull public AssignableWorkflowScheme getWorkflowSchemeObj (Project project)

Return the workflow scheme associated with the passed project.

Parameters
project the project whose scheme is to be returned.
Returns
  • the scheme the passed project is using. Never null.

public boolean hasDraft (AssignableWorkflowScheme workflowScheme)

Tells the caller if the passed workflow scheme has a draft.

Parameters
workflowScheme the workflow scheme to check. It is illegal to pass a draft workflow scheme to this method.
Returns
  • true if the passed workflow has a draft false otherwise.

public boolean isActive (WorkflowScheme workflowScheme)

Return true if the passed workflow scheme is being used by a project.

Parameters
workflowScheme the workflow scheme to test.
Returns
  • true if the passed workflow scheme us being used by a project; false otherwise.

public boolean isUsingDefaultScheme (Project project)

Tells the caller if the passed project is using the default workflow scheme.

Parameters
project the project to check.
Returns
  • true if the passed project is using the default scheme, false otherwise.

public void replaceSchemeWithDraft (DraftWorkflowScheme draft)

public DraftWorkflowScheme updateDraftWorkflowScheme (ApplicationUser user, DraftWorkflowScheme scheme)

Save changes to the passed draft workflow scheme.

Parameters
user the user making the changes.
scheme the draft scheme to change.
Returns
  • the draft scheme as now stored in the database.

public void updateSchemesForRenamedWorkflow (String oldWorkflowName, String newWorkflowName)

Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.

Note: There is no validation performed by this method to determine if the provided oldWorkflowName or newWorkflowName are valid workflow names or if the workflow is active/inactive. These validations must be done by the caller.

Parameters
oldWorkflowName name of the workflow to re-assign all its associated schemes from
newWorkflowName name of the workflow to assign all the schemes associated to targetWorkflow

public AssignableWorkflowScheme updateWorkflowScheme (AssignableWorkflowScheme scheme)

Save changes to the passed workflow scheme.

Parameters
scheme the scheme to change.
Returns
  • the scheme that is now stored in the database.

public T waitForUpdatesToFinishAndExecute (AssignableWorkflowScheme scheme, Callable<T> task)

If the passed workflow scheme is currently being edited, then this method blocks until the editing is finished. Executes the passed Callable task in the end and returns its result. Workflow scheme editing will be blocked until the task execution finishes.

Parameters
scheme the workflow scheme.
task task to execute.
Returns
  • the value returned by the passed task.
Throws
Exception any exception occurred during task execution.