public class

DefaultIssueToSubTaskConversionService

extends DefaultIssueConversionService
implements IssueToSubTaskConversionService
java.lang.Object
   ↳ com.atlassian.jira.bc.subtask.conversion.DefaultIssueConversionService
     ↳ com.atlassian.jira.bc.subtask.conversion.DefaultIssueToSubTaskConversionService

Class Overview

Default implementation of IssueToSubTaskConversionService.

Summary

[Expand]
Inherited Fields
From class com.atlassian.jira.bc.subtask.conversion.DefaultIssueConversionService
Public Constructors
DefaultIssueToSubTaskConversionService(PermissionManager permissionManager, SubTaskManager subtaskManager, IssueTypeSchemeManager issueTypeSchemeManager, JiraAuthenticationContext jiraAuthenticationContext, WorkflowManager workflowManager, FieldLayoutManager fieldLayoutManager, FieldManager fieldManager)
Public Methods
boolean canConvertIssue(JiraServiceContext context, Issue issue)
As per the IssueToSubTaskConversionService interface.
void preStoreUpdates(JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue)
Allows for a plugin point to extra updates specific to that sub class
void validateParentIssue(JiraServiceContext context, Issue issue, Issue parentIssue, String fieldNameParentIssueKey)
Validates the given parent issue key for issue key.
void validateTargetIssueType(JiraServiceContext context, Issue issue, IssueType issueType, String fieldNameIssueTypeId)
Validates that the issue can be converted to given issue type.
Protected Methods
boolean canIssueSecurityFieldIgnore()
For an issue to subtask conversion, we can safely ignore the issue security field since the subtask will always take the security level of the parent issue.
static String getLongToStringNullSafe(Long aLong)
Returns a String as a result of toString() call or null if aLong was null.
static boolean isNotNullAndNotEqualTo(Long id1, Long id2)
Returns true if id1 is not null and not equal to id2, false otherwise.
boolean projectHasSubTasks(Project project)
Returns true if given project has sub-task Issue Types in its Issue Type scheme
[Expand]
Inherited Methods
From class com.atlassian.jira.bc.subtask.conversion.DefaultIssueConversionService
From class java.lang.Object
From interface com.atlassian.jira.bc.subtask.conversion.IssueConversionService
From interface com.atlassian.jira.bc.subtask.conversion.IssueToSubTaskConversionService

Public Constructors

public DefaultIssueToSubTaskConversionService (PermissionManager permissionManager, SubTaskManager subtaskManager, IssueTypeSchemeManager issueTypeSchemeManager, JiraAuthenticationContext jiraAuthenticationContext, WorkflowManager workflowManager, FieldLayoutManager fieldLayoutManager, FieldManager fieldManager)

Public Methods

public boolean canConvertIssue (JiraServiceContext context, Issue issue)

As per the IssueToSubTaskConversionService interface.

NOTE: We also considered a check for number of issues in the project and returning false if project has only one issue. This was not implemented as it would impair the performance of this method.

Parameters
context JIRA Service Context
issue issue to convert
Returns
  • true if user can convert issue to a sub-task
Throws
IllegalArgumentException if context or issue is null

public void preStoreUpdates (JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue)

Allows for a plugin point to extra updates specific to that sub class

Parameters
context jira service context
changeHolder holds all the change items
currentIssue original issue with no updates
targetIssue target issue with all fields updated

public void validateParentIssue (JiraServiceContext context, Issue issue, Issue parentIssue, String fieldNameParentIssueKey)

Validates the given parent issue key for issue key. Any errors are communicated back via error collection in the context.

Parameters
context jira service context
issue issue to convert
parentIssue possible parrent issue to check
fieldNameParentIssueKey form field name of the parrent issue key

public void validateTargetIssueType (JiraServiceContext context, Issue issue, IssueType issueType, String fieldNameIssueTypeId)

Validates that the issue can be converted to given issue type. Any errors are communicated back via error collection in the context.

Parameters
context jira service context
issue issue to convert
issueType target issue type
fieldNameIssueTypeId form field name of the issue type id

Protected Methods

protected boolean canIssueSecurityFieldIgnore ()

For an issue to subtask conversion, we can safely ignore the issue security field since the subtask will always take the security level of the parent issue.

Returns
  • true if it is safe to ignore the security field.

protected static String getLongToStringNullSafe (Long aLong)

Returns a String as a result of toString() call or null if aLong was null.

Parameters
aLong long
Returns
  • String as a result of toString() call or null if aLong was null

protected static boolean isNotNullAndNotEqualTo (Long id1, Long id2)

Returns true if id1 is not null and not equal to id2, false otherwise.

Parameters
id1 id1
id2 id2
Returns
  • true if id1 is not null and not equal to id2, false otherwise

protected boolean projectHasSubTasks (Project project)

Returns true if given project has sub-task Issue Types in its Issue Type scheme

Parameters
project to to test
Returns
  • true if project has sub-task Issue Types in its Issue Type Scheme