public abstract class

AbstractConvertIssue

extends JiraWebActionSupport
java.lang.Object
   ↳ webwork.action.ActionSupport
     ↳ com.atlassian.jira.action.JiraActionSupport
       ↳ com.atlassian.jira.web.action.JiraWebActionSupport
         ↳ com.atlassian.jira.web.action.issue.AbstractConvertIssue
Known Direct Subclasses

Class Overview

Abstract class for issue conversion Contains all do* methods and vast majority of logic

Summary

Constants
String SECURITY_BREACH
int STEP_1
int STEP_2
int STEP_3
int STEP_4
[Expand]
Inherited Constants
From class com.atlassian.jira.web.action.JiraWebActionSupport
From interface webwork.action.Action
Fields
protected final ConstantsManager constantsManager
protected final FieldLayoutManager fieldLayoutManager
protected String guid
protected String id
protected Issue issue
protected final IssueManager issueManager
protected String issueType
protected final PermissionManager permissionManager
protected final RendererManager rendererManager
protected String targetStatusId
protected final WorkflowManager workflowManager
[Expand]
Inherited Fields
From class com.atlassian.jira.web.action.JiraWebActionSupport
From class com.atlassian.jira.action.JiraActionSupport
From class webwork.action.ActionSupport
Protected Constructors
AbstractConvertIssue(IssueConversionService service, IssueManager issueManager, FieldLayoutManager fieldLayoutManager, ConstantsManager constantsManager, WorkflowManager workflowManager, RendererManager rendererManager, IssueFactory issueFactory, PermissionManager permissionManager)
Public Methods
String doCancel()
Handles the request to cancel the issue conversion wizard.
String doConvert()
Last step of this wizard.
String doSetIssueType()
Second step of this wizard.
String doSetWorkflowStatus()
Third step of this wizard.
String doStartWizard()
First step of this wizard.
String doUpdateFields()
Fourth step of this wizard.
abstract String getActionPrefix()
Prefix used for jsps Actions.
abstract Collection getAvailableIssueTypes()
Gets a collection of IssueType that are the available target Issue Types.
Collection<FieldLayoutItem> getConvertFieldLayoutItems()
Returns a list of FieldLayoutItem that need values for conversion.
int getCurrentStep()
JiraWorkflow getCurrentWorkflow()
Utility method used by convertissuetosubtask-updateworkflow.jsp and convertissuetosubtask-confirm-part1.jsp
Retrieve and return current workflow for selected issue
String getFieldHtml(FieldLayoutItem fieldLayoutItem)
Gets the create HTML for the given FieldLayoutItem.
String getFieldName(Field field)
Utility method used by convertissuetosubtask-confirm.jsp
String getGuid()
String getId()
Issue getIssue()
Retrieves the worked on issue based on the Issue id.
String getIssuePath()
String getIssuetype()
String getNewViewHtml(OrderableField field)
Gets the ne view of the field after values have been updated
String getOldViewHtml(OrderableField field)
Gets the old view of the field before update
String getParentIssueKey()
abstract String getPropertiesPrefix()
Prefix used for i18n properties.
Collection getRemoveFields()
Returns a list of OrderableFields that should be removed from the target issue.
MutableIssue getTargetIssue()
Get Target Issue with Security Level set to null if it is needed.
String getTargetStatusId()
JiraWorkflow getTargetWorkflow()
Utility method used by convertissuetosubtask-confirm.jsp and convertissuetosubtask-confirm-part1.jsp
Retrieve and return workflow for selected issue's project and new (target) issue type.
String getTextKey(String key)
Utility method to get appropriate key for property.
MutableIssue getUpdatedIssue()
Gets the target issue with new values set on issue
boolean isStatusChangeRequired()
Whether or not the issue's status is valid in the workflow
void setGuid(String guid)
void setId(String id)
void setIssuetype(String subTaskType)
void setTargetStatusId(String targetStatusId)
Protected Methods
void addI18nError(JiraServiceContext context, String fieldName, String i18nKey, String param)
Convenience method for adding internationalized errors to the error collection
void addI18nError(JiraServiceContext context, String fieldName, String i18nKey)
Convenience method for adding internationalized errors to the error collection
void addI18nErrorMessage(JiraServiceContext context, String i18nKey, String param)
Convenience method for adding internationalized error messages to the error collection
void addI18nErrorMessage(JiraServiceContext context, String i18nKey)
Conveniece method for adding internationalized error messages to the error collection
ConvertIssueBean getBean()
Retrieves the wizard bean from the session.
MutableIssue getTargetIssueObjectWithSecurityLevel()
Get the issue with updated Issue type and status.
abstract void initExtraFields(ConvertIssueBean bean, JiraServiceContext context)
Allows subclasses to set and init own fields.
void initRequest(JiraServiceContext context)
Checks for valid state, populates the bean with values from parameters and updates bean with new GUID
void setCurrentStep(int step)
void validateStep1(JiraServiceContextImpl context)
Validates the first step of the wizard, subclasses can override to extend validation
boolean wasPassed(String param)
Returns true is the specified parameter was passed via request parameter value
[Expand]
Inherited Methods
From class com.atlassian.jira.web.action.JiraWebActionSupport
From class com.atlassian.jira.action.JiraActionSupport
From class webwork.action.ActionSupport
From class java.lang.Object
From interface com.atlassian.jira.util.ErrorCollection
From interface com.atlassian.jira.util.I18nHelper
From interface com.atlassian.jira.web.HttpServletVariables
From interface com.atlassian.jira.web.util.AuthorizationSupport
From interface webwork.action.Action
From interface webwork.action.CommandDriven
From interface webwork.action.IllegalArgumentAware

Constants

protected static final String SECURITY_BREACH

Constant Value: "securitybreach"

protected static final int STEP_1

Constant Value: 1 (0x00000001)

protected static final int STEP_2

Constant Value: 2 (0x00000002)

protected static final int STEP_3

Constant Value: 3 (0x00000003)

protected static final int STEP_4

Constant Value: 4 (0x00000004)

Fields

protected final ConstantsManager constantsManager

protected final FieldLayoutManager fieldLayoutManager

protected String guid

protected String id

protected Issue issue

protected final IssueManager issueManager

protected String issueType

protected final PermissionManager permissionManager

protected final RendererManager rendererManager

protected String targetStatusId

protected final WorkflowManager workflowManager

Protected Constructors

protected AbstractConvertIssue (IssueConversionService service, IssueManager issueManager, FieldLayoutManager fieldLayoutManager, ConstantsManager constantsManager, WorkflowManager workflowManager, RendererManager rendererManager, IssueFactory issueFactory, PermissionManager permissionManager)

Public Methods

public String doCancel ()

Handles the request to cancel the issue conversion wizard. Clears the session and redirects to the view issue page for the issue in play.

Returns
  • Redirects to the view issue page.

public String doConvert ()

Last step of this wizard. Gets the issue by given id. In case of error returns ERROR view. Checks user's permission, if denied returns SECURITY_BREACH view. Checks if given issue is convertable and valid values were entered, if not returns ERROR view. Executes the conversion. Returns to the issue

Returns
  • view

public String doSetIssueType ()

Second step of this wizard. Gets the issue by given id. In case of error returns ERROR view. Checks user's permission, if denied returns SECURITY_BREACH view. Checks if given issue is convertable and validates other values, if not returns ERROR view. Returns view to update workflow or update fields view

Returns
  • view

public String doSetWorkflowStatus ()

Third step of this wizard. Gets the issue by given id. In case of error returns ERROR view. Checks user's permission, if denied returns SECURITY_BREACH view. Checks if given issue is convertable and valid values were entered, if not returns ERROR view. Returns SUCCESS view

Returns
  • view

public String doStartWizard ()

First step of this wizard. Gets the issue by given id. In case of error returns ERROR view. Checks user's permission, if denied returns SECURITY_BREACH view. Checks if given issue is convertable, if not returns ERROR view. Returns SUCCESS view

Returns
  • view

public String doUpdateFields ()

Fourth step of this wizard. Gets the issue by given id. In case of error returns ERROR view. Checks user's permission, if denied returns SECURITY_BREACH view. Checks if given issue is convertable and valid values were entered, if not returns ERROR view. Returns SUCCESS view

Returns
  • view

public abstract String getActionPrefix ()

Prefix used for jsps Actions. Allows the same jsp to be used for different actions

Returns
  • subclass specific action prefix

public abstract Collection getAvailableIssueTypes ()

Gets a collection of IssueType that are the available target Issue Types.

Returns

public Collection<FieldLayoutItem> getConvertFieldLayoutItems ()

Returns a list of FieldLayoutItem that need values for conversion.

Returns

public int getCurrentStep ()

public JiraWorkflow getCurrentWorkflow ()

Utility method used by convertissuetosubtask-updateworkflow.jsp and convertissuetosubtask-confirm-part1.jsp
Retrieve and return current workflow for selected issue

Returns
  • current workflow
Throws
DataAccessException if WorkflowException occured during retrieval

public String getFieldHtml (FieldLayoutItem fieldLayoutItem)

Gets the create HTML for the given FieldLayoutItem.

Parameters
fieldLayoutItem Layoutitem describing field to display
Returns
  • HTML to insert

public String getFieldName (Field field)

Utility method used by convertissuetosubtask-confirm.jsp

Parameters
field filed
Returns
  • field name

public String getGuid ()

public String getId ()

public Issue getIssue ()

Retrieves the worked on issue based on the Issue id.

Returns
  • Current Issue

public String getIssuePath ()

public String getIssuetype ()

public String getNewViewHtml (OrderableField field)

Gets the ne view of the field after values have been updated

Parameters
field Field to display
Returns
  • HTML to insert

public String getOldViewHtml (OrderableField field)

Gets the old view of the field before update

Parameters
field Field to display
Returns
  • HTML to insert

public String getParentIssueKey ()

public abstract String getPropertiesPrefix ()

Prefix used for i18n properties. Allows the same jsp to be used for different actions

Returns
  • subclass specific properties prefix

public Collection getRemoveFields ()

Returns a list of OrderableFields that should be removed from the target issue.

Returns
  • a list of OrderableFields that should be removed from the target issue.

public MutableIssue getTargetIssue ()

Get Target Issue with Security Level set to null if it is needed. JRA-11605 - we need this method so that the display can prompt the user with values from system fields that are unencumbered by security level permission checks.

Returns
  • Target Issue with nullified Security Level

public String getTargetStatusId ()

public JiraWorkflow getTargetWorkflow ()

Utility method used by convertissuetosubtask-confirm.jsp and convertissuetosubtask-confirm-part1.jsp
Retrieve and return workflow for selected issue's project and new (target) issue type.

Returns
  • target workflow
Throws
DataAccessException if WorkflowException occured during retrieval

public String getTextKey (String key)

Utility method to get appropriate key for property.

Parameters
key to get
Returns
  • key prefixed with action specific prefix.

public MutableIssue getUpdatedIssue ()

Gets the target issue with new values set on issue

Returns
  • Issue with all fields updated and hidden field removed

public boolean isStatusChangeRequired ()

Whether or not the issue's status is valid in the workflow

Returns
  • true if status needs updating, false otherwise

public void setGuid (String guid)

public void setId (String id)

public void setIssuetype (String subTaskType)

public void setTargetStatusId (String targetStatusId)

Protected Methods

protected void addI18nError (JiraServiceContext context, String fieldName, String i18nKey, String param)

Convenience method for adding internationalized errors to the error collection

Parameters
context jira service context
fieldName field name
i18nKey message key
param parameter value

protected void addI18nError (JiraServiceContext context, String fieldName, String i18nKey)

Convenience method for adding internationalized errors to the error collection

Parameters
context jira service context
fieldName field name
i18nKey message key

protected void addI18nErrorMessage (JiraServiceContext context, String i18nKey, String param)

Convenience method for adding internationalized error messages to the error collection

Parameters
context jira service context
i18nKey message key
param parameter value

protected void addI18nErrorMessage (JiraServiceContext context, String i18nKey)

Conveniece method for adding internationalized error messages to the error collection

Parameters
context jira service context
i18nKey message key

protected ConvertIssueBean getBean ()

Retrieves the wizard bean from the session. Never returns null, if no bean is found new one is created and stored in the session.

Returns
  • wizard bean

protected MutableIssue getTargetIssueObjectWithSecurityLevel ()

Get the issue with updated Issue type and status. Subclasses can over-ride if they need to set their own fields. E.g Issue to sub-task conversion sets the new parent issue. Security level remains intact.

Returns
  • Cloned issue with updated issue ype and status

protected abstract void initExtraFields (ConvertIssueBean bean, JiraServiceContext context)

Allows subclasses to set and init own fields. E.g. ConvertIssueToSubTask sets parent id.

Parameters
bean bean that holds params.
context jira service context.

protected void initRequest (JiraServiceContext context)

Checks for valid state, populates the bean with values from parameters and updates bean with new GUID

Parameters
context jira service context

protected void setCurrentStep (int step)

protected void validateStep1 (JiraServiceContextImpl context)

Validates the first step of the wizard, subclasses can override to extend validation

Parameters
context jira service context

protected boolean wasPassed (String param)

Returns true is the specified parameter was passed via request parameter value

Parameters
param parameter to check
Returns
  • true if value passed via request, false otherwise