Class DefaultIssueToSubTaskConversionService
java.lang.Object
com.atlassian.jira.bc.subtask.conversion.DefaultIssueConversionService
com.atlassian.jira.bc.subtask.conversion.DefaultIssueToSubTaskConversionService
- All Implemented Interfaces:
IssueConversionService,IssueToSubTaskConversionService
public class DefaultIssueToSubTaskConversionService
extends DefaultIssueConversionService
implements IssueToSubTaskConversionService
Default implementation of
IssueToSubTaskConversionService.-
Field Summary
Fields inherited from class com.atlassian.jira.bc.subtask.conversion.DefaultIssueConversionService
fieldLayoutManager, fieldManager, issueTypeSchemeManager, jiraAuthenticationContext -
Constructor Summary
ConstructorsConstructorDescriptionDefaultIssueToSubTaskConversionService(PermissionManager permissionManager, SubTaskManager subtaskManager, IssueTypeSchemeManager issueTypeSchemeManager, JiraAuthenticationContext jiraAuthenticationContext, WorkflowManager workflowManager, FieldLayoutManager fieldLayoutManager, FieldManager fieldManager, IssueEventManager issueEventManager, IssueEventBundleFactory issueEventBundleFactory, TxnAwareEventFactory txnAwareEventFactory) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanConvertIssue(JiraServiceContext context, Issue issue) As per theIssueToSubTaskConversionServiceinterface.protected booleanFor 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.protected static StringgetLongToStringNullSafe(Long aLong) Returns a String as a result of toString() call or null if aLong was null.protected static booleanisNotNullAndNotEqualTo(Long id1, Long id2) Returns true if id1 is not null and not equal to id2, false otherwise.voidpreStoreUpdates(JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue) Allows for a plugin point to extra updates specific to that sub classprotected booleanprojectHasSubTasks(Project project) Returns true if given project has sub-task Issue Types in its Issue Type schemevoidvalidateParentIssue(JiraServiceContext context, Issue issue, Issue parentIssue, String fieldNameParentIssueKey) Validates the given parent issue key for issue key.voidvalidateTargetIssueType(JiraServiceContext context, Issue issue, IssueType issueType, String fieldNameIssueTypeId) Validates that the issue can be converted to given issue type.Methods inherited from class com.atlassian.jira.bc.subtask.conversion.DefaultIssueConversionService
convertIssue, getFieldLayoutItems, getPermissionNeeded, getRemovedFields, getText, getText, getText, hasPermission, isShouldCheckFieldValue, isStatusChangeRequired, isStatusInWorkflowForProjectAndIssueType, populateFields, validateFields, validateTargetStatusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.bc.subtask.conversion.IssueConversionService
convertIssue, getFieldLayoutItems, getRemovedFields, hasPermission, isStatusChangeRequired, populateFields, validateFields, validateTargetStatus
-
Constructor Details
-
DefaultIssueToSubTaskConversionService
public DefaultIssueToSubTaskConversionService(PermissionManager permissionManager, SubTaskManager subtaskManager, IssueTypeSchemeManager issueTypeSchemeManager, JiraAuthenticationContext jiraAuthenticationContext, WorkflowManager workflowManager, FieldLayoutManager fieldLayoutManager, FieldManager fieldManager, IssueEventManager issueEventManager, IssueEventBundleFactory issueEventBundleFactory, TxnAwareEventFactory txnAwareEventFactory)
-
-
Method Details
-
canConvertIssue
As per theIssueToSubTaskConversionServiceinterface.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.
- Specified by:
canConvertIssuein interfaceIssueConversionService- Parameters:
context- JIRA Service Contextissue- issue to convert- Returns:
- true if user can convert issue to a sub-task
- Throws:
IllegalArgumentException- if context or issue is null
-
validateTargetIssueType
public void validateTargetIssueType(JiraServiceContext context, Issue issue, IssueType issueType, String fieldNameIssueTypeId) Description copied from interface:IssueConversionServiceValidates that the issue can be converted to given issue type. Any errors are communicated back via error collection in the context.- Specified by:
validateTargetIssueTypein interfaceIssueConversionService- Parameters:
context- jira service contextissue- issue to convertissueType- target issue typefieldNameIssueTypeId- form field name of the issue type id
-
canIssueSecurityFieldIgnore
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.- Specified by:
canIssueSecurityFieldIgnorein classDefaultIssueConversionService- Returns:
- true if it is safe to ignore the security field.
-
validateParentIssue
public void validateParentIssue(JiraServiceContext context, Issue issue, Issue parentIssue, String fieldNameParentIssueKey) Description copied from interface:IssueToSubTaskConversionServiceValidates the given parent issue key for issue key. Any errors are communicated back via error collection in the context.- Specified by:
validateParentIssuein interfaceIssueToSubTaskConversionService- Parameters:
context- jira service contextissue- issue to convertparentIssue- possible parrent issue to checkfieldNameParentIssueKey- form field name of the parrent issue key
-
preStoreUpdates
public void preStoreUpdates(JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue) Description copied from interface:IssueConversionServiceAllows for a plugin point to extra updates specific to that sub class- Specified by:
preStoreUpdatesin interfaceIssueConversionService- Parameters:
context- jira service contextchangeHolder- holds all the change itemscurrentIssue- original issue with no updatestargetIssue- target issue with all fields updated
-
isNotNullAndNotEqualTo
Returns true if id1 is not null and not equal to id2, false otherwise.- Parameters:
id1- id1id2- id2- Returns:
- true if id1 is not null and not equal to id2, false otherwise
-
getLongToStringNullSafe
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
-
projectHasSubTasks
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
-