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, MessageHolderAware, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, Serializable
Direct Known Subclasses:
AbstractBackupRestoreAction, AbstractCommandAction, AbstractEntityPaginationAction, AbstractGroupAction, AbstractLabelsForEntityAction, AbstractLogoAction, AbstractPageAwareAction, AbstractPermissionsAction, AbstractSetupAction, AbstractSetupEmailAction, AbstractSpaceAction, AbstractTrustedApplicationAction, AbstractUpdateLicenseAction, AbstractUserProfileAction, AbstractUsersAction, AbstractUserStatusJsonResultAction, AbstractViewAction, AbstractViewAttachmentsAction, AbstractViewUserProfileAction, AddAction, AddFavouriteAction, AddLabelAction, AddLabelAjaxAction, AddSpaceToFavouriteAjaxAction, AdministrationConsoleAction, AdminStylesheetAction, AdvancedSearchTipsAction, AttachedImagesAction, AttachFileAction, AttachmentNotFoundAction, AttachmentStorageSetupAction, AuthenticateAction, AutocompleteLabelsAction, BreadcrumbAction, BrowseCommentsAction, BrowseMacrosAction, BrowseShortcutsAction, BuildIndexAction, CacheStatisticsAction, ChangeScheduleAction, ClearUserStatusAction, ClusterConfigurationAction, ColorsStylesheetAction, ColourPickerAction, CombinedStylesheetAction, ConfigureCaptchaAction, ConfigureLanguageAction, ConfigureLog4jAction, ConfigureRssFeedAction, ConfirmationAction, ConfirmEmailAction, ContentNameSearchAction, ContentRemigrationAction, CreateRssFeedAction, CropPhotoAction, CustomHtmlAction, CustomStylesheetAction, DailyBackupAdminAction, DashboardAction, DeleteUserStatusAction, DeprecationTestAction, DraftAttachmentSearchAction, DropAuthenticationAction, EditMyProfileAction, EditSiteLogoAction, EditStylesheetAction, EncodingTestAction, ExternalUserConnectivityAction, FindRestrictableEntitiesAction, FlushCacheAction, FlushIndexQueueAction, FollowUserAction, ForceUpgradeAction, ForgotUserPasswordAction, FourOhFourAction, GeneralConfigurationAction, GetFutureSchedulesAction, GetTemplatesAction, GlobalRssFeedAction, HeartbeatAction, HistoryAction, HomepageAction, IndexProgressAction, JobAction, LikeAction, ListNewOrUpdatedPagesAction, ListWatchersAction, LogoutAction, LongRunningTaskMonitorAction, ManageAdminTaskAction, ManagePluginsAction, ManageReferrersAction, MigrateExternalMembershipsAction, MigrateUserPropertyEntriesAction, NetworkFeedAction, NoRequireAnnotationAction, NotificationsAction, OpenSearchDescriptorAction, PageDestinationSearchAction, PageNotFoundAction, PageNotificationAction, PageNotPermittedAction, PageSummaryAction, PeopleDirectoryAction, PluginOsgiExportsAction, PopularContentAction, PurgeReferrersAction, RebuildAncestorTableAction, RefreshLicensingAction, ReIndexAction, ReindexTaskProgressAction, RemoveFavouriteAction, RemoveHistoricalVersionAction, RemoveLabelAction, RemoveLabelAjaxAction, RemoveMailServerAction, RemoveSpaceFromFavouriteAjaxAction, RequireGetMethodAction, RequirePostMethodAction, ResetUserPasswordAction, ResumeDraftAction, SearchIndexesAction, SearchSiteAction, SecurityConfigurationAction, SendTestEmailAction, SettingsAction, SetupDBOtherAction, SiteDarkFeaturesAction, SiteSupportAction, StartClusterAction, StaticRenderingAction, SuggestLabelsAction, SummaryEmailAdminAction, ThemeColorsStylesheetAction, TinyMceEmotionsAction, TinyUrlAction, UnFollowUserAction, UploadAction, UploadProfilePictureAction, UserMacroAction, UserPopupAction, UserSearchAction, ValidateLabelAjaxAction, VelocityResultAction, ViewGadgetsAdminAction, ViewIndexQueueAction, ViewMailQueueAction, ViewMailServersAction, ViewSpaceDirectoryAction, ViewSystemClasspathAction, ViewSystemInfoAction, ViewUserHistoryAction, WhatsNewSettingsAction, WysiwygConverterAction, XsrfTokenExpiredAction

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

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 String CANCEL
           
static String DEVMODE
           
protected  com.atlassian.event.EventManager eventManager
           
protected  I18NBeanFactory i18NBeanFactory
           
protected  LabelManager labelManager
           
protected  LanguageManager languageManager
           
static String LICENSE_EXPIRED
           
static 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  MessageHolder messageHolder
           
protected  PermissionManager permissionManager
           
protected  boolean permitted
           
protected  com.atlassian.plugin.PluginAccessor pluginAccessor
           
static 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(String textKey, Object... args)
          Adds an error to the current action which will be displayed to the user.
 void addActionMessage(String textKey, Object... args)
          Adds a message 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.
protected  void addPermissionTypeTo(String permissionType, List<String> permissionTypes)
           
protected  void addToHistory(ContentEntityObject content)
           
 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()
           
protected  String getCancel()
          get the value of the cancel parameter
 String getCancelResult()
           
 Map<String,Object> getContext()
           
 String getDateFormatSetting()
           
 DateFormatter getDateFormatter()
           
 ResourceBundle getDefaultResourceBundle()
           
 String getDocLink(String page)
          Creates a version specific documentation link for the provided page.
 com.atlassian.event.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()
           
 MessageHolder getMessageHolder()
           
 String getNiceContentType(ContentEntityObject entityObject)
          Deprecated. since 4.2 - use ContentUiSupport directly
protected  List<String> getPermissionTypes()
           
protected  List getPermittedEntitiesOf(Iterator entities, int maxCount)
           
protected  List getPermittedEntitiesOf(Iterator entities, int maxCount, List criteria)
           
protected  List getPermittedEntitiesOf(List entities)
           
 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 AuthenticatedUserThreadLocal.getUser().
 Map getSession()
           
 SystemInformationService getSystemInformationService()
           
 String getText(String key)
           
 String getText(String key, List list)
           
 String getText(String key, Object[] args)
           
 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()
           
 com.atlassian.user.User getUser(String username)
           
 UserAccessor getUserAccessor()
           
 String getUserFullName(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(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(Object object)
           
 boolean isPermissionCheck()
           
 boolean isPermitted()
           
 String isPermittedAsString()
           
 boolean isPrintableVersion()
           
 boolean isSharedMode()
          Deprecated. since 5.0. Shared-mode not supported since 3.0.
 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 setContentUiSupport(ContentUiSupport contentUiSupport)
           
 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 setLoginManager(LoginManager loginManager)
           
 void setMessageHolder(MessageHolder messageHolder)
           
 void setPermissionCheck(boolean permissionCheck)
           
 void setPermissionManager(PermissionManager permissionManager)
           
 void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)
           
 void setPreviousLoginDate(Date previousLoginDate)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
           
 void setSystemInformationService(SystemInformationService systemInformationService)
           
 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
 
Methods inherited from interface com.atlassian.confluence.validation.MessageHolderAware
validate
 

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 String CANCEL
See Also:
Constant Field Values

PREVIEW

public static final String PREVIEW
See Also:
Constant Field Values

LICENSE_EXPIRED

public static final String LICENSE_EXPIRED
See Also:
Constant Field Values

LICENSE_USERS_EXCEEDED

public static final String LICENSE_USERS_EXCEEDED
See Also:
Constant Field Values

DEVMODE

public static final 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

messageHolder

protected MessageHolder messageHolder

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(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)

getCancel

protected String getCancel()
get the value of the cancel parameter

Returns:
the value of the cancel parameter if the action has been cancelled

getRandom

@Deprecated
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 String doDefault()
                 throws Exception
Default webwork action execution method.

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

getText

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

getText

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.

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

getText

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

getText

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

getActionName

public String getActionName(String fullClassName)

getActionName

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

Since:
3.1

getTextStrict

public String getTextStrict(String key)

isPrintableVersion

public boolean isPrintableVersion()

isPermittedAsString

public String isPermittedAsString()

isPermitted

public boolean isPermitted()

getPermissionTypes

protected List<String> getPermissionTypes()

isPermissionCheck

public boolean isPermissionCheck()

setPermissionCheck

public void setPermissionCheck(boolean permissionCheck)

getRemoteUser

public com.atlassian.user.User getRemoteUser()
Return the user from AuthenticatedUserThreadLocal.getUser(). This user is usually set by UserThreadLocalFilter for request threads.

Returns:
the remote user

getUser

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

getUserFullName

public String getUserFullName(String username)

addPermissionTypeTo

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

getPermittedEntitiesOf

protected List getPermittedEntitiesOf(List entities)

getPermittedEntitiesOf

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

getPermittedEntitiesOf

protected List getPermittedEntitiesOf(Iterator entities,
                                      int maxCount)

setPreviousLoginDate

public void setPreviousLoginDate(Date previousLoginDate)

getPreviousLoginDate

public Date getPreviousLoginDate()

isExternalUserManagementEnabled

public boolean isExternalUserManagementEnabled()

addToHistory

protected void addToHistory(ContentEntityObject content)

getSession

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

getNiceContentType

@Deprecated
public String getNiceContentType(ContentEntityObject entityObject)
Deprecated. since 4.2 - use ContentUiSupport directly


getDefaultResourceBundle

public ResourceBundle getDefaultResourceBundle()

getGlobalSettings

public Settings getGlobalSettings()

isEmailVisible

public boolean isEmailVisible()

isLabelable

public boolean isLabelable(Object object)

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

hasPermissionForSpace

protected boolean hasPermissionForSpace(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)

setLoginManager

public void setLoginManager(LoginManager loginManager)

getTextStatic

public static String getTextStatic(String key)

getTextStatic

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

getLocale

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

getLocaleString

public String getLocaleString()

getLanguageUserFriendly

public String getLanguageUserFriendly(String locale)

getInstalledLanguages

public List<Language> getInstalledLanguages()

addFieldError

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

addActionError

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

addActionMessage

public void addActionMessage(String textKey,
                             Object... args)
Adds a message 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

getI18n

public I18NBean getI18n()

getDocLink

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.

getSystemInformationService

public SystemInformationService getSystemInformationService()

setSystemInformationService

public void setSystemInformationService(SystemInformationService systemInformationService)

setLocaleManager

public void setLocaleManager(LocaleManager localeManager)

getLocaleManager

public LocaleManager getLocaleManager()

setI18NBeanFactory

public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)

setMessageHolder

public void setMessageHolder(MessageHolder messageHolder)
Specified by:
setMessageHolder in interface MessageHolderAware

getMessageHolder

public MessageHolder getMessageHolder()
Specified by:
getMessageHolder in interface MessageHolderAware

getTimeZone

public TimeZone getTimeZone()

getDateFormatter

public DateFormatter getDateFormatter()

getFriendlyDateFormatter

public FriendlyDateFormatter getFriendlyDateFormatter()

getDateFormatSetting

public String getDateFormatSetting()

formatFriendlyDate

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

@Deprecated
public boolean isSharedMode()
Deprecated. since 5.0. Shared-mode not supported since 3.0.


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)

getContext

public Map<String,Object> getContext()

setContentUiSupport

public void setContentUiSupport(ContentUiSupport contentUiSupport)


Copyright © 2003-2013 Atlassian. All Rights Reserved.