@PublicSpi @Deprecated public abstract class

JiraActionSupport

extends ActionSupport
implements I18nHelper CommandDriven
java.lang.Object
   ↳ webwork.action.ActionSupport
     ↳ com.atlassian.jira.action.JiraActionSupport
Known Direct Subclasses
Known Indirect Subclasses

This class is deprecated.
since 6.1 Please use subclass instead JiraWebActionSupport. This class is subject of removal.

@PublicSpi

This class is designed for plugins to implement.

Clients of @PublicSpi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicSpi as per each product's API policy (clients should refer to each product's API policy for the exact guarantee -- usually binary compatibility is guaranteed at least across minor versions).

Note: @PublicSpi interfaces and classes are specifically designed to be implemented/extended by clients. Hence, the guarantee of binary compatibility is different to that of @PublicApi elements (if an element is both @PublicApi and @PublicSpi, both guarantees apply).

Class Overview

This class sits just above the base Webwork ActionSupport class and provides JIRA specific code to all our actions.

Its main capabilities are extra error handling and I18n support

Summary

[Expand]
Inherited Constants
From interface webwork.action.Action
Fields
protected final Logger log
[Expand]
Inherited Fields
From class webwork.action.ActionSupport
Protected Constructors
JiraActionSupport()
Public Methods
void addErrorMessages(Collection<String> errorMessages)
void addErrorMessages(ActionResult aResult)
void addErrors(Map<StringString> errors)
void addIllegalArgumentException(String fieldName, IllegalArgumentException e)
Override this method from ActionSupport.
String execute()
final String getActionName()
ApplicationProperties getApplicationProperties()
ResourceBundle getDefaultResourceBundle()
Returns the default ResourceBundle within JIRA, which does not include translations provided by plugins.
Set<String> getKeysForPrefix(String prefix)
Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.
Locale getLocale()
OfBizDelegator getOfBizDelegator()
ResourceBundle getResourceBundle()
Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.
String getResult()
Get a definitive result.
String getText(String key, Object value1, Object value2, Object value3)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(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 found
String getText(String key, String value1, String value2, String value3)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(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 found
String getText(String key, String value1, String value2)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(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 found
String getText(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 found
String getText(String key, Object value1, Object value2, Object value3, Object value4)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(String key, String value1, String value2, String value3, String value4)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(String key, String value1)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found
String getText(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 key
String getText(String key, Object parameters)
Called to return the formatted text of the specified i18n key or the key itself if no message can be found.
String getText(String key)
String getUnescapedText(String key)
Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found
String getUntransformedRawText(String key)
Same as getUnescapedText(String) but does not apply any TranslationTransforms.
Preferences getUserPreferences()
boolean hasAnyErrors()
boolean isIndexing()
boolean isKeyDefined(String key)

For the given key, checks whether such a key is defined in the locale context represented by this helper instance.

Protected Methods
<T> T getComponentInstanceOfType(Class<T> clazz)
This can be called to get a component from the ComponentAccessor.
I18nHelper getI18nHelper()
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.
[Expand]
Inherited Methods
From class webwork.action.ActionSupport
From class java.lang.Object
From interface com.atlassian.jira.util.I18nHelper
From interface webwork.action.Action
From interface webwork.action.CommandDriven
From interface webwork.action.IllegalArgumentAware

Fields

protected final Logger log

Protected Constructors

protected JiraActionSupport ()

Public Methods

public void addErrorMessages (Collection<String> errorMessages)

public void addErrorMessages (ActionResult aResult)

public void addErrors (Map<StringString> errors)

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

public String execute ()

Throws
Exception

public final String getActionName ()

Returns
  • The name of this action - the unqualified class name.

public ApplicationProperties getApplicationProperties ()

public ResourceBundle getDefaultResourceBundle ()

Returns the default ResourceBundle within JIRA, which does not include translations provided by plugins. For use cases where non-English translations are required, call getResourceBundle() instead.

Returns
  • a non-null bundle

public Set<String> getKeysForPrefix (String prefix)

Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.

Parameters
prefix The prefix for i18n keys. May not be null
Returns
  • An immutable set of translation keys that start with the prefix specified.

public Locale getLocale ()

public OfBizDelegator getOfBizDelegator ()

public ResourceBundle getResourceBundle ()

Returns the consolidated ResourceBundle for this I18nHelper, which includes translations provided by plugins.

Returns
  • a non-null bundle

public String getResult ()

Get a definitive result. Returns ERROR if there are error messages, otherwise SUCCESS.

Returns

public String getText (String key, Object value1, Object value2, Object value3)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (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 found

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

public String getText (String key, String value1, String value2, String value3)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (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 found

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

public String getText (String key, String value1, String value2)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (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 found

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

public String getText (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 found

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

public String getText (String key, Object value1, Object value2, Object value3, Object value4)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (String key, Object value1, Object value2, Object value3, Object value4, Object value5)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (String key, String value1, String value2, String value3, String value4)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (String key, String value1)

Called to return the formatted text of the specified i18n key or the key itself if no message can be found

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

public String getText (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 key

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

public String getText (String key, Object parameters)

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.

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

public String getText (String key)

public String getUnescapedText (String key)

Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found

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

public String getUntransformedRawText (String key)

Same as getUnescapedText(String) but does not apply any TranslationTransforms.

Parameters
key the key of the i18n message
Returns
  • the un-formatted text or the key itself if no i18n message can be found

public Preferences getUserPreferences ()

public boolean hasAnyErrors ()

public boolean isIndexing ()

public boolean isKeyDefined (String key)

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

Parameters
key translation key
Returns
  • true, if any translation for such key exists, false otherwise

Protected Methods

protected 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

protected I18nHelper getI18nHelper ()

Returns

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.