com.atlassian.confluence.core
Class ConfluenceActionSupport

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.atlassian.confluence.core.ConfluenceActionSupport
All Implemented Interfaces:
WebInterface, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, java.io.Serializable
Direct Known Subclasses:
AbstractBackupRestoreAction, AbstractCommandAction, AbstractEntityPaginationAction, AbstractGroupAction, AbstractLabelDisplayingAction, AbstractLabelsForEntityAction, AbstractLogoAction, AbstractPageAwareAction, AbstractPermissionsAction, AbstractSetupAction, AbstractSetupEmailAction, AbstractSpaceAction, AbstractTrustedApplicationAction, AbstractUpdateLicenseAction, AbstractUserProfileAction, AbstractUsersAction, AbstractUserStatusJsonResultAction, AbstractViewAttachmentsAction, AddFavouriteAction, AddLabelAction, AdministrationConsoleAction, AdministratorsAction, AdminStylesheetAction, AdvancedSearchTipsAction, AttachedImagesAction, AttachFileAction, AttachmentNotFoundAction, AttachmentStorageSetupAction, AutocompleteLabelsAction, BreadcrumbAction, BrowseCommentsAction, BrowseMacrosAction, BrowseShortcutsAction, BuildIndexAction, CacheStatisticsAction, ClearUserStatusAction, ClusterConfigurationAction, ColorsStylesheetAction, ColourPickerAction, CombinedStylesheetAction, ConfigureCaptchaAction, ConfigureLanguageAction, ConfigureLog4jAction, ConfigureRssFeedAction, ContentNameSearchAction, CreateRssFeedAction, CustomHtmlAction, CustomStylesheetAction, DailyBackupAdminAction, DashboardAction, DeleteUserStatusAction, DraftAttachmentSearchAction, EditDefaultSpaceContentAction, EditStylesheetAction, EncodingTestAction, ExternalUserConnectivityAction, FindRestrictableEntitiesAction, FlushCacheAction, FlushIndexQueueAction, FollowUserAction, ForgotUserPasswordAction, FourOhFourAction, GeneralConfigurationAction, GlobalRssFeedAction, HistoryAction, HomepageAction, IndexProgressAction, ListNewOrUpdatedPagesAction, LoginAction, LogoutAction, LongRunningTaskMonitorAction, ManagePluginsAction, ManageReferrersAction, NetworkFeedAction, NotationHelpAction, OpenSearchDescriptorAction, PageDestinationSearchAction, PageNotFoundAction, PageNotificationAction, PagePickerAction, PageSummaryAction, PeopleDirectoryAction, PluginOsgiExportsAction, PurgeReferrersAction, RebuildAncestorTableAction, RefreshLicensingAction, ReIndexAction, ReindexTaskProgressAction, RemoveFavouriteAction, RemoveLabelAction, RemoveSmtpMailServerAction, ResumeDraftAction, SearchIndexesAction, SearchSiteAction, SendTestEmailAction, SetupDBOtherAction, SignupAction, StartClusterAction, StaticRenderingAction, StylesheetAction, ThemeColorsStylesheetAction, TinyMceColorPickerAction, TinyMceContextMenuAction, TinyMceEditorSettingsAction, TinyMceEmotionsAction, TinyUrlAction, UnFollowUserAction, UserMacroAction, UserPopupAction, UserSearchAction, VelocityResultAction, ViewIndexQueueAction, ViewMailQueueAction, ViewMailServersAction, ViewSystemClasspathAction, ViewSystemInfoAction, ViewUserHistoryAction, XsrfTokenExpiredAction

public class ConfluenceActionSupport
extends com.opensymphony.xwork.ActionSupport
implements com.opensymphony.xwork.LocaleProvider, WebInterface

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.

See Also:
Serialized Form

Field Summary
static java.lang.String CANCEL
           
static java.lang.String DEVMODE
           
protected  com.atlassian.event.EventManager eventManager
           
protected  I18NBeanFactory i18NBeanFactory
           
protected  LabelManager labelManager
           
protected  LanguageManager languageManager
           
static java.lang.String LICENSE_EXPIRED
           
static java.lang.String LICENSE_USERS_EXCEEDED
           
protected  org.apache.log4j.Logger log
          Deprecated. since 2.6.1 create a private static logger in your action class
protected  PermissionManager permissionManager
           
protected  boolean permitted
           
protected  com.atlassian.plugin.PluginAccessor pluginAccessor
           
static java.lang.String PREVIEW
           
protected  SettingsManager settingsManager
           
protected  SpacePermissionManager spacePermissionManager
           
protected  UserAccessor userAccessor
           
protected  com.atlassian.plugin.web.WebInterfaceManager webInterfaceManager
           
 
Fields inherited from class com.opensymphony.xwork.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
ConfluenceActionSupport()
           
 
Method Summary
 void addActionError(java.lang.String textKey, java.lang.Object[] args)
          XML-escapes any String arguments to avoid cross-site scripting problems with user input.
 void addFieldError(java.lang.String fieldName, java.lang.String textKey, java.lang.Object[] args)
          XML-escapes any String arguments to avoid cross-site scripting problems with user input.
protected  void addPermissionTypeTo(java.lang.String permissionType, java.util.List<java.lang.String> permissionTypes)
           
protected  void addToHistory(ContentEntityObject content)
           
 java.lang.String doDefault()
          Default webwork action execution method.
 java.lang.String formatFriendlyDate(java.util.Date date)
           
 java.lang.String getActionName()
          Returns the internationalised name of the current action.
 java.lang.String getActionName(java.lang.String fullClassName)
           
 BootstrapManager getBootstrapManager()
           
 java.lang.String getCancelResult()
           
 DateFormatter getDateFormatter()
           
 java.util.ResourceBundle getDefaultResourceBundle()
           
 com.atlassian.event.EventManager getEventManager()
           
 FriendlyDateFormatter getFriendlyDateFormatter()
           
 Settings getGlobalSettings()
           
 ThemeHelper getHelper()
           
 I18NBean getI18n()
           
 java.util.List<Language> getInstalledLanguages()
           
 LabelManager getLabelManager()
           
 LanguageManager getLanguageManager()
           
 java.lang.String getLanguageUserFriendly(java.lang.String locale)
           
 java.util.Locale getLocale()
           
 LocaleManager getLocaleManager()
           
 java.lang.String getLocaleString()
           
 java.lang.String getNiceContentType(ContentEntityObject entityObject)
           
protected  java.util.List<java.lang.String> getPermissionTypes()
           
protected  java.util.List getPermittedEntitiesOf(java.util.Iterator entities, int maxCount)
           
protected  java.util.List getPermittedEntitiesOf(java.util.Iterator entities, int maxCount, java.util.List criteria)
           
protected  java.util.List getPermittedEntitiesOf(java.util.List entities)
           
 java.util.Date getPreviousLoginDate()
           
 int getRandom()
          Deprecated. since 2.9. Random number generation does not belong here. Please introduce your own random number generation in your own actions.
 com.atlassian.user.User getRemoteUser()
          Return the user from ServletActionContext.getRequest(), or if that is not found, the user returned from AuthenticatedUserThreadLocal.getUser().
 java.util.Map getSession()
           
 java.lang.String getText(java.lang.String key)
           
 java.lang.String getText(java.lang.String key, java.util.List list)
           
 java.lang.String getText(java.lang.String key, java.lang.Object[] args)
           
 java.lang.String getText(java.lang.String key, java.lang.String defaultValue)
          This can be used for internationalisation where an uninternationalised default string exists.
static java.lang.String getTextStatic(java.lang.String key)
           
static java.lang.String getTextStatic(java.lang.String key, java.lang.Object[] list)
           
 java.lang.String getTextStrict(java.lang.String key)
           
 TimeZone getTimeZone()
           
 com.atlassian.user.User getUser(java.lang.String username)
           
 UserAccessor getUserAccessor()
           
 java.lang.String getUserFullName(java.lang.String username)
           
protected  UserInterfaceState getUserInterfaceState()
           
 WebInterfaceContext getWebInterfaceContext()
          Returns a context which can be passed to web items when rendering them.
 com.atlassian.plugin.web.WebInterfaceManager getWebInterfaceManager()
           
protected  boolean hasPermissionForSpace(java.util.List permissionTypes, Space space)
           
 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(java.lang.Object object)
           
 boolean isPermissionCheck()
           
 boolean isPermitted()
           
 java.lang.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(java.lang.String cancel)
          Set by the "cancel" button on forms.
 void setEventManager(com.atlassian.event.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 setPermissionCheck(boolean permissionCheck)
           
 void setPermissionManager(PermissionManager permissionManager)
           
 void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)
           
 void setPreviousLoginDate(java.util.Date previousLoginDate)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
           
 void setUserAccessor(UserAccessor userAccessor)
           
 void setWebInterfaceManager(com.atlassian.plugin.web.WebInterfaceManager webInterfaceManager)
           
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, execute, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, setActionErrors, setActionMessages, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

@Deprecated
protected org.apache.log4j.Logger log
Deprecated. since 2.6.1 create a private static logger in your action class

CANCEL

public static final java.lang.String CANCEL
See Also:
Constant Field Values

PREVIEW

public static final java.lang.String PREVIEW
See Also:
Constant Field Values

LICENSE_EXPIRED

public static final java.lang.String LICENSE_EXPIRED
See Also:
Constant Field Values

LICENSE_USERS_EXCEEDED

public static final java.lang.String LICENSE_USERS_EXCEEDED
See Also:
Constant Field Values

DEVMODE

public static final java.lang.String DEVMODE
See Also:
Constant Field Values

userAccessor

protected UserAccessor userAccessor

eventManager

protected com.atlassian.event.EventManager eventManager

spacePermissionManager

protected SpacePermissionManager spacePermissionManager

permissionManager

protected PermissionManager permissionManager

settingsManager

protected SettingsManager settingsManager

labelManager

protected LabelManager labelManager

languageManager

protected LanguageManager languageManager

i18NBeanFactory

protected I18NBeanFactory i18NBeanFactory

webInterfaceManager

protected com.atlassian.plugin.web.WebInterfaceManager webInterfaceManager

permitted

protected boolean permitted

pluginAccessor

protected com.atlassian.plugin.PluginAccessor pluginAccessor
Constructor Detail

ConfluenceActionSupport

public ConfluenceActionSupport()
Method Detail

setCancel

public void setCancel(java.lang.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.

isCanceled

public boolean isCanceled()
Has this action been cancelled? Used by CancellingInterceptor to determine if the action should be executed.

See Also:
setCancel(String)

getRandom

public int getRandom()
Deprecated. since 2.9. Random number generation does not belong here. Please introduce your own random number generation in your own actions.


doDefault

public java.lang.String doDefault()
                           throws java.lang.Exception
Default webwork action execution method.

Overrides:
doDefault in class com.opensymphony.xwork.ActionSupport
Returns:
the action result
Throws:
java.lang.Exception - if something goes wrong

getText

public java.lang.String getText(java.lang.String key)
Specified by:
getText in interface com.opensymphony.xwork.TextProvider
Overrides:
getText in class com.opensymphony.xwork.ActionSupport

getText

public java.lang.String getText(java.lang.String key,
                                java.lang.String defaultValue)
This can be used for internationalisation where an uninternationalised default string exists. If the key is null or returns a null value, then the default will be used instead.

Specified by:
getText in interface com.opensymphony.xwork.TextProvider
Overrides:
getText in class com.opensymphony.xwork.ActionSupport

getText

public java.lang.String getText(java.lang.String key,
                                java.lang.Object[] args)

getText

public java.lang.String getText(java.lang.String key,
                                java.util.List list)
Specified by:
getText in interface com.opensymphony.xwork.TextProvider
Overrides:
getText in class com.opensymphony.xwork.ActionSupport

getActionName

public java.lang.String getActionName(java.lang.String fullClassName)

getActionName

public java.lang.String getActionName()
Returns the internationalised name of the current action.

Since:
3.1

getTextStrict

public java.lang.String getTextStrict(java.lang.String key)

isPrintableVersion

public boolean isPrintableVersion()

isPermittedAsString

public java.lang.String isPermittedAsString()

isPermitted

public boolean isPermitted()

getPermissionTypes

protected java.util.List<java.lang.String> getPermissionTypes()

isPermissionCheck

public boolean isPermissionCheck()

setPermissionCheck

public void setPermissionCheck(boolean permissionCheck)

getRemoteUser

public com.atlassian.user.User getRemoteUser()
Return the user from ServletActionContext.getRequest(), or if that is not found, the user returned from AuthenticatedUserThreadLocal.getUser().

Returns:
the remote user

getUser

public com.atlassian.user.User getUser(java.lang.String username)

getUserFullName

public java.lang.String getUserFullName(java.lang.String username)

addPermissionTypeTo

protected void addPermissionTypeTo(java.lang.String permissionType,
                                   java.util.List<java.lang.String> permissionTypes)

getPermittedEntitiesOf

protected java.util.List getPermittedEntitiesOf(java.util.List entities)

getPermittedEntitiesOf

protected java.util.List getPermittedEntitiesOf(java.util.Iterator entities,
                                                int maxCount,
                                                java.util.List criteria)

getPermittedEntitiesOf

protected java.util.List getPermittedEntitiesOf(java.util.Iterator entities,
                                                int maxCount)

setPreviousLoginDate

public void setPreviousLoginDate(java.util.Date previousLoginDate)

getPreviousLoginDate

public java.util.Date getPreviousLoginDate()

isExternalUserManagementEnabled

public boolean isExternalUserManagementEnabled()

addToHistory

protected void addToHistory(ContentEntityObject content)

getSession

public java.util.Map getSession()

getUserInterfaceState

protected UserInterfaceState getUserInterfaceState()

isAnonymousUser

public boolean isAnonymousUser()

isDevMode

public boolean isDevMode()
Returns true if the system property confluence.devmode is set and has the value "true".

Returns:
boolean

getCancelResult

public java.lang.String getCancelResult()

getNiceContentType

public java.lang.String getNiceContentType(ContentEntityObject entityObject)

getDefaultResourceBundle

public java.util.ResourceBundle getDefaultResourceBundle()

getGlobalSettings

public Settings getGlobalSettings()

isEmailVisible

public boolean isEmailVisible()

isLabelable

public boolean isLabelable(java.lang.Object object)

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

hasPermissionForSpace

protected boolean hasPermissionForSpace(java.util.List permissionTypes,
                                        Space space)

getEventManager

public com.atlassian.event.EventManager getEventManager()

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

setBootstrapManager

public void setBootstrapManager(BootstrapManager bootstrapManager)

getBootstrapManager

public BootstrapManager getBootstrapManager()

setSpacePermissionManager

public void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)

setPermissionManager

public void setPermissionManager(PermissionManager permissionManager)

getWebInterfaceManager

public com.atlassian.plugin.web.WebInterfaceManager getWebInterfaceManager()

setWebInterfaceManager

public void setWebInterfaceManager(com.atlassian.plugin.web.WebInterfaceManager webInterfaceManager)

setLabelManager

public void setLabelManager(LabelManager labelManager)

getLabelManager

public LabelManager getLabelManager()

setLanguageManager

public void setLanguageManager(LanguageManager languageManager)

getLanguageManager

public LanguageManager getLanguageManager()

getHelper

public ThemeHelper getHelper()

getUserAccessor

public UserAccessor getUserAccessor()

setUserAccessor

public void setUserAccessor(UserAccessor userAccessor)

getTextStatic

public static java.lang.String getTextStatic(java.lang.String key)

getTextStatic

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

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface com.opensymphony.xwork.LocaleProvider
Overrides:
getLocale in class com.opensymphony.xwork.ActionSupport

getLocaleString

public java.lang.String getLocaleString()

getLanguageUserFriendly

public java.lang.String getLanguageUserFriendly(java.lang.String locale)

getInstalledLanguages

public java.util.List<Language> getInstalledLanguages()

addFieldError

public void addFieldError(java.lang.String fieldName,
                          java.lang.String textKey,
                          java.lang.Object[] args)
XML-escapes any String arguments to avoid cross-site scripting problems with user input.

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

addActionError

public void addActionError(java.lang.String textKey,
                           java.lang.Object[] args)
XML-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

getI18n

public I18NBean getI18n()

setLocaleManager

public void setLocaleManager(LocaleManager localeManager)

getLocaleManager

public LocaleManager getLocaleManager()

setI18NBeanFactory

public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)

getTimeZone

public TimeZone getTimeZone()

getDateFormatter

public DateFormatter getDateFormatter()

getFriendlyDateFormatter

public FriendlyDateFormatter getFriendlyDateFormatter()

formatFriendlyDate

public java.lang.String formatFriendlyDate(java.util.Date date)

setFormatSettingsManager

public void setFormatSettingsManager(FormatSettingsManager formatSettingsManager)

isUsingHSQL

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

setI18NBean

public void setI18NBean(I18NBean i18NBean)

getWebInterfaceContext

public WebInterfaceContext getWebInterfaceContext()
Description copied from interface: WebInterface
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.

Specified by:
getWebInterfaceContext in interface WebInterface

isSharedMode

public boolean isSharedMode()

isUserStatusPluginEnabled

public boolean isUserStatusPluginEnabled()
Temporary method until we have plugin points to require i18n keys. CONF-15428

Returns:
true if "user status" is enabled.

setPluginAccessor

public void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)


Copyright © 2003-2010 Atlassian. All Rights Reserved.