com.atlassian.jira.bc.workflow
Class DefaultWorkflowSchemeService

java.lang.Object
  extended by com.atlassian.jira.bc.workflow.DefaultWorkflowSchemeService
All Implemented Interfaces:
WorkflowSchemeService

public class DefaultWorkflowSchemeService
extends Object
implements WorkflowSchemeService


Constructor Summary
DefaultWorkflowSchemeService(PermissionManager permissionManager, I18nHelper.BeanFactory i18Factory, WorkflowSchemeManager workflowSchemeManager, WorkflowManager workflowManager, IssueTypeManager issueTypeManager)
           
 
Method Summary
 AssignableWorkflowScheme.Builder assignableBuilder()
          Return a builder that can be used to create a AssignableWorkflowScheme.
 ServiceOutcome<DraftWorkflowScheme> createDraft(ApplicationUser creator, DraftWorkflowScheme draftWorkflowScheme)
          Create a draft workflow scheme.
 ServiceOutcome<DraftWorkflowScheme> createDraft(ApplicationUser creator, long parentId)
          Create a draft for the passed workflow scheme.
 ServiceOutcome<AssignableWorkflowScheme> createScheme(ApplicationUser creator, AssignableWorkflowScheme scheme)
          Create a new workflow scheme.
 ServiceOutcome<Void> deleteWorkflowScheme(ApplicationUser user, WorkflowScheme scheme)
          Delete the passed workflow scheme.
 DraftWorkflowScheme.Builder draftBuilder(AssignableWorkflowScheme parent)
          Return a builder that can be used to create a DraftWorkflowScheme for the passed workflow scheme.
 ServiceOutcome<DraftWorkflowScheme> getDraftWorkflowScheme(ApplicationUser user, AssignableWorkflowScheme parentScheme)
          Return draft of the passed workflow scheme if it actually exists.
 ServiceOutcome<DraftWorkflowScheme> getDraftWorkflowSchemeNotNull(ApplicationUser user, AssignableWorkflowScheme parentScheme)
          Return draft of the passed workflow scheme if it actually exists.
 ServiceOutcome<AssignableWorkflowScheme> getSchemeForProject(ApplicationUser user, Project project)
          Return the workflow scheme associated with passed project.
 int getUsageCount(AssignableWorkflowScheme assignableWorkflowScheme)
          Return the number of projects that use the passed scheme.
 ServiceOutcome<AssignableWorkflowScheme> getWorkflowScheme(ApplicationUser user, long id)
          Return the workflow scheme for the passed id.
 boolean isActive(WorkflowScheme workflowScheme)
          Is the passed workflow scheme being used by a project in JIRA.
 boolean isUsingDefaultScheme(Project project)
          Tells the caller if the passed project is using the default workflow scheme.
 ServiceOutcome<AssignableWorkflowScheme> updateWorkflowScheme(ApplicationUser user, AssignableWorkflowScheme scheme)
          Save changes to the passed workflow scheme.
 ServiceOutcome<DraftWorkflowScheme> updateWorkflowScheme(ApplicationUser user, DraftWorkflowScheme scheme)
          Save changes to the passed workflow scheme.
 ServiceOutcome<Void> validateUpdateWorkflowScheme(ApplicationUser user, AssignableWorkflowScheme scheme)
          Validate that the passed scheme can be saved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWorkflowSchemeService

public DefaultWorkflowSchemeService(PermissionManager permissionManager,
                                    I18nHelper.BeanFactory i18Factory,
                                    WorkflowSchemeManager workflowSchemeManager,
                                    WorkflowManager workflowManager,
                                    IssueTypeManager issueTypeManager)
Method Detail

assignableBuilder

public AssignableWorkflowScheme.Builder assignableBuilder()
Description copied from interface: WorkflowSchemeService
Return a builder that can be used to create a AssignableWorkflowScheme. The actual scheme will not be created in JIRA until the WorkflowSchemeService.createScheme(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.workflow.AssignableWorkflowScheme) method is called.

Specified by:
assignableBuilder in interface WorkflowSchemeService
Returns:
a builder that can be used to create a new AssignableWorkflowScheme.

draftBuilder

public DraftWorkflowScheme.Builder draftBuilder(AssignableWorkflowScheme parent)
Description copied from interface: WorkflowSchemeService
Return a builder that can be used to create a DraftWorkflowScheme for the passed workflow scheme. The actual scheme will not be created in JIRA until the WorkflowSchemeService.createDraft(com.atlassian.jira.user.ApplicationUser, DraftWorkflowScheme) method is called.

Specified by:
draftBuilder in interface WorkflowSchemeService
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: WorkflowSchemeService
Create a new workflow scheme.

Specified by:
createScheme in interface WorkflowSchemeService
Parameters:
creator - the user creating the scheme.
scheme - the scheme to create.
Returns:
the result of the operation.

createDraft

public ServiceOutcome<DraftWorkflowScheme> createDraft(ApplicationUser creator,
                                                       long parentId)
Description copied from interface: WorkflowSchemeService
Create a draft for the passed workflow scheme. To create a draft scheme the parent must be:
  1. Active: Used by a project.
  2. Draftless: The parent must not already has a draft workflow scheme.
  3. Not a draft

Specified by:
createDraft in interface WorkflowSchemeService
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: WorkflowSchemeService
Create a draft workflow scheme. The draft can be created using the builder returned from the WorkflowSchemeService.draftBuilder(com.atlassian.jira.workflow.AssignableWorkflowScheme) method. To create a draft scheme the parent must be:
  1. Active: Used by a project.
  2. Draftless: The parent must not already has a draft workflow scheme.
  3. Not a draft

Specified by:
createDraft in interface WorkflowSchemeService
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

public ServiceOutcome<AssignableWorkflowScheme> getWorkflowScheme(ApplicationUser user,
                                                                  long id)
Description copied from interface: WorkflowSchemeService
Return the workflow scheme for the passed id.

Specified by:
getWorkflowScheme in interface WorkflowSchemeService
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: WorkflowSchemeService
Return 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:
getDraftWorkflowScheme in interface WorkflowSchemeService
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: WorkflowSchemeService
Return draft of the passed workflow scheme if it actually exists. An unsuccessful outcome will be returned if the draft does not exist.

Specified by:
getDraftWorkflowSchemeNotNull in interface WorkflowSchemeService
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: WorkflowSchemeService
Delete the passed workflow scheme. A workflow scheme can only be deleted if its a draft or its not active.

Specified by:
deleteWorkflowScheme in interface WorkflowSchemeService
Parameters:
user - the user deleting the scheme.
scheme - the scheme.
Returns:
the result of the operation.

isActive

public boolean isActive(WorkflowScheme workflowScheme)
Description copied from interface: WorkflowSchemeService
Is the passed workflow scheme being used by a project in JIRA.

Specified by:
isActive in interface WorkflowSchemeService
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: WorkflowSchemeService
Return the workflow scheme associated with passed project.

Specified by:
getSchemeForProject in interface WorkflowSchemeService
project - the project.
Returns:
the result of the operation.

updateWorkflowScheme

public ServiceOutcome<AssignableWorkflowScheme> updateWorkflowScheme(ApplicationUser user,
                                                                     @Nonnull
                                                                     AssignableWorkflowScheme scheme)
Description copied from interface: WorkflowSchemeService
Save changes to the passed workflow scheme.

Specified by:
updateWorkflowScheme in interface WorkflowSchemeService
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: WorkflowSchemeService
Validate that the passed scheme can be saved.

Specified by:
validateUpdateWorkflowScheme in interface WorkflowSchemeService
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: WorkflowSchemeService
Save changes to the passed workflow scheme.

Specified by:
updateWorkflowScheme in interface WorkflowSchemeService
Parameters:
user - the user making the changes.
scheme - the scheme to change.
Returns:
the scheme as now stored in the database.

getUsageCount

public int getUsageCount(@Nonnull
                         AssignableWorkflowScheme assignableWorkflowScheme)
Description copied from interface: WorkflowSchemeService
Return the number of projects that use the passed scheme.

Specified by:
getUsageCount in interface WorkflowSchemeService
Parameters:
assignableWorkflowScheme - the scheme to check.
Returns:
the number of projects that use this scheme.

isUsingDefaultScheme

public boolean isUsingDefaultScheme(@Nonnull
                                    Project project)
Description copied from interface: WorkflowSchemeService
Tells the caller if the passed project is using the default workflow scheme.

Specified by:
isUsingDefaultScheme in interface WorkflowSchemeService
Parameters:
project - the project to check.
Returns:
true if the passed project is using the default scheme, false otherwise.


Copyright © 2002-2014 Atlassian. All Rights Reserved.