public class

ConfluenceActionSupport

extends ActionSupport
implements WebInterface LocaleProvider
java.lang.Object
   ↳ com.opensymphony.xwork.ActionSupport
     ↳ com.atlassian.confluence.core.ConfluenceActionSupport
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Base class for all Confluence webwork actions. Mainly takes care of managing permissions, and a few other tasks that are common across all actions in the app.

Summary

Constants
String CANCEL
String DEVMODE
String LICENSE_EXPIRED
String LICENSE_USERS_EXCEEDED
String PREVIEW
[Expand]
Inherited Constants
From interface com.opensymphony.xwork.Action
Fields
protected EventManager eventManager
protected I18NBeanFactory i18NBeanFactory
protected LabelManager labelManager
protected LanguageManager languageManager
protected Logger log This field is deprecated. since 2.6.1 create a private static logger in your action class
protected PermissionManager permissionManager
protected boolean permitted
protected PluginAccessor pluginAccessor
protected SettingsManager settingsManager
protected SpacePermissionManager spacePermissionManager
protected UserAccessor userAccessor
protected WebInterfaceManager webInterfaceManager
[Expand]
Inherited Fields
From class com.opensymphony.xwork.ActionSupport
Public Constructors
ConfluenceActionSupport()
Public Methods
void addActionError(String textKey, Object... args)
Adds an error to the current action which will be displayed to the user.
void addFieldError(String fieldName, String textKey, Object[] args)
Adds an error to the current action which will be displayed next to the specified field.
String doDefault()
Default webwork action execution method.
String formatFriendlyDate(Date date)
String getActionName()
Returns the internationalised name of the current action.
String getActionName(String fullClassName)
BootstrapManager getBootstrapManager()
String getCancelResult()
Map<StringObject> getContext()
String getDateFormatSetting()
DateFormatter getDateFormatter()
ResourceBundle getDefaultResourceBundle()
String getDocLink(String page)
Creates a version specific documentation link for the provided page.
EventManager getEventManager()
FriendlyDateFormatter getFriendlyDateFormatter()
Settings getGlobalSettings()
ThemeHelper getHelper()
I18NBean getI18n()
List<Language> getInstalledLanguages()
LabelManager getLabelManager()
LanguageManager getLanguageManager()
String getLanguageUserFriendly(String locale)
Locale getLocale()
LocaleManager getLocaleManager()
String getLocaleString()
String getNiceContentType(ContentEntityObject entityObject)
Date getPreviousLoginDate()
int getRandom()
This method is deprecated. since 2.9. Random number generation does not belong here. Please introduce your own random number generation in your own actions.
User getRemoteUser()
Return the user from getRequest(), or if that is not found, the user returned from getUser().
Map getSession()
SystemInformationService getSystemInformationService()
String getText(String key, Object[] args)
String getText(String key)
String getText(String key, List list)
String getText(String key, String defaultValue)

This can be used for internationalisation where a non-internationalised default string exists.

static String getTextStatic(String key)
static String getTextStatic(String key, Object[] list)
String getTextStrict(String key)
TimeZone getTimeZone()
User getUser(String username)
UserAccessor getUserAccessor()
String getUserFullName(String username)
WebInterfaceContext getWebInterfaceContext()
Returns a context which can be passed to web items when rendering them.
WebInterfaceManager getWebInterfaceManager()
boolean isAnonymousUser()
boolean isCanceled()
Has this action been cancelled? Used by CancellingInterceptor to determine if the action should be executed.
boolean isDevMode()
Returns true if the system property confluence.devmode is set and has the value "true".
boolean isEmailVisible()
boolean isExternalUserManagementEnabled()
boolean isLabelable(Object object)
boolean isPermissionCheck()
boolean isPermitted()
String isPermittedAsString()
boolean isPrintableVersion()
boolean isSharedMode()
boolean isUserStatusPluginEnabled()
Temporary method until we have plugin points to require i18n keys.
boolean isUsingHSQL()
Placing this method in ConfluenceActionSupport is a bit of a hack, but it is suprisingly difficult to have a generic piece of logic that can be used in decorators.
void setBootstrapManager(BootstrapManager bootstrapManager)
void setCancel(String cancel)
Set by the "cancel" button on forms.
void setEventManager(EventManager eventManager)
void setFormatSettingsManager(FormatSettingsManager formatSettingsManager)
void setI18NBean(I18NBean i18NBean)
void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
void setLabelManager(LabelManager labelManager)
void setLanguageManager(LanguageManager languageManager)
void setLocaleManager(LocaleManager localeManager)
void setLoginManager(LoginManager loginManager)
void setPermissionCheck(boolean permissionCheck)
void setPermissionManager(PermissionManager permissionManager)
void setPluginAccessor(PluginAccessor pluginAccessor)
void setPreviousLoginDate(Date previousLoginDate)
void setSettingsManager(SettingsManager settingsManager)
void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
void setSystemInformationService(SystemInformationService systemInformationService)
void setUserAccessor(UserAccessor userAccessor)
void setWebInterfaceManager(WebInterfaceManager webInterfaceManager)
Protected Methods
void addPermissionTypeTo(String permissionType, List<String> permissionTypes)
void addToHistory(ContentEntityObject content)
List<String> getPermissionTypes()
List getPermittedEntitiesOf(Iterator entities, int maxCount)
List getPermittedEntitiesOf(List entities)
List getPermittedEntitiesOf(Iterator entities, int maxCount, List criteria)
UserInterfaceState getUserInterfaceState()
boolean hasPermissionForSpace(List permissionTypes, Space space)
[Expand]
Inherited Methods
From class com.opensymphony.xwork.ActionSupport
From class java.lang.Object
From interface com.atlassian.confluence.plugin.descriptor.web.WebInterface
From interface com.opensymphony.xwork.Action
From interface com.opensymphony.xwork.LocaleProvider
From interface com.opensymphony.xwork.TextProvider
From interface com.opensymphony.xwork.Validateable
From interface com.opensymphony.xwork.ValidationAware

Constants

public static final String CANCEL

Constant Value: "cancel"

public static final String DEVMODE

Constant Value: "confluence.devmode"

public static final String LICENSE_EXPIRED

Constant Value: "licenseexpired"

public static final String LICENSE_USERS_EXCEEDED

Constant Value: "licenseusersexceeded"

public static final String PREVIEW

Constant Value: "preview"

Fields

protected EventManager eventManager

protected I18NBeanFactory i18NBeanFactory

protected LabelManager labelManager

protected LanguageManager languageManager

protected Logger log

This field is deprecated.
since 2.6.1 create a private static logger in your action class

protected PermissionManager permissionManager

protected boolean permitted

protected PluginAccessor pluginAccessor

protected SettingsManager settingsManager

protected SpacePermissionManager spacePermissionManager

protected UserAccessor userAccessor

protected WebInterfaceManager webInterfaceManager

Public Constructors

public ConfluenceActionSupport ()

Public Methods

public void addActionError (String textKey, Object... args)

Adds an error to the current action which will be displayed to the user. HTML-escapes any String arguments to avoid cross-site scripting problems with user input.

Parameters
textKey key to internationalised text
args args to be merged with text via standard MessageFormat rules

public void addFieldError (String fieldName, String textKey, Object[] args)

Adds an error to the current action which will be displayed next to the specified field. HTML-escapes any String arguments to avoid cross-site scripting problems with user input.

Parameters
fieldName field to apply error to
textKey key to internationalised text
args args to be merged with text via standard MessageFormat rules

public String doDefault ()

Default webwork action execution method.

Returns
  • the action result
Throws
Exception if something goes wrong

public String formatFriendlyDate (Date date)

public String getActionName ()

Returns the internationalised name of the current action.

public String getActionName (String fullClassName)

public BootstrapManager getBootstrapManager ()

public String getCancelResult ()

public Map<StringObject> getContext ()

public String getDateFormatSetting ()

public DateFormatter getDateFormatter ()

public ResourceBundle getDefaultResourceBundle ()

public String getDocLink (String page)

Creates a version specific documentation link for the provided page. This method exists because some error messages include links. Otherwise use $docBean which is available on the velocity context.

Parameters
page the page to link to (just the title)
Returns
  • version specific documentation link.

public EventManager getEventManager ()

public FriendlyDateFormatter getFriendlyDateFormatter ()

public Settings getGlobalSettings ()

public ThemeHelper getHelper ()

public I18NBean getI18n ()

public List<Language> getInstalledLanguages ()

public LabelManager getLabelManager ()

public LanguageManager getLanguageManager ()

public String getLanguageUserFriendly (String locale)

public Locale getLocale ()

public LocaleManager getLocaleManager ()

public String getLocaleString ()

public String getNiceContentType (ContentEntityObject entityObject)

public Date getPreviousLoginDate ()

public int getRandom ()

This method is deprecated.
since 2.9. Random number generation does not belong here. Please introduce your own random number generation in your own actions.

public User getRemoteUser ()

Return the user from getRequest(), or if that is not found, the user returned from getUser().

Returns
  • the remote user

public Map getSession ()

public SystemInformationService getSystemInformationService ()

public String getText (String key, Object[] args)

public String getText (String key)

public String getText (String key, List list)

public String getText (String key, String defaultValue)

This can be used for internationalisation where a non-internationalised default string exists. If the key is null or returns a null value, then the default will be used instead.

Note the HtmlSafe annotation on this method. Ensure that you handle the defaultValue appropriately for display.

public static String getTextStatic (String key)

public static String getTextStatic (String key, Object[] list)

public String getTextStrict (String key)

public TimeZone getTimeZone ()

public User getUser (String username)

public UserAccessor getUserAccessor ()

public String getUserFullName (String username)

public WebInterfaceContext getWebInterfaceContext ()

Returns a context which can be passed to web items when rendering them.

Typically, WebWork actions will implement this to provide extra details in the context such as content objects, and so on.

public WebInterfaceManager getWebInterfaceManager ()

public boolean isAnonymousUser ()

public boolean isCanceled ()

Has this action been cancelled? Used by CancellingInterceptor to determine if the action should be executed.

public boolean isDevMode ()

Returns true if the system property confluence.devmode is set and has the value "true".

Returns
  • boolean

public boolean isEmailVisible ()

public boolean isExternalUserManagementEnabled ()

public boolean isLabelable (Object object)

public boolean isPermissionCheck ()

public boolean isPermitted ()

public String isPermittedAsString ()

public boolean isPrintableVersion ()

public boolean isSharedMode ()

public boolean isUserStatusPluginEnabled ()

Temporary method until we have plugin points to require i18n keys. CONF-15428

Returns
  • true if "user status" is enabled.

public boolean isUsingHSQL ()

Placing this method in ConfluenceActionSupport is a bit of a hack, but it is suprisingly difficult to have a generic piece of logic that can be used in decorators.

Returns
  • true if Confluence is currently using a Hypersonic database

public void setBootstrapManager (BootstrapManager bootstrapManager)

public void setCancel (String cancel)

Set by the "cancel" button on forms. This tells the CancellingInterceptor that an action should not be executed, and should just return its getCancelResult() result.

Parameters
cancel Any non-null, non-empty string value.

public void setEventManager (EventManager eventManager)

public void setFormatSettingsManager (FormatSettingsManager formatSettingsManager)

public void setI18NBean (I18NBean i18NBean)

public void setI18NBeanFactory (I18NBeanFactory i18NBeanFactory)

public void setLabelManager (LabelManager labelManager)

public void setLanguageManager (LanguageManager languageManager)

public void setLocaleManager (LocaleManager localeManager)

public void setLoginManager (LoginManager loginManager)

public void setPermissionCheck (boolean permissionCheck)

public void setPermissionManager (PermissionManager permissionManager)

public void setPluginAccessor (PluginAccessor pluginAccessor)

public void setPreviousLoginDate (Date previousLoginDate)

public void setSettingsManager (SettingsManager settingsManager)

public void setSpacePermissionManager (SpacePermissionManager spacePermissionManager)

public void setSystemInformationService (SystemInformationService systemInformationService)

public void setUserAccessor (UserAccessor userAccessor)

public void setWebInterfaceManager (WebInterfaceManager webInterfaceManager)

Protected Methods

protected void addPermissionTypeTo (String permissionType, List<String> permissionTypes)

protected void addToHistory (ContentEntityObject content)

protected List<String> getPermissionTypes ()

protected List getPermittedEntitiesOf (Iterator entities, int maxCount)

protected List getPermittedEntitiesOf (List entities)

protected List getPermittedEntitiesOf (Iterator entities, int maxCount, List criteria)

protected UserInterfaceState getUserInterfaceState ()

protected boolean hasPermissionForSpace (List permissionTypes, Space space)