com.atlassian.jira.bc.subtask.conversion
Interface IssueConversionService

All Known Subinterfaces:
IssueToSubTaskConversionService, SubTaskToIssueConversionService
All Known Implementing Classes:
DefaultIssueConversionService, DefaultIssueToSubTaskConversionService, DefaultSubTaskToIssueConversionService

public interface IssueConversionService


Method Summary
 boolean canConvertIssue(JiraServiceContext context, Issue issue)
          Determines if user can convert given issue.
 void convertIssue(JiraServiceContext context, Issue issue, MutableIssue updatedIssue)
          This is the core method that converts given issue to an issue represented by updatedIssue.
 Collection getFieldLayoutItems(JiraServiceContext context, Issue originalIssue, Issue targetIssue)
          Retrieves the collection of FieldLayoutItem required to be entered from converting issue from given issue to given target issue.
 Collection getRemovedFields(JiraServiceContext context, Issue origIssue, Issue targetIssue)
          Retrieves the fields that have values on the issue but are no longer needed.
 boolean hasPermission(JiraServiceContext context, Issue issue)
          Checks the user's permission to convert given issue.
 boolean isStatusChangeRequired(JiraServiceContext context, Issue issue, IssueType issueType)
          Determines if the workflow status exists in the target workflow (based on current project and target issue type).
 void populateFields(JiraServiceContext context, OperationContext operationContext, I18nHelper i18nHelper, Issue targetIssue, Collection fieldLayoutItems)
          Populates the operationContext from the params in the ActionContext In case of invalid values, new error messages are added to the context's error collection under the fieldName.
 void preStoreUpdates(JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue)
          Allows for a plugin point to extra updates specific to that sub class
 void validateFields(JiraServiceContext context, OperationContext operationContext, I18nHelper i18nHelper, Issue targetIssue, Collection fieldLayoutItems)
          Validates that all fields inputed have valid values.
 void validateTargetIssueType(JiraServiceContext context, Issue issue, IssueType issueType, String fieldNameIssueTypeId)
          Validates that the issue can be converted to given issue type.
 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.
 

Method Detail

canConvertIssue

boolean canConvertIssue(JiraServiceContext context,
                        Issue issue)
Determines if user can convert given issue.

Parameters:
context - JIRA Service Context
issue - issue to convert
Returns:
true if user can convert the given issue, false otherwise
Throws:
IllegalArgumentException - if issue is null

hasPermission

boolean hasPermission(JiraServiceContext context,
                      Issue issue)
Checks the user's permission to convert given issue. User is retrieved from the context.

Parameters:
context - jira service context
issue - issue to check the permission on
Returns:
true if user is granted permission to convert given issue, false otherwise

isStatusChangeRequired

boolean isStatusChangeRequired(JiraServiceContext context,
                               Issue issue,
                               IssueType issueType)
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 context
issue - issue to convert
issueType - target issue type
Returns:
true if status change is needed, otherwise false

getFieldLayoutItems

Collection getFieldLayoutItems(JiraServiceContext context,
                               Issue originalIssue,
                               Issue targetIssue)
Retrieves the collection of FieldLayoutItem required to be entered from converting issue from given issue to given target issue.

Parameters:
context - jira service context
originalIssue - Current Issue
targetIssue - Issue with updated issue type
Returns:
A Collection of FieldLayoutItem that 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 context
issue - issue to convert
issueType - target issue type
fieldNameIssueTypeId - 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 context
status - target status
fieldName - form field name
issue - issue to convert
issueType - target issue type

populateFields

void populateFields(JiraServiceContext context,
                    OperationContext operationContext,
                    I18nHelper i18nHelper,
                    Issue targetIssue,
                    Collection fieldLayoutItems)
Populates the operationContext from the params in the ActionContext In case of invalid values, new error messages are added to the context's error collection under the fieldName.

Parameters:
context - jira service context
operationContext - contains Map (CustomFieldValuesHolder) where field values will be populated
i18nHelper - helper bean for i18n (needed by fields)
targetIssue - Current issue with updated parent, issue type and status
fieldLayoutItems - Collection of FieldLayoutItem that required input

getRemovedFields

Collection getRemovedFields(JiraServiceContext context,
                            Issue origIssue,
                            Issue targetIssue)
Retrieves the fields that have values on the issue but are no longer needed.

Parameters:
context - jira service context
origIssue - issue
targetIssue - issue
Returns:
collection of OrderableField, never null

convertIssue

void convertIssue(JiraServiceContext context,
                  Issue issue,
                  MutableIssue updatedIssue)
This is the core method that converts given issue to an issue represented by updatedIssue.

Parameters:
context - jira service context, any error are added here
issue - original issue
updatedIssue - target issue

validateFields

void validateFields(JiraServiceContext context,
                    OperationContext operationContext,
                    I18nHelper i18nHelper,
                    Issue targetIssue,
                    Collection 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 context
operationContext - contains Map (CustomFieldValuesHolder) containing values to be validated
i18nHelper - helper bean for i18n (needed by fields)
targetIssue - Current issue with updated parent, issue type and status
fieldLayoutItems - Collection of FieldLayoutItem that 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 context
changeHolder - holds all the change items
currentIssue - original issue with no updates
targetIssue - target issue with all fields updated


Copyright © 2002-2007 Atlassian. All Rights Reserved.