Class AbstractConvertIssue
java.lang.Object
webwork.action.ActionSupport
com.atlassian.jira.web.action.JiraWebActionSupport
com.atlassian.jira.web.action.issue.AbstractConvertIssue
- All Implemented Interfaces:
ErrorCollection
,I18nHelper
,HttpServletVariables
,AuthorizationSupport
,Serializable
,webwork.action.Action
,webwork.action.CommandDriven
,webwork.action.IllegalArgumentAware
- Direct Known Subclasses:
ConvertIssueToSubTask
,ConvertSubTaskToIssue
Abstract class for issue conversion
Contains all do* methods and vast majority of logic
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
JiraWebActionSupport.MessageType
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
FieldsModifier and TypeFieldDescriptionprotected final ConstantsManager
protected final FieldLayoutManager
protected String
protected String
protected Issue
protected final IssueManager
protected String
protected final PermissionManager
protected final RendererManager
protected static final String
protected static final int
protected static final int
protected static final int
protected static final int
protected String
protected final WorkflowManager
Fields inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
ISSUE_NOT_FOUND_RESULT, log, PERMISSION_VIOLATION_RESULT, request, RETURN_URL_PARAMETER, savedFilters, SECURITY_BREACH_RESULT
Fields inherited from class webwork.action.ActionSupport
command, errorMap, errorMessages
Fields inherited from interface webwork.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractConvertIssue
(IssueConversionService service, IssueManager issueManager, FieldLayoutManager fieldLayoutManager, ConstantsManager constantsManager, WorkflowManager workflowManager, RendererManager rendererManager, IssueFactory issueFactory, PermissionManager permissionManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addI18nError
(JiraServiceContext context, String fieldName, String i18nKey) Convenience method for adding internationalized errors to the error collectionprotected void
addI18nError
(JiraServiceContext context, String fieldName, String i18nKey, String param) Convenience method for adding internationalized errors to the error collectionprotected void
addI18nErrorMessage
(JiraServiceContext context, String i18nKey) Conveniece method for adding internationalized error messages to the error collectionprotected void
addI18nErrorMessage
(JiraServiceContext context, String i18nKey, String param) Convenience method for adding internationalized error messages to the error collectiondoCancel()
Handles the request to cancel the issue conversion wizard.Last step of this wizard.Second step of this wizard.Third step of this wizard.First step of this wizard.Fourth step of this wizard.abstract String
Prefix used for jsps Actions.abstract Collection
Gets a collection ofIssueType
that are the available target Issue Types.protected ConvertIssueBean
getBean()
Retrieves the wizard bean from the session.Returns a list ofFieldLayoutItem
that need values for conversion.int
Utility method used by convertissuetosubtask-updateworkflow.jsp and convertissuetosubtask-confirm-part1.jsp
Retrieve and return current workflow for selected issuegetFieldHtml
(FieldLayoutItem fieldLayoutItem) Gets the create HTML for the given FieldLayoutItem.getFieldName
(Field field) Utility method used by convertissuetosubtask-confirm.jspgetGuid()
getId()
getIssue()
Retrieves the worked on issue based on the Issue id.getNewViewHtml
(OrderableField field) Gets the ne view of the field after values have been updatedgetOldViewHtml
(OrderableField field) Gets the old view of the field before updateabstract String
Prefix used for i18n properties.Returns a list ofOrderableField
s that should be removed from the target issue.Get Target Issue with Security Level set to null if it is needed.protected MutableIssue
Get the issue with updated Issue type and status.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.getTextKey
(String key) Utility method to get appropriate key for property.Gets the target issue with new values set on issueprotected 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 GUIDboolean
Whether or not the issue's status is valid in the workflowprotected void
setCurrentStep
(int step) void
void
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 validationprotected boolean
Returns true is the specified parameter was passed via request parameter valueMethods inherited from class com.atlassian.jira.web.action.JiraWebActionSupport
addError, addErrorCollection, addErrorMessage, addErrorMessageByKeyIfAbsent, addErrorMessageIfAbsent, addErrorMessages, addErrorMessages, addErrors, addIllegalArgumentException, addMessageToResponse, addReason, addReasons, checkIfUrlIsAllowed, execute, forceRedirect, getActionName, getAdministratorContactLink, getApplicationProperties, getAuthorizationSupport, getComponentInstanceOfType, getConglomerateCookieValue, getConstantsManager, getDateFormat, getDateTimeFormat, getDateTimeFormatter, getDefaultResourceBundle, getDescTranslation, getDescTranslation, getDmyDateFormatter, getEmptyResponse, getErrorMessages, getErrors, getField, getFlushedErrorMessages, getGlobalPermissionManager, getHint, getHintManager, getHttpRequest, getHttpResponse, getHttpSession, getI18nHelper, getJiraContactHelper, getJiraServiceContext, getKeysForPrefix, getLanguage, getLocale, getLoggedInApplicationUser, getLoggedInUser, getNameTranslation, getNameTranslation, getOfBizDelegator, getOutboundWhitelistProvider, getOutlookDate, getPermissionManager, getProjectManager, getRandomHint, getReasons, getRedirect, getRedirect, getRedirectSanitiser, getRequestSourceType, getResourceBundle, getResult, getReturnUrl, getReturnUrlForCancelLink, getSearchSortDescriptions, getSelectedProject, getSelectedProjectObject, getServerId, getServletContext, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTimeFormat, getUnescapedText, getUntransformedRawText, getUriValidator, getUserFullName, getUserManager, getUserPreferences, getUserProjectHistoryManager, getVersionManager, getWebworkStack, getWebworkStack, getXsrfToken, hasAnyErrors, hasErrorMessage, hasErrorMessageByKey, hasGlobalPermission, hasGlobalPermission, hasIssuePermission, hasIssuePermission, hasIssuePermission, hasPermission, hasProjectPermission, hasProjectPermission, htmlEncode, insertContextPath, isAdministrator, isIndexing, isInlineDialogMode, isKeyDefined, isSystemAdministrator, isUserExists, isUserExistsByKey, isUserExistsByName, removeKeyOrAddError, returnComplete, returnComplete, returnCompleteWithInlineRedirect, returnCompleteWithInlineRedirectAndMsg, returnCompleteWithInlineRedirectAndMsg, returnMsgToUser, returnMsgToUser, setConglomerateCookieValue, setInline, setReasons, setReturnUrl, setSelectedProjectId, tagMauEventWithApplication, tagMauEventWithProject, urlEncode
Methods inherited from class webwork.action.ActionSupport
addError, addErrorMessage, doExecute, doValidation, getCommandName, 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 webwork.action.CommandDriven
getCommandName, setCommand
Methods inherited from interface com.atlassian.jira.util.ErrorCollection
addError, addErrorMessage, setErrorMessages
-
Field Details
-
SECURITY_BREACH
- See Also:
-
issueManager
-
constantsManager
-
fieldLayoutManager
-
workflowManager
-
permissionManager
-
rendererManager
-
STEP_1
protected static final int STEP_1- See Also:
-
STEP_2
protected static final int STEP_2- See Also:
-
STEP_3
protected static final int STEP_3- See Also:
-
STEP_4
protected static final int STEP_4- See Also:
-
issue
-
id
-
issueType
-
targetStatusId
-
guid
-
-
Constructor Details
-
AbstractConvertIssue
protected AbstractConvertIssue(IssueConversionService service, IssueManager issueManager, FieldLayoutManager fieldLayoutManager, ConstantsManager constantsManager, WorkflowManager workflowManager, RendererManager rendererManager, IssueFactory issueFactory, PermissionManager permissionManager)
-
-
Method Details
-
doDefault
- Overrides:
doDefault
in classwebwork.action.ActionSupport
-
doStartWizard
First step of this wizard. Gets the issue by given id. In case of error returnsAction.ERROR
view. Checks user's permission, if denied returnsSECURITY_BREACH
view. Checks if given issue is convertable, if not returnsAction.ERROR
view. ReturnsAction.SUCCESS
view- Returns:
- view
-
doSetIssueType
Second step of this wizard. Gets the issue by given id. In case of error returnsAction.ERROR
view. Checks user's permission, if denied returnsSECURITY_BREACH
view. Checks if given issue is convertable and validates other values, if not returnsAction.ERROR
view. Returns view to update workflow or update fields view- Returns:
- view
-
doSetWorkflowStatus
Third step of this wizard. Gets the issue by given id. In case of error returnsAction.ERROR
view. Checks user's permission, if denied returnsSECURITY_BREACH
view. Checks if given issue is convertable and valid values were entered, if not returnsAction.ERROR
view. ReturnsAction.SUCCESS
view- Returns:
- view
-
doUpdateFields
Fourth step of this wizard. Gets the issue by given id. In case of error returnsAction.ERROR
view. Checks user's permission, if denied returnsSECURITY_BREACH
view. Checks if given issue is convertable and valid values were entered, if not returnsAction.ERROR
view. ReturnsAction.SUCCESS
view- Returns:
- view
-
doConvert
Last step of this wizard. Gets the issue by given id. In case of error returnsAction.ERROR
view. Checks user's permission, if denied returnsSECURITY_BREACH
view. Checks if given issue is convertable and valid values were entered, if not returnsAction.ERROR
view. Executes the conversion. Returns to the issue- Returns:
- view
-
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
Checks for valid state, populates the bean with values from parameters and updates bean with new GUID- Parameters:
context
- jira service context
-
validateStep1
Validates the first step of the wizard, subclasses can override to extend validation- Parameters:
context
- jira service context
-
getIssue
Retrieves the worked on issue based on the Issue id.- Returns:
- Current Issue
-
wasPassed
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
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
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
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
Gets the target issue with new values set on issue- Returns:
- Issue with all fields updated and hidden field removed
-
getConvertFieldLayoutItems
Returns a list ofFieldLayoutItem
that need values for conversion.- Returns:
- list of
FieldLayoutItem
-
getRemoveFields
Returns a list ofOrderableField
s that should be removed from the target issue.- Returns:
- a list of
OrderableField
s that should be removed from the target issue.
-
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
Utility method used by convertissuetosubtask-confirm.jsp- Parameters:
field
- filed- Returns:
- field name
-
getOldViewHtml
Gets the old view of the field before update- Parameters:
field
- Field to display- Returns:
- HTML to insert
-
getNewViewHtml
Gets the ne view of the field after values have been updated- Parameters:
field
- Field to display- Returns:
- HTML to insert
-
getFieldHtml
Gets the create HTML for the given FieldLayoutItem.- Parameters:
fieldLayoutItem
- Layoutitem describing field to display- Returns:
- HTML to insert
-
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
-
getId
-
setId
-
getParentIssueKey
-
getTargetStatusId
-
setTargetStatusId
-
getIssuetype
-
setIssuetype
-
getGuid
-
setGuid
-
getCurrentStep
public int getCurrentStep() -
setCurrentStep
protected void setCurrentStep(int step) -
addI18nErrorMessage
Conveniece method for adding internationalized error messages to the error collection- Parameters:
context
- jira service contexti18nKey
- message key
-
addI18nErrorMessage
Convenience method for adding internationalized error messages to the error collection- Parameters:
context
- jira service contexti18nKey
- message keyparam
- parameter value
-
addI18nError
Convenience method for adding internationalized errors to the error collection- Parameters:
context
- jira service contextfieldName
- field namei18nKey
- 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 contextfieldName
- field namei18nKey
- message keyparam
- parameter value
-
getTextKey
Utility method to get appropriate key for property.- Parameters:
key
- to get- Returns:
- key prefixed with action specific prefix.
-
getIssuePath
-
getActionPrefix
Prefix used for jsps Actions. Allows the same jsp to be used for different actions- Returns:
- subclass specific action prefix
-
getPropertiesPrefix
Prefix used for i18n properties. Allows the same jsp to be used for different actions- Returns:
- subclass specific properties prefix
-
getAvailableIssueTypes
Gets a collection ofIssueType
that are the available target Issue Types.- Returns:
- a collection of
IssueType
-
initExtraFields
Allows subclasses to set and init own fields. E.g. ConvertIssueToSubTask sets parent id.- Parameters:
bean
- bean that holds params.context
- jira service context.
-