Package com.atlassian.jira.bc.workflow
Class DefaultWorkflowSchemeService
java.lang.Object
com.atlassian.jira.bc.workflow.DefaultWorkflowSchemeService
- All Implemented Interfaces:
WorkflowSchemeService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWorkflowSchemeService(PermissionManager permissionManager, I18nHelper.BeanFactory i18Factory, WorkflowSchemeManager workflowSchemeManager, WorkflowManager workflowManager, IssueTypeManager issueTypeManager) -
Method Summary
Modifier and TypeMethodDescriptionReturn a builder that can be used to create aAssignableWorkflowScheme.createDraft(ApplicationUser creator, long parentId) Create a draft for the passed workflow scheme.createDraft(ApplicationUser creator, DraftWorkflowScheme draftWorkflowScheme) Create a draft workflow scheme.createScheme(ApplicationUser creator, AssignableWorkflowScheme scheme) Create a new workflow scheme.deleteWorkflowScheme(ApplicationUser user, WorkflowScheme scheme) Delete the passed workflow scheme.draftBuilder(AssignableWorkflowScheme parent) Return a builder that can be used to create aDraftWorkflowSchemefor the passed workflow scheme.getDraftWorkflowScheme(ApplicationUser user, AssignableWorkflowScheme parentScheme) Return draft of the passed workflow scheme if it actually exists.getDraftWorkflowSchemeNotNull(ApplicationUser user, AssignableWorkflowScheme parentScheme) Return draft of the passed workflow scheme if it actually exists.getSchemeForProject(ApplicationUser user, Project project) Return the workflow scheme associated with passed project.intgetUsageCount(AssignableWorkflowScheme assignableWorkflowScheme) Return the number of projects that use the passed scheme.getWorkflowScheme(ApplicationUser user, long id) Return the workflow scheme for the passed id.booleanisActive(WorkflowScheme workflowScheme) Is the passed workflow scheme being used by a project in JIRA.booleanisUsingDefaultScheme(Project project) Tells the caller if the passed project is using the default workflow scheme.updateWorkflowScheme(ApplicationUser user, AssignableWorkflowScheme scheme) Save changes to the passed workflow scheme.updateWorkflowScheme(ApplicationUser user, DraftWorkflowScheme scheme) Save changes to the passed workflow scheme.Validate that the passed scheme can be saved.
-
Constructor Details
-
DefaultWorkflowSchemeService
public DefaultWorkflowSchemeService(PermissionManager permissionManager, I18nHelper.BeanFactory i18Factory, WorkflowSchemeManager workflowSchemeManager, WorkflowManager workflowManager, IssueTypeManager issueTypeManager)
-
-
Method Details
-
assignableBuilder
Description copied from interface:WorkflowSchemeServiceReturn a builder that can be used to create aAssignableWorkflowScheme. The actual scheme will not be created in JIRA until theWorkflowSchemeService.createScheme(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.workflow.AssignableWorkflowScheme)method is called.- Specified by:
assignableBuilderin interfaceWorkflowSchemeService- Returns:
- a builder that can be used to create a new
AssignableWorkflowScheme.
-
draftBuilder
Description copied from interface:WorkflowSchemeServiceReturn a builder that can be used to create aDraftWorkflowSchemefor the passed workflow scheme. The actual scheme will not be created in JIRA until theWorkflowSchemeService.createDraft(com.atlassian.jira.user.ApplicationUser, DraftWorkflowScheme)method is called.- Specified by:
draftBuilderin interfaceWorkflowSchemeService- Returns:
- a builder that can be used to create a new
DraftWorkflowScheme.
-
createScheme
@Nonnull public ServiceOutcome<AssignableWorkflowScheme> createScheme(ApplicationUser creator, @Nonnull AssignableWorkflowScheme scheme) Description copied from interface:WorkflowSchemeServiceCreate a new workflow scheme.- Specified by:
createSchemein interfaceWorkflowSchemeService- Parameters:
creator- the user creating the scheme.scheme- the scheme to create.- Returns:
- the result of the operation.
-
createDraft
Description copied from interface:WorkflowSchemeServiceCreate a draft for the passed workflow scheme.To create a draft scheme the parent must be:
- Active: Used by a project.
- Draftless: The parent must not already has a draft workflow scheme.
- Not a draft
- Specified by:
createDraftin interfaceWorkflowSchemeService- Parameters:
creator- the user creating the draft.parentId- the workflow scheme to create a draft for.- Returns:
- result containing the new draft scheme or any errors that occur.
-
createDraft
public ServiceOutcome<DraftWorkflowScheme> createDraft(ApplicationUser creator, DraftWorkflowScheme draftWorkflowScheme) Description copied from interface:WorkflowSchemeServiceCreate a draft workflow scheme. The draft can be created using the builder returned from theWorkflowSchemeService.draftBuilder(com.atlassian.jira.workflow.AssignableWorkflowScheme)method.To create a draft scheme the parent must be:
- Active: Used by a project.
- Draftless: The parent must not already has a draft workflow scheme.
- Not a draft
- Specified by:
createDraftin interfaceWorkflowSchemeService- Parameters:
creator- the user creating the draft.draftWorkflowScheme- the draft to create.- Returns:
- result containing the new draft scheme or any errors that occur.
-
getWorkflowScheme
Description copied from interface:WorkflowSchemeServiceReturn the workflow scheme for the passed id.- Specified by:
getWorkflowSchemein interfaceWorkflowSchemeService- Parameters:
user- the user searching for the scheme.id- the id of the workflow scheme to find.- Returns:
- the result of the lookup.
-
getDraftWorkflowScheme
public ServiceOutcome<DraftWorkflowScheme> getDraftWorkflowScheme(ApplicationUser user, @Nonnull AssignableWorkflowScheme parentScheme) Description copied from interface:WorkflowSchemeServiceReturn draft of the passed workflow scheme if it actually exists. A succesful outcome with null result will be returned if the draft does not exist.- Specified by:
getDraftWorkflowSchemein interfaceWorkflowSchemeService- Parameters:
user- the user making the request.parentScheme- the workflow scheme whose draft we are searching for.- Returns:
- the result. A succesful outcome with null result will be returned if the draft does not exist.
-
getDraftWorkflowSchemeNotNull
public ServiceOutcome<DraftWorkflowScheme> getDraftWorkflowSchemeNotNull(ApplicationUser user, @Nonnull AssignableWorkflowScheme parentScheme) Description copied from interface:WorkflowSchemeServiceReturn draft of the passed workflow scheme if it actually exists. An unsuccessful outcome will be returned if the draft does not exist.- Specified by:
getDraftWorkflowSchemeNotNullin interfaceWorkflowSchemeService- Parameters:
user- the user making the request.parentScheme- the workflow scheme whose draft we are searching for.- Returns:
- the result. An unsuccessful outcome will be returned if the draft does not exist.
-
deleteWorkflowScheme
public ServiceOutcome<Void> deleteWorkflowScheme(ApplicationUser user, @Nonnull WorkflowScheme scheme) Description copied from interface:WorkflowSchemeServiceDelete the passed workflow scheme. A workflow scheme can only be deleted if its a draft or its not active.- Specified by:
deleteWorkflowSchemein interfaceWorkflowSchemeService- Parameters:
user- the user deleting the scheme.scheme- the scheme.- Returns:
- the result of the operation.
-
isActive
Description copied from interface:WorkflowSchemeServiceIs the passed workflow scheme being used by a project in JIRA.- Specified by:
isActivein interfaceWorkflowSchemeService- Parameters:
workflowScheme- the workflow scheme to test.- Returns:
- true if the workflow scheme is being used false otherwise.
-
getSchemeForProject
public ServiceOutcome<AssignableWorkflowScheme> getSchemeForProject(ApplicationUser user, @Nonnull Project project) Description copied from interface:WorkflowSchemeServiceReturn the workflow scheme associated with passed project.- Specified by:
getSchemeForProjectin interfaceWorkflowSchemeServiceproject- the project.- Returns:
- the result of the operation.
-
updateWorkflowScheme
public ServiceOutcome<AssignableWorkflowScheme> updateWorkflowScheme(ApplicationUser user, @Nonnull AssignableWorkflowScheme scheme) Description copied from interface:WorkflowSchemeServiceSave changes to the passed workflow scheme.- Specified by:
updateWorkflowSchemein interfaceWorkflowSchemeService- Parameters:
user- the user making the changes.scheme- the scheme to change.- Returns:
- the scheme as now stored in the database.
-
validateUpdateWorkflowScheme
public ServiceOutcome<Void> validateUpdateWorkflowScheme(ApplicationUser user, @Nonnull AssignableWorkflowScheme scheme) Description copied from interface:WorkflowSchemeServiceValidate that the passed scheme can be saved.- Specified by:
validateUpdateWorkflowSchemein interfaceWorkflowSchemeService- Parameters:
user- the user making the changes.scheme- the scheme to change.- Returns:
- the scheme as now stored in the database.
-
updateWorkflowScheme
public ServiceOutcome<DraftWorkflowScheme> updateWorkflowScheme(ApplicationUser user, @Nonnull DraftWorkflowScheme scheme) Description copied from interface:WorkflowSchemeServiceSave changes to the passed workflow scheme.- Specified by:
updateWorkflowSchemein interfaceWorkflowSchemeService- Parameters:
user- the user making the changes.scheme- the scheme to change.- Returns:
- the scheme as now stored in the database.
-
getUsageCount
Description copied from interface:WorkflowSchemeServiceReturn the number of projects that use the passed scheme.- Specified by:
getUsageCountin interfaceWorkflowSchemeService- Parameters:
assignableWorkflowScheme- the scheme to check.- Returns:
- the number of projects that use this scheme.
-
isUsingDefaultScheme
Description copied from interface:WorkflowSchemeServiceTells the caller if the passed project is using the default workflow scheme.- Specified by:
isUsingDefaultSchemein interfaceWorkflowSchemeService- Parameters:
project- the project to check.- Returns:
- true if the passed project is using the default scheme, false otherwise.
-