com.atlassian.jira.action
Class JiraActionSupport

java.lang.Object
  extended by webwork.action.ActionSupport
      extended by com.atlassian.jira.action.JiraActionSupport
All Implemented Interfaces:
I18nHelper, Serializable, webwork.action.Action, webwork.action.CommandDriven, webwork.action.IllegalArgumentAware
Direct Known Subclasses:
JiraNonWebActionSupport, JiraWebActionSupport

@PublicSpi
public abstract class JiraActionSupport
extends webwork.action.ActionSupport
implements webwork.action.CommandDriven, I18nHelper

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.I18nHelper
I18nHelper.BeanFactory
 
Field Summary
protected  org.apache.log4j.Logger log
           
 
Fields inherited from class webwork.action.ActionSupport
command, errorMap, errorMessages
 
Fields inherited from interface webwork.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
protected JiraActionSupport()
           
 
Method Summary
 void addErrorMessages(webwork.dispatcher.ActionResult aResult)
           
 void addErrorMessages(Collection<String> errorMessages)
           
 void addErrors(Map<String,String> errors)
           
 void addIllegalArgumentException(String fieldName, IllegalArgumentException e)
          Override this method from ActionSupport.
 String execute()
           
 String getActionName()
           
 ApplicationProperties getApplicationProperties()
           
protected
<T> T
getComponentInstanceOfType(Class<T> clazz)
          This can be called to get a component from the ComponentAccessor.
 ResourceBundle getDefaultResourceBundle()
           
 org.ofbiz.core.entity.GenericDelegator getDelegator()
          Deprecated. Use getOfBizDelegator() instead. Since v5.0.
protected  I18nHelper getI18nHelper()
           
 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()
           
abstract  com.atlassian.crowd.embedded.api.User getLoggedInUser()
           
 OfBizDelegator getOfBizDelegator()
           
 com.atlassian.crowd.embedded.api.User getRemoteUser()
          Deprecated. Use getLoggedInUser() instead. Since v4.3. To be deleted in v6.0
 String getResult()
          Get a definitive result.
 String getText(String key)
          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 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, 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, 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, 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, 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, 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, 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)
          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, 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, 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, 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 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
 com.atlassian.core.user.preferences.Preferences getUserPreferences()
           
 WatcherManager getWatcherManager()
           
 boolean hasAnyErrors()
           
 boolean isIndexing()
           
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.
 
Methods inherited from class webwork.action.ActionSupport
addError, addErrorMessage, doDefault, doExecute, doValidation, getCommandName, getErrorMessages, getErrors, getHasErrorMessages, getHasErrors, getPropertyEditorMessage, getTexts, getTexts, getTimezone, invalidInput, invokeCommand, isCommand, setCommand, setErrorMessages, setErrors, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface webwork.action.CommandDriven
getCommandName, setCommand
 

Field Detail

log

protected final org.apache.log4j.Logger log
Constructor Detail

JiraActionSupport

protected JiraActionSupport()
Method Detail

getLoggedInUser

public abstract com.atlassian.crowd.embedded.api.User getLoggedInUser()
Returns:
The logged in user.

getRemoteUser

public com.atlassian.crowd.embedded.api.User getRemoteUser()
Deprecated. Use getLoggedInUser() instead. Since v4.3. To be deleted in v6.0

Returns:
The logged in user.

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

execute

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

getOfBizDelegator

public OfBizDelegator getOfBizDelegator()

getDelegator

public org.ofbiz.core.entity.GenericDelegator getDelegator()
Deprecated. Use getOfBizDelegator() instead. Since v5.0.

Gets GenericDelegator.

Returns:
GenericDelegator

getApplicationProperties

public ApplicationProperties getApplicationProperties()

getWatcherManager

public WatcherManager getWatcherManager()

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)

addErrors

public void addErrors(Map<String,String> errors)

hasAnyErrors

public boolean hasAnyErrors()

addErrorMessages

public void addErrorMessages(webwork.dispatcher.ActionResult aResult)

isIndexing

public boolean isIndexing()

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

getUserPreferences

public com.atlassian.core.user.preferences.Preferences getUserPreferences()

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.

getI18nHelper

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

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()
Specified by:
getDefaultResourceBundle in interface I18nHelper
Returns:
the default ResourceBundle within JIRA

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

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 text or the key itself if no i18n message can be found

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


Copyright © 2002-2012 Atlassian. All Rights Reserved.