Class JiraWebActionSupport
- All Implemented Interfaces:
ErrorCollection
,I18nHelper
,HttpServletVariables
,AuthorizationSupport
,Serializable
,webwork.action.Action
,webwork.action.CommandDriven
,webwork.action.IllegalArgumentAware
- Direct Known Subclasses:
A11yPersonalSettings
,AboutPage
,AbstractConfigureFieldLayout
,AbstractConstantAction
,AbstractConvertIssue
,AbstractDashboardAdministration
,AbstractEditConfigurationItemAction
,AbstractEditFieldLayoutItem
,AbstractEditFieldLayoutSchemeAction
,AbstractFieldScreenSchemeAction
,AbstractManagableOptionsAction
,AbstractPage
,AbstractPermissionCheckAction
,AbstractPrioritySchemesAction
,AbstractProjectImportProgress
,AbstractProjectImportUsersMissing
,AbstractProjectRole
,AbstractRoleActorAction
,AbstractSchemeAware
,AbstractSchemeAwareAction
,AbstractSetupAction
,AbstractTrustedApplicationAction
,AbstractWorkflowAction
,AbstractWorkflowDraftResultAction
,AcknowledgeTask
,AddFieldConfiguration
,AddFieldConfigurationScheme
,AddIssueTypeScreenScheme
,AddIssueTypeScreenScreenSchemeAssociation
,AddIssueTypeToFieldConfigurationAssociation
,AddNewIssueTypeToScheme
,AddPortalPage
,AddUser
,AdjustFavourite
,AdvancedApplicationProperties
,AllUsersRememberMeCookies
,AnonymizeUser
,ApplicationAccess
,AssociatedProjectsForCustomField
,AssociatedScreensForCustomField
,AssociateFieldToScreens
,BasicJiraCreditsPage
,BrowseArchivedIssues
,BrowseProjects
,BulkEditUserGroups
,CantBrowseCreatedIssue
,ChangePassword
,ClearRememberMeCookies
,CloneWorkflow
,CommittedResponseExceptionThrowingAction
,ConfigureCrowdServer
,ConfigureCustomField
,ConfigureField
,ConfigureFieldLayoutScheme
,ConfigureFieldScreen
,ConfigureIssueTypeScreenScheme
,ConfigurePortalPages
,ConfirmNewInstallationWithOldLicense
,ContactAdministrators
,CopyFieldLayout
,CreateDraftWorkflow
,CurrentUsersList
,Dashboard
,DeleteCustomField
,DeleteJobRunner
,DeleteLinkType
,DeletePortalPage
,DisableSubTasks
,EditAnnouncementBanner
,EditAvatarSettings
,EditCrowdApplication
,EditCustomField
,EditDarkFeatures
,EditDefaultDashboard
,EditFieldLayout
,EditFieldLayoutItemRendererConfirmation
,EditFieldScreen
,EditIssueTypeScreenScheme
,EditLevel
,EditLinkType
,EditListener
,EditNestedGroups
,EditPortalPage
,EditProfile
,EditService
,EditSubTaskIssueTypes
,EditWorkflowDispatcher
,EditWorkflowScheme
,EmailTemplatesSettings
,Error404
,FavouriteFilters
,FilterPickerPopup
,FirstUseFlowAction
,ForgotLoginDetails
,IconPicker
,ImportResult
,ImportWorkflow
,IndexOptimize
,IntegrityChecker
,IssuePicker
,JiraWizardActionSupport
,JmxMonitoringAction
,LandingPage
,LeaveAdmin
,ListEventTypes
,Logout
,MailQueueAdmin
,ManageCacheInstrumentation
,ManageConfigurationScheme
,ManageSubTasks
,ManageTerminology
,MigratePrioritySchemeAction
,MigratePrioritySchemeProgress
,MyJiraHome
,PreparedReferenceAction
,ProjectActionSupport
,ProjectEmail
,ProjectImportResultsAction
,ProjectImportSelectBackup
,ProjectImportSelectProject
,ProjectImportSummary
,ProjectPermissions
,PulpRenderAction
,RecentIssueHistory
,ReferenceAction
,ReferenceComponentAction
,ReferenceComponentImportAction
,ReferenceModuleTypeAction
,ReferenceResourceAction
,ReferenceSoyAction
,ReleaseNote
,ReplicationSettings
,ResetFailedLoginCount
,ResetPassword
,ResourcePhaseCheckpointsAction
,RestoreDefaultDashboard
,SchedulerAdmin
,SelectFieldLayoutScheme
,SelectIssueTypeScreenScheme
,SelectProjectCategory
,SendBulkMail
,ServiceExecutor
,SessionTimeoutMessage
,ShowConstantsHelp
,ShowTimeTrackingHelp
,Signup
,SiteDarkFeatures
,TerminologyHelp
,TimeTrackingAdmin
,TranslateCustomField
,UpdateMyJiraHome
,UpdateUserPreferences
,VersionAction
,ViewCacheDetails
,ViewCachesByRequest
,ViewCacheStats
,ViewCustomFields
,ViewDefaultProjectRoleActors
,ViewEventAction
,ViewFieldLayouts
,ViewFieldScreens
,ViewGroup
,ViewInstrumentation
,ViewIssueTypeScreenSchemes
,ViewKeyboardShortcuts
,ViewLinkTypes
,ViewListeners
,ViewLogging
,ViewPrioritySchemesForPriority
,ViewProjectRoleActors
,ViewProjectRoles
,ViewProjects
,ViewSchemes
,ViewSchemes
,ViewServices
,ViewSystemFields
,ViewSystemInfo
,ViewTrustedApplications
,ViewUpgrades
,ViewUris
,ViewUserHover
,ViewUserProjectRoles
,ViewWorkflowsForStatus
,ViewWorkflowXml
,WebSudoAuthenticate
,WikiRendererHelpAction
,XsrfErrorAction
When adding to this class, be sure that what you are adding is used by a large number of actions - otherwise add it to a sub class of this.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents a type of message that the browser will display after the next page load.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 TypeFieldDescriptionstatic final String
protected final org.apache.log4j.Logger
static final String
protected javax.servlet.http.HttpServletRequest
Deprecated.static final String
protected Collection
static final String
Fields inherited from class webwork.action.ActionSupport
command, errorMap, errorMessages
Fields inherited from interface webwork.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addError
(String field, String message, ErrorCollection.Reason reason) Add a field-specific error message.void
addErrorCollection
(ErrorCollection errors) Populate this ErrorCollection with general and field-specific errors.void
addErrorMessage
(String message, ErrorCollection.Reason reason) Add error message relating to system state (not field-specific), and a reason.protected final void
addErrorMessageByKeyIfAbsent
(String errorMsgKey) protected final void
addErrorMessageIfAbsent
(String errorMsg) void
addErrorMessages
(Collection<String> errorMessages) Append new error messages to those already collected.void
addErrorMessages
(webwork.dispatcher.ActionResult aResult) void
Append new field-specific errors to those already collected.void
addIllegalArgumentException
(String fieldName, IllegalArgumentException e) Override this method from ActionSupport.protected void
addMessageToResponse
(String msg, String type, boolean closeable, String target) This will populate the the custom Atlassian header with the details of a pop-up message.void
addReason
(ErrorCollection.Reason reason) Add a reason why the function has not been performed.void
addReasons
(Set<ErrorCollection.Reason> reasons) Add reasons why the function has not been performed.boolean
execute()
protected String
forceRedirect
(String redirect) This method will force a server redirect, with no security checks.final String
Get the link, with Internationalised text for contacting the administrators of JIRA.protected AuthorizationSupport
protected <T> T
getComponentInstanceOfType
(Class<T> clazz) This can be called to get a component from theComponentAccessor
.getConglomerateCookieValue
(String cookieName, String key) Retrieve the value from a conglomerate Cookie from the request.Returns a DateTimeFormatter that can be used to format times and dates in the user's time zone usingDateTimeStyle.RELATIVE
.Returns the defaultResourceBundle
within JIRA, which does not include translations provided by plugins.getDescTranslation
(IssueConstant issueConstant) Deprecated.UseConstantsManager
instead.getDescTranslation
(org.ofbiz.core.entity.GenericValue issueConstantGV) Deprecated.UseConstantsManager
instead.Returns a DateTimeFormatter that can be used to format dates in the user's time zone usingDateTimeStyle.DATE
.Returns an empty response code (204)Get all non field-specific error messages.Get all field-specific errors.Get error messages, then get rid of them.protected GlobalPermissionManager
final Hint
protected final HintManager
javax.servlet.http.HttpServletRequest
javax.servlet.http.HttpServletResponse
javax.servlet.http.HttpSession
protected I18nHelper
Provides a service context with the current user which contains this action as itsErrorCollection
.getKeysForPrefix
(String prefix) Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.Deprecated.UsegetLoggedInUser()
.getNameTranslation
(IssueConstant issueConstant) Deprecated.UseConstantsManager
instead.getNameTranslation
(org.ofbiz.core.entity.GenericValue issueConstantGV) Deprecated.UseConstantsManager
instead.protected OutboundWhitelistProvider
Deprecated.UsegetDateTimeFormatter()
instead.protected PermissionManager
final Hint
A set of well known reasons why the function has not been performed.getRedirect
(String defaultUrl) Redirects to the value ofgetReturnUrl()
, falling back todefaultUrl
if thereturnUrl
is not set.getRedirect
(String defaultUrl, boolean allowUnsafeRedirect) Redirects to the value ofgetReturnUrl()
, falling back todefaultUrl
if thereturnUrl
is not set.protected final RedirectSanitiser
Returns a RedirectSanitiser implementation.Returns an enum type representing how the action was invoked.Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.Get a definitive result.The cancel links should not included the selectedIssueId, otherwise when returning to the issue navigator an issue updated notification will be shown.getSearchSortDescriptions
(SearchRequest searchRequest) Gets the last viewed project that the user visited and still has permission to see.Gets the last viewed project that the user visited and still has permission to see.javax.servlet.ServletContext
Called to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be found.Called to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be foundgetText
(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6) Called to return the formatted text of the specified i18n key or the key itself if no message can be foundgetText
(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7) Called to return the formatted text of the specified i18n key or the key itself if no message can be foundgetText
(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7, Object value8) Called to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be foundCalled to return the formatted text of the specified i18n key or the key itself if no message can be foundgetText
(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7) Called to return the formatted text of the specified i18n keygetText
(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9) Called to return the formatted text of the specified i18n key or the key itself if no message can be foundgetUnescapedText
(String key) Called to return the un-formatted text of the specified i18n key or the key itself if no message can be foundSame asI18nHelper.getUnescapedText(String)
but does not apply anyTranslationTransform
s.getUserFullName
(String username) com.atlassian.core.user.preferences.Preferences
protected UserProjectHistoryManager
For debugging JSPs; prints the webwork stack.getWebworkStack
(String selected) For debugging JSPs; prints the webwork stack, highlighting the specified node.boolean
Whether any errors (of any type - field-specific or otherwise) have been collected.protected final boolean
hasErrorMessage
(String errorMsg) protected final boolean
hasErrorMessageByKey
(String errorMsgKey) boolean
hasGlobalPermission
(GlobalPermissionKey globalPermissionKey) Returns true if the logged in user has the given global permission.boolean
hasGlobalPermission
(String permissionKey) Returns true if the logged in user has the given global permission.boolean
hasIssuePermission
(int permissionsId, Issue issue) Returns true if the logged in user has the given permission type on the given Issue.boolean
hasIssuePermission
(ProjectPermissionKey projectPermissionKey, Issue issue) Returns true if the logged in user has the given permission on the given Issue.boolean
hasIssuePermission
(String permissionKey, Issue issue) Returns true if the logged in user has the given permission type on the given Issue.boolean
hasPermission
(int permissionsId) Deprecated.boolean
hasProjectPermission
(int permissionsId, Project project) boolean
hasProjectPermission
(ProjectPermissionKey projectPermissionKey, Project project) Returns true if the logged in user has the given permission on the given project.htmlEncode
(String encodeMe) Convenience instance method to call static utility from webwork EL.protected String
insertContextPath
(String url) Prepends the context path to the URL if it begins with a forward slash (this is commonly used for redirects within a JIRA instance).boolean
boolean
boolean
This returns true if the action has been invoked as an inline dialog.boolean
isKeyDefined
(String key) For the given key, checks whether such a key is defined in the locale context represented by this helper instance.boolean
boolean
isUserExists
(String username) Deprecated.UseisUserExistsByName(String)
orisUserExistsByKey(String)
instead, as appropriate.boolean
isUserExistsByKey
(String userkey) boolean
isUserExistsByName
(String username) protected void
removeKeyOrAddError
(Map params, String key, String messageKey) Checks if descriptorParams contains key and removes it, otherwise adds the error message with the given message key.returnComplete
(String url) protected final String
This will return success response with body containing url to redirect.protected String
returnCompleteWithInlineRedirectAndMsg
(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, String target) This will redirect likereturnCompleteWithInlineRedirect(String)
, and will also populate the response with the details of a pop-up message to be displayed on the redirected page.protected String
returnCompleteWithInlineRedirectAndMsg
(String url, String msg, String type, boolean closeable, String target) Deprecated.since 5.1.protected String
returnMsgToUser
(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, String target) This will redirect likereturnComplete()
, and will also populate the response with the details of a pop-up message to be displayed on the redirected page.protected String
returnMsgToUser
(String url, String msg, String type, boolean closeable, String target) Deprecated.since 5.1.void
setConglomerateCookieValue
(String cookieName, String key, String value) Set the value key/value pair in a conglomerate Cookie.void
setInline
(boolean inline) This is the web parameter setter for invoking an action as an inline dialogvoid
setReasons
(Set<ErrorCollection.Reason> reasons) Set reasons why the function has not been performed.void
setReturnUrl
(String returnUrl) void
protected void
tagMauEventWithApplication
(MauApplicationKey applicationKey) protected void
tagMauEventWithProject
(Project project) Encodes the given string intoapplication/x-www-form-urlencoded
format, using the JIRA encoding scheme to obtain the bytes for unsafe characters.Methods inherited from class webwork.action.ActionSupport
addError, addErrorMessage, doDefault, 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
-
log
protected final org.apache.log4j.Logger log -
RETURN_URL_PARAMETER
- See Also:
-
PERMISSION_VIOLATION_RESULT
- See Also:
-
SECURITY_BREACH_RESULT
- See Also:
-
ISSUE_NOT_FOUND_RESULT
- See Also:
-
request
protected javax.servlet.http.HttpServletRequest requestDeprecated.since 6.0 - usegetHttpRequest()
instead.- See Also:
-
savedFilters
-
-
Constructor Details
-
JiraWebActionSupport
protected JiraWebActionSupport()
-
-
Method Details
-
getLoggedInUser
@IncompatibleReturnType(since="7.0", was="com.atlassian.crowd.embedded.api.User") public ApplicationUser getLoggedInUser()- Returns:
- The logged-in user.
-
getLoggedInApplicationUser
Deprecated.UsegetLoggedInUser()
. Since v7.0- Returns:
- The logged in user.
-
getXsrfToken
-
getHttpRequest
public javax.servlet.http.HttpServletRequest getHttpRequest()- Specified by:
getHttpRequest
in interfaceHttpServletVariables
- Returns:
- the
HttpServletRequest
in play - See Also:
-
getHttpSession
public javax.servlet.http.HttpSession getHttpSession()- Specified by:
getHttpSession
in interfaceHttpServletVariables
- Returns:
- the
HttpSession
in play - See Also:
-
getHttpResponse
public javax.servlet.http.HttpServletResponse getHttpResponse()- Specified by:
getHttpResponse
in interfaceHttpServletVariables
- Returns:
- the
HttpServletResponse
in play - See Also:
-
getServletContext
public javax.servlet.ServletContext getServletContext()- Specified by:
getServletContext
in interfaceHttpServletVariables
- Returns:
- the
ServletContext
of the JIRA web application - See Also:
-
getApplicationProperties
-
getUriValidator
-
getGlobalPermissionManager
-
getPermissionManager
-
getUserProjectHistoryManager
-
getConstantsManager
-
getProjectManager
-
getVersionManager
-
getOutlookDate
Deprecated.UsegetDateTimeFormatter()
instead. Since v5.0. -
getDateTimeFormatter
Returns a DateTimeFormatter that can be used to format times and dates in the user's time zone usingDateTimeStyle.RELATIVE
.- Returns:
- a DateTimeFormatter
-
getDmyDateFormatter
Returns a DateTimeFormatter that can be used to format dates in the user's time zone usingDateTimeStyle.DATE
.- Returns:
- a DateTimeFormatter
-
getJiraContactHelper
-
getUserManager
-
getAdministratorContactLink
Get the link, with Internationalised text for contacting the administrators of JIRA. This link is present on many pages across the bredth of JIRA and so centralised here.- Returns:
- html String of the contact administrators link.
-
getHintManager
-
getAuthorizationSupport
-
getOutboundWhitelistProvider
-
getRedirect
Redirects to the value ofgetReturnUrl()
, falling back todefaultUrl
if thereturnUrl
is not set. This method clears thereturnUrl
. If there are any errors, this method returns "ERROR". If no errors are reported, NONE is returned. If this method is called as if it were non-web, it returns SUCCESS.If the URL starts with '/' it is interpreted as context-relative.
Off-site redirects
Starting from JIRA 6.0, this method will not redirect to a URL that is considered "unsafe" as perRedirectSanitiser.makeSafeRedirectUrl(String)
. UsegetRedirect(String, boolean)
to allow unsafe redirects for URLs that do not contain possibly malicious user input.- Parameters:
defaultUrl
- default URL to redirect to- Returns:
- either ERROR, SUCCESS or NONE as defined in
Action
- See Also:
-
getRedirect
Redirects to the value ofgetReturnUrl()
, falling back todefaultUrl
if thereturnUrl
is not set. This method clears thereturnUrl
. If there are any errors, this method returns "ERROR". If no errors are reported, NONE is returned. If this method is called as if it were non-web, it returns SUCCESS. If the URL starts with '/' it is interpreted as context-relative.If
allowUnsafeRedirect
is true, this method will not perform validation on the value ofreturnUrl
ordefaultUrl
. This can introduce serious security problems, so use with care. In particular, you should only use use this method ifdefaultUrl
has already been sanitised (via whitelisting).It might
ServletForwarder.forwardSafely(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.net.URI)
instead of redirecting. If blocked by any exportedForwardAuthorizer
OSGi service, it will fall back to redirecting.- Parameters:
defaultUrl
- default URL to redirect toallowUnsafeRedirect
- whether to allow unsafe redirects (e.g.javascript:
or off-site URLs).- Returns:
- either ERROR, SUCCESS or NONE as defined in
Action
- Since:
- v5.1.5
- See Also:
-
forceRedirect(String)
ServletForwarder.forwardSafely(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.net.URI)
ForwardAuthorizer
-
forceRedirect
This method will force a server redirect, with no security checks. It doesn't clear the return URL and will always go to the redirect URL. For security reasons, prefergetRedirect(String)
, which checks that the redirect URL is safe.- Parameters:
redirect
- redirect URL- Returns:
Action.NONE
. It'll just redirect to where you've specified- See Also:
-
hasPermission
public boolean hasPermission(int permissionsId) Deprecated.UsehasGlobalPermission(com.atlassian.jira.permission.GlobalPermissionKey)
instead. Since v6.4.Returns true if the logged in user has the given permission type.- Specified by:
hasPermission
in interfaceAuthorizationSupport
- Parameters:
permissionsId
- the permission type- Returns:
- true if the logged in user has the given permission type.
-
hasGlobalPermission
Description copied from interface:AuthorizationSupport
Returns true if the logged in user has the given global permission.This method is intended to be used in Java code. If you are using JSP / Velocity / Soy Templates, it is probably easier to call
AuthorizationSupport.hasGlobalPermission(String)
instead.- Specified by:
hasGlobalPermission
in interfaceAuthorizationSupport
- Parameters:
globalPermissionKey
- the permission to check- Returns:
- true if the logged in user has the given global permission.
- See Also:
-
hasGlobalPermission
Description copied from interface:AuthorizationSupport
Returns true if the logged in user has the given global permission.This method is intended to be used in JSP / Velocity / Soy Templates. If you are using Java directly, it is recommended to call
AuthorizationSupport.hasGlobalPermission(com.atlassian.jira.permission.GlobalPermissionKey)
instead.Note that this method takes a Global Permission Key, which is a different value to the old "permission name" that some previous methods would accept - see
GlobalPermissionKey
for correct values of the system permissions.- Specified by:
hasGlobalPermission
in interfaceAuthorizationSupport
- Parameters:
permissionKey
- the permission to check- Returns:
- true if the logged in user has the given global permission.
- See Also:
-
hasIssuePermission
Description copied from interface:AuthorizationSupport
Returns true if the logged in user has the given permission type on the given Issue.This method is intended for use in Velocity templates / JSPs etc. Within Java code you should prefer the method that takes a ProjectPermissionKey.
Note that this method takes a Permission Key, which is a different value to the old "permission name" that some previous methods would accept - see
ProjectPermissions
for correct values of the system permissions.- Specified by:
hasIssuePermission
in interfaceAuthorizationSupport
- Parameters:
permissionKey
- the permission key as a Stringissue
- the Issue- Returns:
- true if the logged in user has the given permission type on the given Issue.
- See Also:
-
hasIssuePermission
Description copied from interface:AuthorizationSupport
Returns true if the logged in user has the given permission type on the given Issue.- Specified by:
hasIssuePermission
in interfaceAuthorizationSupport
- Parameters:
permissionsId
- the permission typeissue
- the Issue- Returns:
- true if the logged in user has the given permission type on the given Issue.
-
hasIssuePermission
Description copied from interface:AuthorizationSupport
Returns true if the logged in user has the given permission on the given Issue.- Specified by:
hasIssuePermission
in interfaceAuthorizationSupport
- Parameters:
projectPermissionKey
- the permission to checkissue
- the Issue- Returns:
- true if the logged in user has the given permission on the given Issue.
- See Also:
-
hasProjectPermission
Deprecated.Returns true if the logged in user has the given permission type on the given Project.- Specified by:
hasProjectPermission
in interfaceAuthorizationSupport
- Parameters:
permissionsId
- the permission typeproject
- the Project- Returns:
- true if the logged in user has the given permission type on the given Project.
-
hasProjectPermission
Description copied from interface:AuthorizationSupport
Returns true if the logged in user has the given permission on the given project.- Specified by:
hasProjectPermission
in interfaceAuthorizationSupport
- Parameters:
projectPermissionKey
- the permission to checkproject
- the project- Returns:
- true if the logged in user has the given permission on the given Issue.
-
isSystemAdministrator
public boolean isSystemAdministrator() -
isAdministrator
public boolean isAdministrator() -
isUserExists
Deprecated.UseisUserExistsByName(String)
orisUserExistsByKey(String)
instead, as appropriate. Since v6.0.Old name forisUserExistsByName(String)
- Parameters:
username
- the username to check- Returns:
true
if the username is associated with an existing user;false
otherwise
-
isUserExistsByName
-
isUserExistsByKey
-
getUserFullName
-
addErrorCollection
Description copied from interface:ErrorCollection
Populate this ErrorCollection with general and field-specific errors.- Specified by:
addErrorCollection
in interfaceErrorCollection
- Parameters:
errors
- ErrorCollection whose errors/messages we obtain.
-
addError
Description copied from interface:ErrorCollection
Add a field-specific error message.- Specified by:
addError
in interfaceErrorCollection
- Parameters:
field
- Field name, eg. "assignee"message
- Error message.reason
- Reason for the error.
-
addErrorMessage
Description copied from interface:ErrorCollection
Add error message relating to system state (not field-specific), and a reason.- Specified by:
addErrorMessage
in interfaceErrorCollection
- Parameters:
message
- Error message.reason
- Reason for the error.
-
addReason
Description copied from interface:ErrorCollection
Add a reason why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
addReason
in interfaceErrorCollection
- Parameters:
reason
- a well known reasons why the function has not been performed.
-
addReasons
Description copied from interface:ErrorCollection
Add reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
addReasons
in interfaceErrorCollection
- Parameters:
reasons
- a set of well known reasons why the function has not been performed.
-
setReasons
Description copied from interface:ErrorCollection
Set reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
setReasons
in interfaceErrorCollection
- Parameters:
reasons
- a set of well known reasons why the function has not been performed.
-
getReasons
Description copied from interface:ErrorCollection
A set of well known reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
getReasons
in interfaceErrorCollection
- Returns:
- a set of well known reasons why the function has not been performed.
-
getField
-
getSearchSortDescriptions
-
getNameTranslation
Deprecated.UseConstantsManager
instead. Since v6.0. -
getNameTranslation
Deprecated.UseConstantsManager
instead. Since v6.0. -
getDescTranslation
Deprecated.UseConstantsManager
instead. Since v6.0. -
getDescTranslation
Deprecated.UseConstantsManager
instead. Since v6.0. -
getReturnUrl
-
getReturnUrlForCancelLink
The cancel links should not included the selectedIssueId, otherwise when returning to the issue navigator an issue updated notification will be shown.- Returns:
- the returnUrl with selectedIssueId parameter stripped out.
-
setReturnUrl
-
getFlushedErrorMessages
Description copied from interface:ErrorCollection
Get error messages, then get rid of them.- Specified by:
getFlushedErrorMessages
in interfaceErrorCollection
- Returns:
- The (now cleared) error messages.
-
getLanguage
- Throws:
IOException
-
getSelectedProject
Gets the last viewed project that the user visited and still has permission to see.- Returns:
- the last project the user visited.
- See Also:
-
getSelectedProjectObject
Gets the last viewed project that the user visited and still has permission to see. This is a legacy synonym forgetSelectedProject()
- Returns:
- the last project the user visited.
- See Also:
-
setSelectedProjectId
-
getDateFormat
-
getDateTimeFormat
-
getTimeFormat
-
getWebworkStack
For debugging JSPs; prints the webwork stack, highlighting the specified node. Eg. called with: <webwork:property value="/webworkStack('../../..')" escape="false"/>- Parameters:
selected
- selected value in the webwork stack- Returns:
- HTML string of the webwork stack
-
getWebworkStack
For debugging JSPs; prints the webwork stack. Eg. called with: <webwork:property value="/webworkStack" escape="false"/>- Returns:
- HTML string of the webwork stack
-
getServerId
-
getJiraServiceContext
Provides a service context with the current user which contains this action as itsErrorCollection
.- Returns:
- the JiraServiceContext.
-
htmlEncode
Convenience instance method to call static utility from webwork EL.- Parameters:
encodeMe
- a String to be HTML encoded.- Returns:
- the HTML encoded string.
-
urlEncode
Encodes the given string intoapplication/x-www-form-urlencoded
format, using the JIRA encoding scheme to obtain the bytes for unsafe characters.- Parameters:
encode
- the String to encode- Returns:
- a URL-encoded String
- See Also:
-
isInlineDialogMode
public boolean isInlineDialogMode()This returns true if the action has been invoked as an inline dialog. This changes the way that the action sends back its responses, namely when the action is submitted and completed- Returns:
- true if the action was invoked as an inline dialog
-
getRequestSourceType
Returns an enum type representing how the action was invoked.- Returns:
RequestSourceType
-
setInline
public void setInline(boolean inline) This is the web parameter setter for invoking an action as an inline dialog- Parameters:
inline
- true if the action should act as an inline dialog
-
returnComplete
-
returnComplete
-
checkIfUrlIsAllowed
-
getEmptyResponse
Returns an empty response code (204) -
returnCompleteWithInlineRedirect
This will return success response with body containing url to redirect. An appropriately configured client side control should perform redirect to the desired url.- Parameters:
url
- URL to redirect to- Returns:
- action mapping string
-
returnCompleteWithInlineRedirectAndMsg
protected String returnCompleteWithInlineRedirectAndMsg(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, @Nullable String target) This will redirect likereturnCompleteWithInlineRedirect(String)
, and will also populate the response with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client side control should perform the displaying of the message.- Parameters:
url
- URL to redirect tomsg
- message HTMLtype
- type of message.closeable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot- Returns:
- action mapping string
-
returnCompleteWithInlineRedirectAndMsg
protected String returnCompleteWithInlineRedirectAndMsg(String url, String msg, String type, boolean closeable, @Nullable String target) Deprecated.since 5.1. UsereturnCompleteWithInlineRedirectAndMsg(String, String, MessageType, boolean, String)
instead.This will redirect likereturnCompleteWithInlineRedirect(String)
, and will also populate the response with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client side control should perform the displaying of the message.- Parameters:
url
- URL to redirect tomsg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot- Returns:
- action mapping string
-
returnMsgToUser
@Deprecated protected String returnMsgToUser(String url, String msg, String type, boolean closeable, @Nullable String target) Deprecated.since 5.1. UsereturnMsgToUser(String, String, MessageType, boolean, String)
instead.This will redirect likereturnComplete()
, and will also populate the response with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client side control should perform the displaying of the message.- Parameters:
url
- URL to redirect to. Not used in dialogsmsg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot- Returns:
- action mapping string
-
returnMsgToUser
protected String returnMsgToUser(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, @Nullable String target) This will redirect likereturnComplete()
, and will also populate the response with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client side control should perform the displaying of the message.- Parameters:
url
- URL to redirect to. Not used in dialogsmsg
- message HTMLtype
- type of messagecloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot- Returns:
- action mapping string
-
insertContextPath
Prepends the context path to the URL if it begins with a forward slash (this is commonly used for redirects within a JIRA instance).- Parameters:
url
- a String containing a URL- Returns:
- a String with the context path prepended
-
addMessageToResponse
This will populate the the custom Atlassian header with the details of a pop-up message.- Parameters:
msg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot.
-
hasErrorMessage
-
hasErrorMessageByKey
-
addErrorMessageIfAbsent
-
addErrorMessageByKeyIfAbsent
-
tagMauEventWithApplication
-
tagMauEventWithProject
-
getHint
-
getRandomHint
-
getConglomerateCookieValue
Retrieve the value from a conglomerate Cookie from the request.- Parameters:
cookieName
- The name of the conglomerate cookiekey
- The key of the value- Returns:
- the value (or the empty-string if it did not exist)
-
setConglomerateCookieValue
Set the value key/value pair in a conglomerate Cookie.- Parameters:
cookieName
- The name of the conglomerate cookiekey
- The key of the valuevalue
- The value
-
getRedirectSanitiser
Returns a RedirectSanitiser implementation.- Returns:
- a RedirectSanitiser
-
getErrorMessages
Description copied from interface:ErrorCollection
Get all non field-specific error messages.- Specified by:
getErrorMessages
in interfaceErrorCollection
- Overrides:
getErrorMessages
in classwebwork.action.ActionSupport
- Returns:
- Collection of error Strings.
-
getErrors
Description copied from interface:ErrorCollection
Get all field-specific errors.- Specified by:
getErrors
in interfaceErrorCollection
- Overrides:
getErrors
in classwebwork.action.ActionSupport
- Returns:
- Map of String: String pairs, eg. {"assignee": "Assignee is required"}
-
getKeysForPrefix
Description copied from interface:I18nHelper
Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.- Specified by:
getKeysForPrefix
in interfaceI18nHelper
- Parameters:
prefix
- The prefix for i18n keys. May not be null- Returns:
- An immutable set of translation keys that start with the prefix specified.
-
getDefaultResourceBundle
Description copied from interface:I18nHelper
Returns the defaultResourceBundle
within JIRA, which does not include translations provided by plugins. For use cases where non-English translations are required, callI18nHelper.getResourceBundle()
instead.- Specified by:
getDefaultResourceBundle
in interfaceI18nHelper
- Returns:
- a non-null bundle
- See Also:
-
getUnescapedText
Description copied from interface:I18nHelper
Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getUnescapedText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n message- Returns:
- the un-formatted, translated, text or the key itself if no i18n message can be found
-
getUntransformedRawText
Description copied from interface:I18nHelper
Same asI18nHelper.getUnescapedText(String)
but does not apply anyTranslationTransform
s.- Specified by:
getUntransformedRawText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n message- Returns:
- the un-formatted text or the key itself if no i18n message can be found
-
isKeyDefined
Description copied from interface:I18nHelper
For the given key, checks whether such a key is defined in the locale context represented by this helper instance. Note that the actual translation may be in the 'fallback' default locale rather than the current locale.
The contract of this is method is correlated with
I18nHelper.getUntransformedRawText(String)
, whereby if this method returnsfalse
,I18nHelper.getUntransformedRawText(String)
will return the key provided as an argument, and if this method returnstrue
,I18nHelper.getUntransformedRawText(String)
will generally return the translation, which in some very unlikely cases may be equal to the key.- Specified by:
isKeyDefined
in interfaceI18nHelper
- Parameters:
key
- translation key- Returns:
true
, if any translation for such key exists,false
otherwise
-
getResourceBundle
Description copied from interface:I18nHelper
Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.- Specified by:
getResourceBundle
in interfaceI18nHelper
- Returns:
- a non-null bundle
- See Also:
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Overrides:
getText
in classwebwork.action.ActionSupport
- Parameters:
key
- the key of the i18n message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
public String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5) Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
public String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6) Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
public String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7) Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
public String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7) Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
public String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7, Object value8) Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the messagevalue8
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
public String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9) Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messagevalue1
- a value to be substituted into the messagevalue2
- a value to be substituted into the messagevalue3
- a value to be substituted into the messagevalue4
- a value to be substituted into the messagevalue5
- a value to be substituted into the messagevalue6
- a value to be substituted into the messagevalue7
- a value to be substituted into the messagevalue8
- a value to be substituted into the messagevalue9
- a value to be substituted into the message- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getText
Description copied from interface:I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found.The object passed in can be an array, a
List
} or a single parameter object. It will be then used as substitution parameters within the message.- Specified by:
getText
in interfaceI18nHelper
- Parameters:
key
- the key of the i18n messageparameters
- This can be an Array, aList
and Array or a single object parameter- Returns:
- the formatted text or the key itself if no i18n message can be found
-
getUserPreferences
public com.atlassian.core.user.preferences.Preferences getUserPreferences() -
getI18nHelper
- Returns:
- the
I18nHelper
associated with this action
-
getLocale
- Specified by:
getLocale
in interfaceI18nHelper
- Overrides:
getLocale
in classwebwork.action.ActionSupport
- Returns:
- the
Locale
that is associated with this I18nHelper
-
isIndexing
public boolean isIndexing() -
removeKeyOrAddError
Checks if descriptorParams contains key and removes it, otherwise adds the error message with the given message key.- Parameters:
params
- the map of parameterskey
- the param key to remove.messageKey
- the error.
-
execute
- Specified by:
execute
in interfacewebwork.action.Action
- Overrides:
execute
in classwebwork.action.ActionSupport
- Throws:
Exception
-
getActionName
- Overrides:
getActionName
in classwebwork.action.ActionSupport
- Returns:
- The name of this action - the unqualified class name.
-
getResult
Get a definitive result. ReturnsAction.ERROR
if there are error messages, otherwiseAction.SUCCESS
.- Returns:
Action.ERROR
orAction.SUCCESS
-
addErrorMessages
Description copied from interface:ErrorCollection
Append new error messages to those already collected.- Specified by:
addErrorMessages
in interfaceErrorCollection
- Parameters:
errorMessages
- Collection of error strings.
-
addErrors
Description copied from interface:ErrorCollection
Append new field-specific errors to those already collected.- Specified by:
addErrors
in interfaceErrorCollection
- Parameters:
errors
- of String: String pairs, eg. {"assignee": "Assignee is required"}
-
hasAnyErrors
public boolean hasAnyErrors()Description copied from interface:ErrorCollection
Whether any errors (of any type - field-specific or otherwise) have been collected.- Specified by:
hasAnyErrors
in interfaceErrorCollection
- Returns:
- true if any errors (of any type - field-specific or otherwise) have been collected.
-
addErrorMessages
public void addErrorMessages(webwork.dispatcher.ActionResult aResult) -
addIllegalArgumentException
Override this method from ActionSupport. Body is copied from there, with the exception of a clause that prevents JRA-7245- Specified by:
addIllegalArgumentException
in interfacewebwork.action.IllegalArgumentAware
- Overrides:
addIllegalArgumentException
in classwebwork.action.ActionSupport
-
getOfBizDelegator
-
getComponentInstanceOfType
This can be called to get a component from theComponentAccessor
. Override this if you wish to change this behaviour say in unit tests.- Parameters:
clazz
- the component class in question- Returns:
- the component instance
-
getHttpRequest()
instead.