Class JiraWebActionSupport

java.lang.Object
webwork.action.ActionSupport
com.atlassian.jira.web.action.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

@NotThreadSafe @PublicSpi public abstract class JiraWebActionSupport extends webwork.action.ActionSupport implements webwork.action.CommandDriven, I18nHelper, ErrorCollection, AuthorizationSupport, HttpServletVariables
All web actions should extend this class - it provides basic common functionality for all web actions.

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:
  • Field Details

  • 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 public ApplicationUser getLoggedInApplicationUser()
      Deprecated.
      Use getLoggedInUser(). Since v7.0
      Returns:
      The logged in user.
    • getXsrfToken

      public String getXsrfToken()
    • getHttpRequest

      public javax.servlet.http.HttpServletRequest getHttpRequest()
      Specified by:
      getHttpRequest in interface HttpServletVariables
      Returns:
      the HttpServletRequest in play
      See Also:
    • getHttpSession

      public javax.servlet.http.HttpSession getHttpSession()
      Specified by:
      getHttpSession in interface HttpServletVariables
      Returns:
      the HttpSession in play
      See Also:
    • getHttpResponse

      public javax.servlet.http.HttpServletResponse getHttpResponse()
      Specified by:
      getHttpResponse in interface HttpServletVariables
      Returns:
      the HttpServletResponse in play
      See Also:
    • getServletContext

      public javax.servlet.ServletContext getServletContext()
      Specified by:
      getServletContext in interface HttpServletVariables
      Returns:
      the ServletContext of the JIRA web application
      See Also:
    • getApplicationProperties

      public ApplicationProperties getApplicationProperties()
    • getUriValidator

      public UriValidator getUriValidator()
    • getGlobalPermissionManager

      protected GlobalPermissionManager getGlobalPermissionManager()
    • getPermissionManager

      protected PermissionManager getPermissionManager()
    • getUserProjectHistoryManager

      protected UserProjectHistoryManager getUserProjectHistoryManager()
    • getConstantsManager

      public ConstantsManager getConstantsManager()
    • getProjectManager

      public ProjectManager getProjectManager()
    • getVersionManager

      public VersionManager getVersionManager()
    • getOutlookDate

      @Deprecated public OutlookDate getOutlookDate()
      Deprecated.
      Use getDateTimeFormatter() instead. Since v5.0.
    • getDateTimeFormatter

      public DateTimeFormatter getDateTimeFormatter()
      Returns a DateTimeFormatter that can be used to format times and dates in the user's time zone using DateTimeStyle.RELATIVE.
      Returns:
      a DateTimeFormatter
    • getDmyDateFormatter

      public DateTimeFormatter getDmyDateFormatter()
      Returns a DateTimeFormatter that can be used to format dates in the user's time zone using DateTimeStyle.DATE.
      Returns:
      a DateTimeFormatter
    • getJiraContactHelper

      public JiraContactHelper getJiraContactHelper()
    • getUserManager

      public UserManager getUserManager()
    • getAdministratorContactLink

      public String 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

      protected final HintManager getHintManager()
    • getAuthorizationSupport

      protected AuthorizationSupport getAuthorizationSupport()
    • getOutboundWhitelistProvider

      protected OutboundWhitelistProvider getOutboundWhitelistProvider()
    • getRedirect

      public String getRedirect(String defaultUrl)
      Redirects to the value of getReturnUrl(), falling back to defaultUrl if the returnUrl is not set. This method clears the returnUrl. 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 per RedirectSanitiser.makeSafeRedirectUrl(String). Use getRedirect(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

      public String getRedirect(String defaultUrl, boolean allowUnsafeRedirect)
      Redirects to the value of getReturnUrl(), falling back to defaultUrl if the returnUrl is not set. This method clears the returnUrl. 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 of returnUrl or defaultUrl. This can introduce serious security problems, so use with care. In particular, you should only use use this method if defaultUrl 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 exported ForwardAuthorizer OSGi service, it will fall back to redirecting.

      Parameters:
      defaultUrl - default URL to redirect to
      allowUnsafeRedirect - 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

      protected String forceRedirect(String redirect)
      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, prefer getRedirect(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)
      Returns true if the logged in user has the given permission type.
      Specified by:
      hasPermission in interface AuthorizationSupport
      Parameters:
      permissionsId - the permission type
      Returns:
      true if the logged in user has the given permission type.
    • hasGlobalPermission

      public boolean hasGlobalPermission(GlobalPermissionKey globalPermissionKey)
      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 interface AuthorizationSupport
      Parameters:
      globalPermissionKey - the permission to check
      Returns:
      true if the logged in user has the given global permission.
      See Also:
    • hasGlobalPermission

      public boolean hasGlobalPermission(String permissionKey)
      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 interface AuthorizationSupport
      Parameters:
      permissionKey - the permission to check
      Returns:
      true if the logged in user has the given global permission.
      See Also:
    • hasIssuePermission

      public boolean hasIssuePermission(String permissionKey, Issue issue)
      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 interface AuthorizationSupport
      Parameters:
      permissionKey - the permission key as a String
      issue - the Issue
      Returns:
      true if the logged in user has the given permission type on the given Issue.
      See Also:
    • hasIssuePermission

      public boolean hasIssuePermission(int permissionsId, Issue issue)
      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 interface AuthorizationSupport
      Parameters:
      permissionsId - the permission type
      issue - the Issue
      Returns:
      true if the logged in user has the given permission type on the given Issue.
    • hasIssuePermission

      public boolean hasIssuePermission(ProjectPermissionKey projectPermissionKey, Issue issue)
      Description copied from interface: AuthorizationSupport
      Returns true if the logged in user has the given permission on the given Issue.
      Specified by:
      hasIssuePermission in interface AuthorizationSupport
      Parameters:
      projectPermissionKey - the permission to check
      issue - the Issue
      Returns:
      true if the logged in user has the given permission on the given Issue.
      See Also:
    • hasProjectPermission

      public boolean hasProjectPermission(int permissionsId, Project project)
      Returns true if the logged in user has the given permission type on the given Project.
      Specified by:
      hasProjectPermission in interface AuthorizationSupport
      Parameters:
      permissionsId - the permission type
      project - the Project
      Returns:
      true if the logged in user has the given permission type on the given Project.
    • hasProjectPermission

      public boolean hasProjectPermission(ProjectPermissionKey projectPermissionKey, Project project)
      Description copied from interface: AuthorizationSupport
      Returns true if the logged in user has the given permission on the given project.
      Specified by:
      hasProjectPermission in interface AuthorizationSupport
      Parameters:
      projectPermissionKey - the permission to check
      project - 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 public boolean isUserExists(String username)
      Deprecated.
      Use isUserExistsByName(String) or isUserExistsByKey(String) instead, as appropriate. Since v6.0.
      Parameters:
      username - the username to check
      Returns:
      true if the username is associated with an existing user; false otherwise
    • isUserExistsByName

      public boolean isUserExistsByName(String username)
    • isUserExistsByKey

      public boolean isUserExistsByKey(String userkey)
    • getUserFullName

      public String getUserFullName(String username)
    • addErrorCollection

      public void addErrorCollection(ErrorCollection errors)
      Description copied from interface: ErrorCollection
      Populate this ErrorCollection with general and field-specific errors.
      Specified by:
      addErrorCollection in interface ErrorCollection
      Parameters:
      errors - ErrorCollection whose errors/messages we obtain.
    • addError

      public void addError(String field, String message, ErrorCollection.Reason reason)
      Description copied from interface: ErrorCollection
      Add a field-specific error message.
      Specified by:
      addError in interface ErrorCollection
      Parameters:
      field - Field name, eg. "assignee"
      message - Error message.
      reason - Reason for the error.
    • addErrorMessage

      public void addErrorMessage(String message, ErrorCollection.Reason reason)
      Description copied from interface: ErrorCollection
      Add error message relating to system state (not field-specific), and a reason.
      Specified by:
      addErrorMessage in interface ErrorCollection
      Parameters:
      message - Error message.
      reason - Reason for the error.
    • addReason

      public void addReason(ErrorCollection.Reason reason)
      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 interface ErrorCollection
      Parameters:
      reason - a well known reasons why the function has not been performed.
    • addReasons

      public void addReasons(Set<ErrorCollection.Reason> reasons)
      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 interface ErrorCollection
      Parameters:
      reasons - a set of well known reasons why the function has not been performed.
    • setReasons

      public void setReasons(Set<ErrorCollection.Reason> reasons)
      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 interface ErrorCollection
      Parameters:
      reasons - a set of well known reasons why the function has not been performed.
    • getReasons

      public Set<ErrorCollection.Reason> 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 interface ErrorCollection
      Returns:
      a set of well known reasons why the function has not been performed.
    • getField

      public Field getField(String id)
    • getSearchSortDescriptions

      public List<String> getSearchSortDescriptions(SearchRequest searchRequest)
    • getNameTranslation

      public String getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
      Deprecated.
      Use ConstantsManager instead. Since v6.0.
    • getNameTranslation

      public String getNameTranslation(IssueConstant issueConstant)
      Deprecated.
      Use ConstantsManager instead. Since v6.0.
    • getDescTranslation

      public String getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
      Deprecated.
      Use ConstantsManager instead. Since v6.0.
    • getDescTranslation

      public String getDescTranslation(IssueConstant issueConstant)
      Deprecated.
      Use ConstantsManager instead. Since v6.0.
    • getReturnUrl

      public String getReturnUrl()
    • getReturnUrlForCancelLink

      public String 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

      public void setReturnUrl(String returnUrl)
    • getFlushedErrorMessages

      public Collection<String> getFlushedErrorMessages()
      Description copied from interface: ErrorCollection
      Get error messages, then get rid of them.
      Specified by:
      getFlushedErrorMessages in interface ErrorCollection
      Returns:
      The (now cleared) error messages.
    • getLanguage

      public String getLanguage() throws IOException
      Throws:
      IOException
    • getSelectedProject

      public Project 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

      public Project getSelectedProjectObject()
      Gets the last viewed project that the user visited and still has permission to see. This is a legacy synonym for getSelectedProject()
      Returns:
      the last project the user visited.
      See Also:
    • setSelectedProjectId

      public void setSelectedProjectId(Long id)
    • getDateFormat

      public String getDateFormat()
    • getDateTimeFormat

      public String getDateTimeFormat()
    • getTimeFormat

      public String getTimeFormat()
    • getWebworkStack

      public String getWebworkStack(String selected)
      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

      public String 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

      public String getServerId()
    • getJiraServiceContext

      public JiraServiceContext getJiraServiceContext()
      Provides a service context with the current user which contains this action as its ErrorCollection.
      Returns:
      the JiraServiceContext.
    • htmlEncode

      public String htmlEncode(String encodeMe)
      Convenience instance method to call static utility from webwork EL.
      Parameters:
      encodeMe - a String to be HTML encoded.
      Returns:
      the HTML encoded string.
    • urlEncode

      public String urlEncode(String encode)
      Encodes the given string into application/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

      public RequestSourceType 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

      public String returnComplete()
    • returnComplete

      public String returnComplete(String url)
    • checkIfUrlIsAllowed

      public boolean checkIfUrlIsAllowed(String url)
    • getEmptyResponse

      public String getEmptyResponse()
      Returns an empty response code (204)
    • returnCompleteWithInlineRedirect

      protected final String returnCompleteWithInlineRedirect(String url)
      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 like returnCompleteWithInlineRedirect(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 to
      msg - message HTML
      type - type of message.
      closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
      target - 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)
      This will redirect like returnCompleteWithInlineRedirect(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 to
      msg - message HTML
      type - type of message, see JIRA.Messages.Types
      closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
      target - 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)
      This will redirect like returnComplete(), 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 dialogs
      msg - message HTML
      type - type of message, see JIRA.Messages.Types
      closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
      target - 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 like returnComplete(), 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 dialogs
      msg - message HTML
      type - type of message
      closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
      target - the target to prepend the message pop-up to. If null, the message is shown in a global spot
      Returns:
      action mapping string
    • insertContextPath

      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).
      Parameters:
      url - a String containing a URL
      Returns:
      a String with the context path prepended
    • addMessageToResponse

      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.
      Parameters:
      msg - message HTML
      type - type of message, see JIRA.Messages.Types
      closeable - if true, message pop-up has an 'X' button, otherwise pop-up fades away automatically
      target - the target to prepend the message pop-up to. If null, the message is shown in a global spot.
    • hasErrorMessage

      protected final boolean hasErrorMessage(String errorMsg)
    • hasErrorMessageByKey

      protected final boolean hasErrorMessageByKey(String errorMsgKey)
    • addErrorMessageIfAbsent

      protected final void addErrorMessageIfAbsent(String errorMsg)
    • addErrorMessageByKeyIfAbsent

      protected final void addErrorMessageByKeyIfAbsent(String errorMsgKey)
    • tagMauEventWithApplication

      protected void tagMauEventWithApplication(@Nonnull MauApplicationKey applicationKey)
    • tagMauEventWithProject

      protected void tagMauEventWithProject(Project project)
    • getHint

      public final Hint getHint(String context)
    • getRandomHint

      public final Hint getRandomHint()
    • getConglomerateCookieValue

      public String getConglomerateCookieValue(String cookieName, String key)
      Retrieve the value from a conglomerate Cookie from the request.
      Parameters:
      cookieName - The name of the conglomerate cookie
      key - The key of the value
      Returns:
      the value (or the empty-string if it did not exist)
    • setConglomerateCookieValue

      public void setConglomerateCookieValue(String cookieName, String key, String value)
      Set the value key/value pair in a conglomerate Cookie.
      Parameters:
      cookieName - The name of the conglomerate cookie
      key - The key of the value
      value - The value
    • getRedirectSanitiser

      @Nonnull protected final RedirectSanitiser getRedirectSanitiser()
      Returns a RedirectSanitiser implementation.
      Returns:
      a RedirectSanitiser
    • getErrorMessages

      public Collection<String> getErrorMessages()
      Description copied from interface: ErrorCollection
      Get all non field-specific error messages.
      Specified by:
      getErrorMessages in interface ErrorCollection
      Overrides:
      getErrorMessages in class webwork.action.ActionSupport
      Returns:
      Collection of error Strings.
    • getErrors

      public Map<String,String> getErrors()
      Description copied from interface: ErrorCollection
      Get all field-specific errors.
      Specified by:
      getErrors in interface ErrorCollection
      Overrides:
      getErrors in class webwork.action.ActionSupport
      Returns:
      Map of String: String pairs, eg. {"assignee": "Assignee is required"}
    • getKeysForPrefix

      public Set<String> getKeysForPrefix(String prefix)
      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 interface I18nHelper
      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

      public ResourceBundle getDefaultResourceBundle()
      Description copied from interface: I18nHelper
      Returns the default ResourceBundle within JIRA, which does not include translations provided by plugins. For use cases where non-English translations are required, call I18nHelper.getResourceBundle() instead.
      Specified by:
      getDefaultResourceBundle in interface I18nHelper
      Returns:
      a non-null bundle
      See Also:
    • getUnescapedText

      public String getUnescapedText(String key)
      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 interface I18nHelper
      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

      public String getUntransformedRawText(String key)
      Description copied from interface: I18nHelper
      Specified by:
      getUntransformedRawText in interface I18nHelper
      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

      public boolean isKeyDefined(String key)
      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 returns false, I18nHelper.getUntransformedRawText(String) will return the key provided as an argument, and if this method returns true, I18nHelper.getUntransformedRawText(String) will generally return the translation, which in some very unlikely cases may be equal to the key.

      Specified by:
      isKeyDefined in interface I18nHelper
      Parameters:
      key - translation key
      Returns:
      true, if any translation for such key exists, false otherwise
    • getResourceBundle

      public ResourceBundle getResourceBundle()
      Description copied from interface: I18nHelper
      Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.
      Specified by:
      getResourceBundle in interface I18nHelper
      Returns:
      a non-null bundle
      See Also:
    • getText

      public String getText(String key)
      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 interface I18nHelper
      Overrides:
      getText in class webwork.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

      public String getText(String key, String value1)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - 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)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - 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)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - 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)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - 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)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - 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)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - 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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - a value to be substituted into the message
      value5 - 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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - a value to be substituted into the message
      value5 - a value to be substituted into the message
      value6 - 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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - a value to be substituted into the message
      value5 - a value to be substituted into the message
      value6 - a value to be substituted into the message
      value7 - 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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - a value to be substituted into the message
      value5 - a value to be substituted into the message
      value6 - a value to be substituted into the message
      value7 - 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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - a value to be substituted into the message
      value5 - a value to be substituted into the message
      value6 - a value to be substituted into the message
      value7 - a value to be substituted into the message
      value8 - 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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      value1 - a value to be substituted into the message
      value2 - a value to be substituted into the message
      value3 - a value to be substituted into the message
      value4 - a value to be substituted into the message
      value5 - a value to be substituted into the message
      value6 - a value to be substituted into the message
      value7 - a value to be substituted into the message
      value8 - a value to be substituted into the message
      value9 - 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 parameters)
      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 interface I18nHelper
      Parameters:
      key - the key of the i18n message
      parameters - This can be an Array, a List 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

      protected I18nHelper getI18nHelper()
      Returns:
      the I18nHelper associated with this action
    • getLocale

      public Locale getLocale()
      Specified by:
      getLocale in interface I18nHelper
      Overrides:
      getLocale in class webwork.action.ActionSupport
      Returns:
      the Locale that is associated with this I18nHelper
    • isIndexing

      public boolean isIndexing()
    • removeKeyOrAddError

      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.
      Parameters:
      params - the map of parameters
      key - the param key to remove.
      messageKey - the error.
    • execute

      public String execute() throws Exception
      Specified by:
      execute in interface webwork.action.Action
      Overrides:
      execute in class webwork.action.ActionSupport
      Throws:
      Exception
    • getActionName

      public final String getActionName()
      Overrides:
      getActionName in class webwork.action.ActionSupport
      Returns:
      The name of this action - the unqualified class name.
    • getResult

      public String getResult()
      Get a definitive result. Returns Action.ERROR if there are error messages, otherwise Action.SUCCESS.
      Returns:
      Action.ERROR or Action.SUCCESS
    • addErrorMessages

      public void addErrorMessages(Collection<String> errorMessages)
      Description copied from interface: ErrorCollection
      Append new error messages to those already collected.
      Specified by:
      addErrorMessages in interface ErrorCollection
      Parameters:
      errorMessages - Collection of error strings.
    • addErrors

      public void addErrors(Map<String,String> errors)
      Description copied from interface: ErrorCollection
      Append new field-specific errors to those already collected.
      Specified by:
      addErrors in interface ErrorCollection
      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 interface ErrorCollection
      Returns:
      true if any errors (of any type - field-specific or otherwise) have been collected.
    • addErrorMessages

      public void addErrorMessages(webwork.dispatcher.ActionResult aResult)
    • addIllegalArgumentException

      public void addIllegalArgumentException(String fieldName, IllegalArgumentException e)
      Override this method from ActionSupport. Body is copied from there, with the exception of a clause that prevents JRA-7245
      Specified by:
      addIllegalArgumentException in interface webwork.action.IllegalArgumentAware
      Overrides:
      addIllegalArgumentException in class webwork.action.ActionSupport
    • getOfBizDelegator

      public OfBizDelegator getOfBizDelegator()
    • getComponentInstanceOfType

      protected <T> T getComponentInstanceOfType(Class<T> clazz)
      This can be called to get a component from the ComponentAccessor. Override this if you wish to change this behaviour say in unit tests.
      Parameters:
      clazz - the component class in question
      Returns:
      the component instance