Class WorkflowServiceImpl

java.lang.Object
com.atlassian.greenhopper.service.workflow.WorkflowServiceImpl
All Implemented Interfaces:
WorkflowService

public class WorkflowServiceImpl extends Object implements WorkflowService
Provides workflow related service methods
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.atlassian.greenhopper.service.workflow.WorkflowService

    WorkflowService.WorkTransitions
  • Field Summary

    Fields inherited from interface com.atlassian.greenhopper.service.workflow.WorkflowService

    DEFAULT_MAX_NUMBER_OF_PROJECTS, MAX_NUMBER_OF_PROJECTS, SERVICE
  • Constructor Summary

    Constructors
    Constructor
    Description
    WorkflowServiceImpl(com.atlassian.jira.config.ConstantsManager constantsManager, com.atlassian.jira.bc.issue.search.SearchService jiraSearchService, com.atlassian.jira.project.ProjectManager projectManager, com.atlassian.jira.workflow.WorkflowSchemeManager workflowSchemeManager, com.atlassian.jira.workflow.WorkflowManager workflowManager, com.atlassian.jira.bc.workflow.WorkflowService jiraWorkflowService, com.atlassian.jira.transition.TransitionManager transitionManager, com.atlassian.jira.security.PermissionManager permissionManager, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.jira.config.properties.ApplicationProperties applicationProperties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    associateSchemeToProject(com.atlassian.jira.project.Project project, com.atlassian.jira.scheme.Scheme scheme)
    Associates scheme to project
    associateWorkflowToSchemeAsDefault(String workflowName, com.atlassian.jira.scheme.Scheme scheme)
    Associates a workflow to the given scheme, makes it the default workflow for that scheme
    ServiceOutcome<com.atlassian.jira.workflow.JiraWorkflow>
    copyWorkflow(com.atlassian.jira.user.ApplicationUser user, com.atlassian.jira.workflow.JiraWorkflow workflow, String newName, String newDescription)
    Creates a new copy of the existing workflow, with the specified name and description.
    Delete a workflow scheme with the specified name
    Delete a workflow with the specified name.
    Does a workflow scheme with the specified name exist?
    Set<com.atlassian.jira.issue.status.Status>
    getAccessibleStatuses(com.atlassian.jira.user.ApplicationUser user, com.atlassian.query.Query query)
    Get the list of accessible statuses for issues potentially returned by the current query.
    Set<com.atlassian.jira.issue.status.Status>
    Get all available status objects of all active workflows.
    Set<com.atlassian.jira.issue.status.Status>
    Get all available status objects.
    Collection<com.atlassian.jira.workflow.JiraWorkflow>
    getJiraWorkflows(com.atlassian.jira.project.Project projectObj)
    Given a project, returns all JIRA workflows which are associated to that project Empty on error
    Collection<com.atlassian.jira.workflow.JiraWorkflow>
    getJiraWorkflows(com.atlassian.jira.project.Project projectObj, String issueTypeId)
    Given a project and an issue type id, returns the JIRA Workflow which is associated to that project for that issue type Empty on error
    Set<com.atlassian.jira.workflow.JiraWorkflow>
    getJiraWorkflows(Set<com.atlassian.jira.issue.Issue> issues)
    Given a set of issues, returns the JIRA Workflows which are associated to those issues
    com.atlassian.jira.issue.status.Status
    getStatusByName(String statusName)
    Get a status given its name
    getTransitions(com.atlassian.jira.user.ApplicationUser user, List<Long> projectIds)
    Get the transitions data for the given projects This will have the workflows for each project and issue type pair.
    ServiceOutcome<com.atlassian.jira.workflow.JiraWorkflow>
    getWorkflow(com.atlassian.jira.user.ApplicationUser user, String workflowName)
    Retrieve the workflow with the specified name
    Optional<com.atlassian.jira.scheme.Scheme>
    getWorkflowSchemeForProject(com.atlassian.jira.project.Project project)
    Returns the scheme currently associated to the specified Project.
    ServiceOutcome<Collection<com.atlassian.jira.workflow.JiraWorkflow>>
    getWorkflowsForProject(com.atlassian.jira.project.Project project)
    Retrieve the workflows that are in use for the specified Project.
    com.atlassian.jira.issue.status.Status
    Get the status object for a given id
    isStatusInitialStatus(com.atlassian.jira.workflow.JiraWorkflow workflow, com.atlassian.jira.issue.status.Status status)
    Is this status the initial status for this workflow?
    Is the workflow scheme with the specified name active?

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WorkflowServiceImpl

      public WorkflowServiceImpl(com.atlassian.jira.config.ConstantsManager constantsManager, com.atlassian.jira.bc.issue.search.SearchService jiraSearchService, com.atlassian.jira.project.ProjectManager projectManager, com.atlassian.jira.workflow.WorkflowSchemeManager workflowSchemeManager, com.atlassian.jira.workflow.WorkflowManager workflowManager, com.atlassian.jira.bc.workflow.WorkflowService jiraWorkflowService, com.atlassian.jira.transition.TransitionManager transitionManager, com.atlassian.jira.security.PermissionManager permissionManager, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.jira.config.properties.ApplicationProperties applicationProperties)
  • Method Details

    • getWorkflowStatusObject

      public com.atlassian.jira.issue.status.Status getWorkflowStatusObject(String statusId)
      Description copied from interface: WorkflowService
      Get the status object for a given id
      Specified by:
      getWorkflowStatusObject in interface WorkflowService
      Parameters:
      statusId - the id to look up
      Returns:
      a status object or null if the id is invalid
    • getStatusByName

      public com.atlassian.jira.issue.status.Status getStatusByName(String statusName)
      Description copied from interface: WorkflowService
      Get a status given its name
      Specified by:
      getStatusByName in interface WorkflowService
    • getAllWorkflowStatusObjects

      public Set<com.atlassian.jira.issue.status.Status> getAllWorkflowStatusObjects()
      Get all available status objects. Statuses are global in JIRA, the actual workflows define to what steps each status is attached to.
      Specified by:
      getAllWorkflowStatusObjects in interface WorkflowService
    • getAllActiveWorkflowStatusObjects

      public Set<com.atlassian.jira.issue.status.Status> getAllActiveWorkflowStatusObjects()
      Get all available status objects of all active workflows. Statuses are global in JIRA, the actual workflows define to what steps each status is attached to.
      Specified by:
      getAllActiveWorkflowStatusObjects in interface WorkflowService
    • getAccessibleStatuses

      @Nonnull public Set<com.atlassian.jira.issue.status.Status> getAccessibleStatuses(com.atlassian.jira.user.ApplicationUser user, com.atlassian.query.Query query)
      Description copied from interface: WorkflowService
      Get the list of accessible statuses for issues potentially returned by the current query. In effect we are asking, "What projects and issue types could be returned by this query for this user, and what statuses are linked to workflows assigned to those projects and issue types?".
      Specified by:
      getAccessibleStatuses in interface WorkflowService
      Parameters:
      user - the user who would be performing the search
      query - the query being asked about
      Returns:
      the list of statuses
    • isStatusInitialStatus

      @Nonnull public ServiceOutcome<Boolean> isStatusInitialStatus(@Nonnull com.atlassian.jira.workflow.JiraWorkflow workflow, @Nonnull com.atlassian.jira.issue.status.Status status)
      Description copied from interface: WorkflowService
      Is this status the initial status for this workflow?
      Specified by:
      isStatusInitialStatus in interface WorkflowService
      Parameters:
      workflow - the workflow
      status - the status
      Returns:
      the result
    • getWorkflowSchemeForProject

      @Nonnull public Optional<com.atlassian.jira.scheme.Scheme> getWorkflowSchemeForProject(com.atlassian.jira.project.Project project)
      Description copied from interface: WorkflowService
      Returns the scheme currently associated to the specified Project. null will be the result if there is no scheme associated (i.e. the Default Scheme is in use).
      Specified by:
      getWorkflowSchemeForProject in interface WorkflowService
      Parameters:
      project - the project
      Returns:
      the result
    • getWorkflowsForProject

      @Nonnull public ServiceOutcome<Collection<com.atlassian.jira.workflow.JiraWorkflow>> getWorkflowsForProject(com.atlassian.jira.project.Project project)
      Description copied from interface: WorkflowService
      Retrieve the workflows that are in use for the specified Project.
      Specified by:
      getWorkflowsForProject in interface WorkflowService
      Parameters:
      project - the project
      Returns:
      the result
    • copyWorkflow

      @Nonnull public ServiceOutcome<com.atlassian.jira.workflow.JiraWorkflow> copyWorkflow(com.atlassian.jira.user.ApplicationUser user, @Nonnull com.atlassian.jira.workflow.JiraWorkflow workflow, @Nonnull String newName, @Nonnull String newDescription)
      Description copied from interface: WorkflowService
      Creates a new copy of the existing workflow, with the specified name and description.
      Specified by:
      copyWorkflow in interface WorkflowService
      Parameters:
      user - the user
      workflow - the original workflow
      newName - the new name
      newDescription - the new description
      Returns:
      the new workflow
    • getWorkflow

      @Nonnull public ServiceOutcome<com.atlassian.jira.workflow.JiraWorkflow> getWorkflow(com.atlassian.jira.user.ApplicationUser user, @Nonnull String workflowName)
      Description copied from interface: WorkflowService
      Retrieve the workflow with the specified name
      Specified by:
      getWorkflow in interface WorkflowService
      Parameters:
      user - the user
      workflowName - the workflow name
      Returns:
      the result
    • doesWorkflowSchemeExist

      @Nonnull public ServiceOutcome<Boolean> doesWorkflowSchemeExist(String name)
      Description copied from interface: WorkflowService
      Does a workflow scheme with the specified name exist?
      Specified by:
      doesWorkflowSchemeExist in interface WorkflowService
      Parameters:
      name - the name
      Returns:
      the result
    • isWorkflowSchemeActive

      @Nonnull public ServiceOutcome<Boolean> isWorkflowSchemeActive(String name)
      Description copied from interface: WorkflowService
      Is the workflow scheme with the specified name active?
      Specified by:
      isWorkflowSchemeActive in interface WorkflowService
      Parameters:
      name - the name
      Returns:
      the result
    • deleteScheme

      @Nonnull public ServiceResult deleteScheme(String name)
      Description copied from interface: WorkflowService
      Delete a workflow scheme with the specified name
      Specified by:
      deleteScheme in interface WorkflowService
      Parameters:
      name - workflow scheme name
      Returns:
      the result
    • deleteWorkflow

      @Nonnull public ServiceResult deleteWorkflow(String name)
      Description copied from interface: WorkflowService
      Delete a workflow with the specified name.
      Specified by:
      deleteWorkflow in interface WorkflowService
      Parameters:
      name - workflow name
      Returns:
      the result
    • getJiraWorkflows

      @Nonnull public Collection<com.atlassian.jira.workflow.JiraWorkflow> getJiraWorkflows(com.atlassian.jira.project.Project projectObj)
      Description copied from interface: WorkflowService
      Given a project, returns all JIRA workflows which are associated to that project Empty on error
      Specified by:
      getJiraWorkflows in interface WorkflowService
    • getJiraWorkflows

      @Nonnull public Collection<com.atlassian.jira.workflow.JiraWorkflow> getJiraWorkflows(com.atlassian.jira.project.Project projectObj, String issueTypeId)
      Description copied from interface: WorkflowService
      Given a project and an issue type id, returns the JIRA Workflow which is associated to that project for that issue type Empty on error
      Specified by:
      getJiraWorkflows in interface WorkflowService
    • getJiraWorkflows

      @Nonnull public Set<com.atlassian.jira.workflow.JiraWorkflow> getJiraWorkflows(@Nonnull Set<com.atlassian.jira.issue.Issue> issues)
      Description copied from interface: WorkflowService
      Given a set of issues, returns the JIRA Workflows which are associated to those issues
      Specified by:
      getJiraWorkflows in interface WorkflowService
      Parameters:
      issues - Set of issues to get workflows from
      Returns:
      A set of all the JiraWorkflow objects associated to the provided issues, or an empty set if no workflows could be found.
    • associateWorkflowToSchemeAsDefault

      @Nonnull public ServiceResult associateWorkflowToSchemeAsDefault(String workflowName, com.atlassian.jira.scheme.Scheme scheme)
      Description copied from interface: WorkflowService
      Associates a workflow to the given scheme, makes it the default workflow for that scheme
      Specified by:
      associateWorkflowToSchemeAsDefault in interface WorkflowService
    • associateSchemeToProject

      @Nonnull public ServiceResult associateSchemeToProject(com.atlassian.jira.project.Project project, com.atlassian.jira.scheme.Scheme scheme)
      Description copied from interface: WorkflowService
      Associates scheme to project
      Specified by:
      associateSchemeToProject in interface WorkflowService
    • getTransitions

      @Nonnull public ServiceOutcome<WorkflowService.WorkTransitions> getTransitions(com.atlassian.jira.user.ApplicationUser user, List<Long> projectIds)
      Description copied from interface: WorkflowService
      Get the transitions data for the given projects This will have the workflows for each project and issue type pair. A project will be omitted if the user does not have permission to view it or it is not present.
      Specified by:
      getTransitions in interface WorkflowService