com.atlassian.jira.web.action.issue
Class AbstractConvertIssue

java.lang.Object
  extended by webwork.action.ActionSupport
      extended by com.atlassian.jira.action.JiraActionSupport
          extended by com.atlassian.jira.web.action.JiraWebActionSupport
              extended by com.atlassian.jira.web.action.issue.AbstractConvertIssue
All Implemented Interfaces:
ErrorCollection, I18nHelper, AuthorizationSupport, Serializable, webwork.action.Action, webwork.action.CommandDriven, webwork.action.IllegalArgumentAware
Direct Known Subclasses:
ConvertIssueToSubTask, ConvertSubTaskToIssue

public abstract class AbstractConvertIssue
extends JiraWebActionSupport

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.ErrorCollection
ErrorCollection.Reason
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.I18nHelper
I18nHelper.BeanFactory
 
Field Summary
protected  ConstantsManager constantsManager
           
protected  FieldLayoutManager fieldLayoutManager
           
protected  String guid
           
protected  String id
           
protected  Issue issue
           
protected  IssueManager issueManager
           
protected  String issueType
           
protected  PermissionManager permissionManager
           
protected  RendererManager rendererManager
           
protected static String SECURITY_BREACH
           
protected static int STEP_1
           
protected static int STEP_2
           
protected static int STEP_3
           
protected static int STEP_4
           
protected  String targetStatusId
           
protected  WorkflowManager workflowManager
           
 
Fields inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
ISSUE_NOT_FOUND_RESULT, PERMISSION_VIOLATION_RESULT, request, RETURN_URL_PARAMETER, savedFilters
 
Fields inherited from class com.atlassian.jira.action.JiraActionSupport
log
 
Fields inherited from class webwork.action.ActionSupport
command, errorMap, errorMessages
 
Fields inherited from interface webwork.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
protected AbstractConvertIssue(IssueConversionService service, IssueManager issueManager, FieldLayoutManager fieldLayoutManager, ConstantsManager constantsManager, WorkflowManager workflowManager, RendererManager rendererManager, IssueFactory issueFactory, PermissionManager permissionManager)
           
 
Method Summary
protected  void addI18nError(JiraServiceContext context, String fieldName, String i18nKey)
          Convenience method for adding internationalized errors to the error collection
protected  void addI18nError(JiraServiceContext context, String fieldName, String i18nKey, String param)
          Convenience method for adding internationalized errors to the error collection
protected  void addI18nErrorMessage(JiraServiceContext context, String i18nKey)
          Conveniece method for adding internationalized error messages to the error collection
protected  void addI18nErrorMessage(JiraServiceContext context, String i18nKey, String param)
          Convenience method for adding internationalized error messages to the error collection
 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.
protected  ConvertIssueBean getBean()
          Retrieves the wizard bean from the session.
 Collection getConvertFieldLayoutItems()
          Returns a list of FieldLayoutItem that need values for conversion.
 String getCurrentJQL()
          Returns the JQL representation of the current search request in the session.
 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.
 SearchRequest getSearchRequest()
          This method will return the one in the current search request, or return null if one does not exist.
 MutableIssue getTargetIssue()
          Get Target Issue with Security Level set to null if it is needed.
protected  MutableIssue getTargetIssueObjectWithSecurityLevel()
          Get the issue with updated Issue type and status.
 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
protected abstract  void initExtraFields(ConvertIssueBean bean, JiraServiceContext context)
          Allows subclasses to set and init own fields.
protected  void initRequest(JiraServiceContext context)
          Checks for valid state, populates the bean with values from parameters and updates bean with new GUID
 boolean isStatusChangeRequired()
          Whether or not the issue's status is valid in the workflow
protected  void setCurrentStep(int step)
           
 void setGuid(String guid)
           
 void setId(String id)
           
 void setIssuetype(String subTaskType)
           
 void setTargetStatusId(String targetStatusId)
           
protected  void validateStep1(JiraServiceContextImpl context)
          Validates the first step of the wizard, subclasses can override to extend validation
protected  boolean wasPassed(String param)
          Returns true is the specified parameter was passed via request parameter value
 
Methods inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
addError, addErrorCollection, addErrorMessage, addErrorMessageByKeyIfAbsent, addErrorMessageIfAbsent, addReason, addReasons, forceRedirect, getAdministratorContactLink, getApplicationProperties, getConglomerateCookieValue, getConstantsManager, getDateFormat, getDateTimeFormat, getDateTimeFormatter, getDescTranslation, getDmyDateFormatter, getField, getFlushedErrorMessages, getGlobalPermissionManager, getHint, getHintManager, getJiraContactHelper, getJiraServiceContext, getLanguage, getLoggedInUser, getNameTranslation, getOutlookDate, getPermissionManager, getProjectManager, getRandomHint, getReasons, getRedirect, getRedirectChecker, getReturnUrl, getReturnUrlForCancelLink, getSearchSortDescriptions, getSelectedProject, getSelectedProjectObject, getServerId, getTimeFormat, getUriValidator, getUserFullName, getUserManager, getUserProjectHistoryManager, getVersionManager, getWebworkStack, getWebworkStack, getXsrfToken, hasErrorMessage, hasErrorMessageByKey, htmlEncode, insertContextPath, isHasIssuePermission, isHasIssuePermission, isHasPermission, isHasPermission, isHasPermission, isHasProjectPermission, isHasProjectPermission, isInlineDialogMode, isSystemAdministrator, isUserExists, returnComplete, returnComplete, returnCompleteWithInlineRedirect, returnCompleteWithInlineRedirectAndMsg, returnMsgToUser, setConglomerateCookieValue, setInline, setReasons, setReturnUrl, setSelectedProjectId
 
Methods inherited from class com.atlassian.jira.action.JiraActionSupport
addErrorMessages, addErrorMessages, addErrors, addIllegalArgumentException, execute, getActionName, getComponentInstanceOfType, getDefaultResourceBundle, getDelegator, getI18nHelper, getKeysForPrefix, getLocale, getOfBizDelegator, getRemoteUser, getResult, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getUnescapedText, getUserPreferences, getWatcherManager, hasAnyErrors, isIndexing, removeKeyOrAddError
 
Methods inherited from class webwork.action.ActionSupport
addError, addErrorMessage, doDefault, doExecute, doValidation, getCommandName, getErrorMessages, getErrors, getHasErrorMessages, getHasErrors, getPropertyEditorMessage, getTexts, getTexts, getTimezone, invalidInput, invokeCommand, isCommand, setCommand, setErrorMessages, setErrors, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.util.ErrorCollection
addError, addErrorMessage, addErrorMessages, addErrors, getErrorMessages, getErrors, hasAnyErrors, setErrorMessages
 
Methods inherited from interface webwork.action.CommandDriven
getCommandName, setCommand
 

Field Detail

SECURITY_BREACH

protected static final String SECURITY_BREACH
See Also:
Constant Field Values

issueManager

protected final IssueManager issueManager

constantsManager

protected final ConstantsManager constantsManager

fieldLayoutManager

protected final FieldLayoutManager fieldLayoutManager

workflowManager

protected final WorkflowManager workflowManager

permissionManager

protected final PermissionManager permissionManager

rendererManager

protected final RendererManager rendererManager

STEP_1

protected static final int STEP_1
See Also:
Constant Field Values

STEP_2

protected static final int STEP_2
See Also:
Constant Field Values

STEP_3

protected static final int STEP_3
See Also:
Constant Field Values

STEP_4

protected static final int STEP_4
See Also:
Constant Field Values

issue

protected Issue issue

id

protected String id

issueType

protected String issueType

targetStatusId

protected String targetStatusId

guid

protected String guid
Constructor Detail

AbstractConvertIssue

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

doStartWizard

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

Returns:
view

doSetIssueType

public String doSetIssueType()
Second step of this wizard. Gets the issue by given id. In case of error returns Action.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 Action.ERROR view. Returns view to update workflow or update fields view

Returns:
view

doSetWorkflowStatus

public String doSetWorkflowStatus()
Third step of this wizard. Gets the issue by given id. In case of error returns Action.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 Action.ERROR view. Returns Action.SUCCESS view

Returns:
view

doUpdateFields

public String doUpdateFields()
Fourth step of this wizard. Gets the issue by given id. In case of error returns Action.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 Action.ERROR view. Returns Action.SUCCESS view

Returns:
view

doConvert

public String doConvert()
Last step of this wizard. Gets the issue by given id. In case of error returns Action.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 Action.ERROR view. Executes the conversion. Returns to the issue

Returns:
view

doCancel

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.

initRequest

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

validateStep1

protected void validateStep1(JiraServiceContextImpl context)
Validates the first step of the wizard, subclasses can override to extend validation

Parameters:
context - jira service context

getIssue

public Issue getIssue()
Retrieves the worked on issue based on the Issue id.

Returns:
Current Issue

wasPassed

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

getBean

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

getTargetIssue

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

getTargetIssueObjectWithSecurityLevel

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

isStatusChangeRequired

public boolean isStatusChangeRequired()
Whether or not the issue's status is valid in the workflow

Returns:
true if status needs updating, false otherwise

getUpdatedIssue

public MutableIssue getUpdatedIssue()
Gets the target issue with new values set on issue

Returns:
Issue with all fields updated and hidden field removed

getConvertFieldLayoutItems

public Collection getConvertFieldLayoutItems()
Returns a list of FieldLayoutItem that need values for conversion.

Returns:
list of FieldLayoutItem

getRemoveFields

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.

getTargetWorkflow

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

getFieldName

public String getFieldName(Field field)
Utility method used by convertissuetosubtask-confirm.jsp

Parameters:
field - filed
Returns:
field name

getOldViewHtml

public String getOldViewHtml(OrderableField field)
Gets the old view of the field before update

Parameters:
field - Field to display
Returns:
HTML to insert

getNewViewHtml

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

getFieldHtml

public String getFieldHtml(FieldLayoutItem fieldLayoutItem)
Gets the create HTML for the given FieldLayoutItem.

Parameters:
fieldLayoutItem - Layoutitem describing field to display
Returns:
HTML to insert

getCurrentWorkflow

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

getSearchRequest

public SearchRequest getSearchRequest()
This method will return the one in the current search request, or return null if one does not exist.

Returns:
The current search request, or null if there is no current search request.

getCurrentJQL

public String getCurrentJQL()
Returns the JQL representation of the current search request in the session.

Returns:
the jql of the SearchRequest in the session, empty string otherwise.

getId

public String getId()

setId

public void setId(String id)

getParentIssueKey

public String getParentIssueKey()

getTargetStatusId

public String getTargetStatusId()

setTargetStatusId

public void setTargetStatusId(String targetStatusId)

getIssuetype

public String getIssuetype()

setIssuetype

public void setIssuetype(String subTaskType)

getGuid

public String getGuid()

setGuid

public void setGuid(String guid)

getCurrentStep

public int getCurrentStep()

setCurrentStep

protected void setCurrentStep(int step)

addI18nErrorMessage

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

addI18nErrorMessage

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

addI18nError

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

addI18nError

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

getTextKey

public String getTextKey(String key)
Utility method to get appropriate key for property.

Parameters:
key - to get
Returns:
key prefixed with action specific prefix.

getIssuePath

public String getIssuePath()

getActionPrefix

public abstract String getActionPrefix()
Prefix used for jsps Actions. Allows the same jsp to be used for different actions

Returns:
subclass specific action prefix

getPropertiesPrefix

public abstract String getPropertiesPrefix()
Prefix used for i18n properties. Allows the same jsp to be used for different actions

Returns:
subclass specific properties prefix

getAvailableIssueTypes

public abstract Collection getAvailableIssueTypes()
Gets a collection of IssueType that are the available target Issue Types.

Returns:
a collection of IssueType

initExtraFields

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.


Copyright © 2002-2012 Atlassian. All Rights Reserved.