Interface IssueConversionService
- All Known Subinterfaces:
IssueToSubTaskConversionService,SubTaskToIssueConversionService
- All Known Implementing Classes:
DefaultIssueConversionService,DefaultIssueToSubTaskConversionService,DefaultSubTaskToIssueConversionService
@PublicApi
public interface IssueConversionService
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanConvertIssue(JiraServiceContext context, Issue issue) Determines if user can convert given issue.voidconvertIssue(JiraServiceContext context, Issue issue, MutableIssue updatedIssue) This is the core method that converts given issue to an issue represented by updatedIssue.getFieldLayoutItems(Issue originalIssue, Issue targetIssue) Retrieves the collection ofFieldLayoutItemrequired to be entered from converting issue from given issue to given target issue.getRemovedFields(Issue origIssue, Issue targetIssue) Retrieves the fields that have values on the issue but are no longer needed.booleanhasPermission(JiraServiceContext context, Issue issue) Checks the user's permission to convert given issue.booleanisStatusChangeRequired(JiraServiceContext context, Issue issue, IssueType issueType) Determines if the workflow status exists in the target workflow (based on current project and target issue type).voidpopulateFields(JiraServiceContext context, OperationContext operationContext, I18nHelper i18nHelper, Issue targetIssue, Collection<FieldLayoutItem> fieldLayoutItems) Populates the operationContext from the params in theActionContextIn case of invalid values, new error messages are added to the context's error collection under the fieldName.voidpreStoreUpdates(JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue) Allows for a plugin point to extra updates specific to that sub classvoidvalidateFields(JiraServiceContext context, OperationContext operationContext, I18nHelper i18nHelper, Issue targetIssue, Collection<FieldLayoutItem> fieldLayoutItems) Validates that all fields inputed have valid values.voidvalidateTargetIssueType(JiraServiceContext context, Issue issue, IssueType issueType, String fieldNameIssueTypeId) Validates that the issue can be converted to given issue type.voidvalidateTargetStatus(JiraServiceContext context, Status status, String fieldName, Issue issue, IssueType issueType) Validates that the target status is a valid status for the issue's project and the target issue type.
-
Method Details
-
canConvertIssue
Determines if user can convert given issue.- Parameters:
context- JIRA Service Contextissue- issue to convert- Returns:
- true if user can convert the given issue, false otherwise
- Throws:
IllegalArgumentException- if issue is null
-
hasPermission
Checks the user's permission to convert given issue. User is retrieved from the context.- Parameters:
context- jira service contextissue- issue to check the permission on- Returns:
- true if user is granted permission to convert given issue, false otherwise
-
isStatusChangeRequired
Determines if the workflow status exists in the target workflow (based on current project and target issue type).
Returns true if the issue's status is not a valid status for the target issue type workflow in the issue's project - issue's status needs to change, false otherwise.- Parameters:
context- jira service contextissue- issue to convertissueType- target issue type- Returns:
- true if status change is needed, otherwise false
-
getFieldLayoutItems
Retrieves the collection ofFieldLayoutItemrequired to be entered from converting issue from given issue to given target issue.- Parameters:
originalIssue- Current IssuetargetIssue- Issue with updated issue type- Returns:
- A Collection of
FieldLayoutItemthat require values, never null
-
validateTargetIssueType
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 contextissue- issue to convertissueType- target issue typefieldNameIssueTypeId- form field name of the issue type id
-
validateTargetStatus
void validateTargetStatus(JiraServiceContext context, Status status, String fieldName, Issue issue, IssueType issueType) Validates that the target status is a valid status for the issue's project and the target issue type. In case of invalid status a new error message is added to the context's error collection under the given fieldName.- Parameters:
context- jira service contextstatus- target statusfieldName- form field nameissue- issue to convertissueType- target issue type
-
populateFields
void populateFields(JiraServiceContext context, OperationContext operationContext, I18nHelper i18nHelper, Issue targetIssue, Collection<FieldLayoutItem> fieldLayoutItems) Populates the operationContext from the params in theActionContextIn case of invalid values, new error messages are added to the context's error collection under the fieldName.- Parameters:
context- jira service contextoperationContext- contains Map (CustomFieldValuesHolder) where field values will be populatedi18nHelper- helper bean for i18n (needed by fields)targetIssue- Current issue with updated parent, issue type and statusfieldLayoutItems- Collection ofFieldLayoutItemthat required input
-
getRemovedFields
Retrieves the fields that have values on the issue but are no longer needed.- Parameters:
origIssue- issuetargetIssue- issue- Returns:
- collection of
OrderableField, never null
-
convertIssue
This is the core method that converts given issue to an issue represented by updatedIssue.- Parameters:
context- jira service context, any error are added hereissue- original issueupdatedIssue- target issue
-
validateFields
void validateFields(JiraServiceContext context, OperationContext operationContext, I18nHelper i18nHelper, Issue targetIssue, Collection<FieldLayoutItem> fieldLayoutItems) Validates that all fields inputed have valid values. In case of invalid values, new error messages are added to the context's error collection under the fieldName.- Parameters:
context- jira service contextoperationContext- contains Map (CustomFieldValuesHolder) containing values to be validatedi18nHelper- helper bean for i18n (needed by fields)targetIssue- Current issue with updated parent, issue type and statusfieldLayoutItems- Collection ofFieldLayoutItemthat required input
-
preStoreUpdates
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 contextchangeHolder- holds all the change itemscurrentIssue- original issue with no updatestargetIssue- target issue with all fields updated
-