com.atlassian.jira.workflow
Interface WorkflowSchemeManager

All Superinterfaces:
SchemeManager
All Known Implementing Classes:
DefaultWorkflowSchemeManager

public interface WorkflowSchemeManager
extends SchemeManager


Field Summary
 
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
 
Method Summary
 void addWorkflowToScheme(org.ofbiz.core.entity.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, com.atlassian.crowd.embedded.api.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, com.atlassian.crowd.embedded.api.User user, String newDescription)
           
 DraftWorkflowScheme createDraft(ApplicationUser creator, DraftWorkflowScheme workflowScheme)
          Create the passed draft workflow scheme.
 DraftWorkflowScheme createDraftOf(ApplicationUser creator, AssignableWorkflowScheme workflowScheme)
          Create a draft for the passed workflow scheme.
 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()
           
 Iterable<AssignableWorkflowScheme> getAssignableSchemes()
          Return all the assignable workflow schemes.
 String getAssociationType()
           
 org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.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<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme)
           
 AssignableWorkflowScheme getParentForDraft(long draftSchemeId)
          Return the original workflow scheme for the passed draft workflow scheme.
 List<Project> getProjectsUsing(AssignableWorkflowScheme workflowScheme)
          Return the list of projects that use the passed workflow scheme.
 String getSchemeDesc()
           
 String getSchemeEntityName()
           
 Collection<org.ofbiz.core.entity.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<String,String> getWorkflowMap(Project project)
          Returns a map representation of a workflow scheme for a passed project.
 String getWorkflowName(org.ofbiz.core.entity.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.
 org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project)
           
 AssignableWorkflowScheme getWorkflowSchemeObj(long id)
          Return the workflow scheme with the passed id.
 AssignableWorkflowScheme getWorkflowSchemeObj(Project project)
          Return the workflow scheme associated with the passed project.
 AssignableWorkflowScheme getWorkflowSchemeObj(String name)
          Return the workflow scheme with the passed name.
 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.
 
Methods inherited from interface com.atlassian.jira.scheme.SchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, createSchemeEntity, createSchemeObject, deleteEntity, deleteScheme, getAssociatedSchemes, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntities, getEntities, getEntities, getEntities, getEntities, getEntity, getGroups, getGroups, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, hasSchemeAuthority, hasSchemeAuthority, removeEntities, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
 

Method Detail

getSchemeEntityName

String getSchemeEntityName()

getEntityName

String getEntityName()

getAssociationType

String getAssociationType()

getSchemeDesc

String getSchemeDesc()

getWorkflowScheme

org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getDefaultEntity

org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme)
                                                    throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getDefaultWorkflowScheme

AssignableWorkflowScheme getDefaultWorkflowScheme()

getNonDefaultEntities

List<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getActiveWorkflowNames

Collection<String> getActiveWorkflowNames()
                                          throws org.ofbiz.core.entity.GenericEntityException,
                                                 WorkflowException
Returns:
A collection of all workflow names currently active (ie assigned to schemes & associated with projects).
Throws:
org.ofbiz.core.entity.GenericEntityException
WorkflowException

addWorkflowToScheme

void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme,
                         String workflowName,
                         String issueTypeId)
                         throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

updateSchemesForRenamedWorkflow

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

getSchemesForWorkflow

Collection<org.ofbiz.core.entity.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.

getSchemesForWorkflowIncludingDrafts

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.

clearWorkflowCache

void clearWorkflowCache()

getWorkflowMap

Map<String,String> 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.

getWorkflowName

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.

getWorkflowName

String getWorkflowName(org.ofbiz.core.entity.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.

isUsingDefaultScheme

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.

hasDraft

boolean hasDraft(@Nonnull
                 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.

assignableBuilder

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.

draftBuilder

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.

createScheme

@Nonnull
AssignableWorkflowScheme createScheme(@Nonnull
                                              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.

createDraftOf

@Nonnull
DraftWorkflowScheme createDraftOf(ApplicationUser creator,
                                          @Nonnull
                                          AssignableWorkflowScheme workflowScheme)
Create a draft for the passed workflow scheme. It is illegal to pass:

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.

createDraft

@Nonnull
DraftWorkflowScheme createDraft(ApplicationUser creator,
                                        @Nonnull
                                        DraftWorkflowScheme workflowScheme)
Create the passed draft workflow scheme. A draft can be created using the draftBuilder(AssignableWorkflowScheme) method.

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.

getAssignableSchemes

@Nonnull
Iterable<AssignableWorkflowScheme> getAssignableSchemes()
Return all the assignable workflow schemes.

Returns:
a list of all the assignable workflow schemes.

getWorkflowSchemeObj

@Nullable
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.

getWorkflowSchemeObj

@Nullable
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.

getWorkflowSchemeObj

@Nonnull
AssignableWorkflowScheme getWorkflowSchemeObj(@Nonnull
                                                      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.

getDraftForParent

DraftWorkflowScheme getDraftForParent(@Nonnull
                                      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.

getDraft

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.

getParentForDraft

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.

isActive

boolean isActive(@Nonnull
                 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.

deleteWorkflowScheme

boolean deleteWorkflowScheme(@Nonnull
                             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.

updateDraftWorkflowScheme

DraftWorkflowScheme updateDraftWorkflowScheme(ApplicationUser user,
                                              @Nonnull
                                              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.

updateWorkflowScheme

AssignableWorkflowScheme updateWorkflowScheme(@Nonnull
                                              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.

getProjectsUsing

@Nonnull
List<Project> getProjectsUsing(@Nonnull
                                       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.

cleanUpSchemeDraft

AssignableWorkflowScheme cleanUpSchemeDraft(Project project,
                                            com.atlassian.crowd.embedded.api.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.

copyDraft

AssignableWorkflowScheme copyDraft(DraftWorkflowScheme draft,
                                   com.atlassian.crowd.embedded.api.User user,
                                   String newDescription)

replaceSchemeWithDraft

void replaceSchemeWithDraft(DraftWorkflowScheme draft)

waitForUpdatesToFinishAndExecute

<T> T waitForUpdatesToFinishAndExecute(AssignableWorkflowScheme scheme,
                                       Callable<T> task)
                                   throws Exception
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.

Type Parameters:
T - return type of the task.
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.


Copyright © 2002-2014 Atlassian. All Rights Reserved.