Class ConfluenceActionSupport

    • 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.
      • getCancel

        protected String getCancel()
        get the value of the cancel parameter
        Returns:
        the value of the cancel parameter if the action has been cancelled
      • doDefault

        public String doDefault()
                         throws Exception
        Convenient Action execution method which defaults to returning INPUT
        Throws:
        Exception
      • getText

        public String getText​(String key)
        Specified by:
        getText in interface com.opensymphony.xwork2.TextProvider
        Overrides:
        getText in class com.opensymphony.xwork2.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.xwork2.TextProvider
        Overrides:
        getText in class com.opensymphony.xwork2.ActionSupport
      • getText

        public String getText​(String key,
                              String defaultValue,
                              String obj)
        Specified by:
        getText in interface com.opensymphony.xwork2.TextProvider
        Overrides:
        getText in class com.opensymphony.xwork2.ActionSupport
      • getText

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

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

        public String getText​(String key,
                              String[] args)
        Specified by:
        getText in interface com.opensymphony.xwork2.TextProvider
        Overrides:
        getText in class com.opensymphony.xwork2.ActionSupport
      • getText

        public String getText​(String key,
                              String defaultValue,
                              String[] args)
        Specified by:
        getText in interface com.opensymphony.xwork2.TextProvider
        Overrides:
        getText in class com.opensymphony.xwork2.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()
      • isPermitted

        public boolean isPermitted()
      • getPermissionTypes

        protected List<String> getPermissionTypes()
      • useSkipAccessCheck

        public final void useSkipAccessCheck​(boolean skipAccessCheck)
        For use by ConfluenceAccessInterceptor to indicate that access checking has already been performed.

        Do NOT under any circumstance use setter notation for this public method as doing so will make it parameter injectable.

      • isSkipAccessCheck

        public boolean isSkipAccessCheck()
      • getUserByName

        public ConfluenceUser getUserByName​(String username)
        Returns user by name. Lookups are cached.
        Returns:
        user by name
        Since:
        5.2
      • getUserFullName

        public String getUserFullName​(String username)
      • getUserProfilePicUrl

        @Deprecated(since="5.10",
                    forRemoval=true)
        public String getUserProfilePicUrl()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 5.10. Use $userAvatarUriReference, which is provided in the velocity context by SitemeshContextItemProvider
        Returns:
        the download path to the profile picture of the current user
      • addPermissionTypeTo

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

        protected <TYPE> List<TYPE> getPermittedEntitiesOf​(List<TYPE> entities)
      • getPermittedEntitiesOf

        protected <TYPE> List<TYPE> getPermittedEntitiesOf​(Iterator<TYPE> entities,
                                                           int maxCount)
      • setPreviousLoginDate

        public void setPreviousLoginDate​(Date previousLoginDate)
      • getPreviousLoginDate

        public Date getPreviousLoginDate()
      • isExternalUserManagementEnabled

        public boolean isExternalUserManagementEnabled()
      • withServletRequestSupplier

        public void withServletRequestSupplier​(Supplier<javax.servlet.http.HttpServletRequest> servletRequestSupplier)
        Since:
        7.0.1
      • getCurrentRequest

        protected javax.servlet.http.HttpServletRequest getCurrentRequest()
      • getCurrentSession

        protected javax.servlet.http.HttpSession getCurrentSession()
      • getSession

        @Deprecated(forRemoval=true)
        public Map getSession()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 5.9. This method is too tightly couple to the XWork API. No replacement
      • 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
      • getFrontendServiceURL

        public String getFrontendServiceURL()
        Returns the URL of the Confluence Frontend microservice.
        Returns:
        String
        Since:
        5.10
      • getCancelResult

        public String getCancelResult()
      • getDefaultResourceBundle

        public ResourceBundle getDefaultResourceBundle()
      • getGlobalSettings

        public Settings getGlobalSettings()
      • isEmailVisible

        public boolean isEmailVisible()
      • isLabelable

        public boolean isLabelable​(Object object)
      • getUserHasLicensedAccess

        public final boolean getUserHasLicensedAccess()
        Used by velocity to add to page meta data, indicating if the current user has licensed access to Confluence.
      • getUserHasBrowseUsersPermission

        public final boolean getUserHasBrowseUsersPermission()
        Used by velocity to add to page meta data, indicating if the current user has browse users permission.
        Since:
        6.13.0
      • getAccessMode

        public final String getAccessMode()
        Used by velocity to add to page meta data, indicating the current access mode
      • 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)
      • setBootstrapStatusProvider

        public void setBootstrapStatusProvider​(BootstrapStatusProvider bootstrapStatusProvider)
        Since:
        8.7
      • setSpacePermissionManager

        public void setSpacePermissionManager​(SpacePermissionManager spacePermissionManager)
      • setPermissionManager

        public void setPermissionManager​(PermissionManager permissionManager)
      • getWebInterfaceManager

        @Deprecated(forRemoval=true)
        public com.atlassian.plugin.web.WebInterfaceManager getWebInterfaceManager()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 8.5.5, use the webInterfaceManager protected field directly when extending this class.
        Do not provide public getters for beans that allow mutation. Such beans can be accessed from Velocity templates.
      • setWebInterfaceManager

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

        public void setLabelManager​(LabelManager labelManager)
      • setLanguageManager

        public void setLanguageManager​(LanguageManager languageManager)
      • getUserAccessor

        @Deprecated(forRemoval=true)
        protected UserAccessor getUserAccessor()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 8.8.0, use the userAccessor protected field directly when extending this class.
        Do not provide public getters for beans that allow mutation. Such beans can be accessed from Velocity templates.
      • setUserAccessor

        public void setUserAccessor​(UserAccessor userAccessor)
      • setLoginManager

        public void setLoginManager​(LoginManager loginManager)
      • getLocale

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

        public String getLocaleString()
      • getLanguageUserFriendly

        public String getLanguageUserFriendly​(String locale)
      • getLanguageJs

        public String getLanguageJs()
      • getUserLocaleDefaultDatePattern

        public String getUserLocaleDefaultDatePattern()
      • setApiDateFormatService

        public void setApiDateFormatService​(DateFormatService dateFormatService)
      • getInstalledLanguages

        public List<Language> getInstalledLanguages()
        We MUST use the accessor here, otherwise languageManager may be null
        See Also:
        AbstractSetupAction
      • 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
      • 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

        @Deprecated(forRemoval=true)
        protected SystemInformationService getSystemInformationService()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 8.5.5, use the systemInformationService protected field directly when extending this class.
        Do not provide public getters for beans that allow mutation. Such beans can be accessed from Velocity templates.
      • setSystemInformationService

        public void setSystemInformationService​(SystemInformationService systemInformationService)
      • setLocaleManager

        public void setLocaleManager​(LocaleManager localeManager)
      • setI18NBeanFactory

        public void setI18NBeanFactory​(I18NBeanFactory i18NBeanFactory)
      • getTimeZone

        public TimeZone getTimeZone()
      • getDefaultTimeZone

        public TimeZone getDefaultTimeZone()
      • 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 surprisingly difficult to have a generic piece of logic that can be used in decorators.
        Returns:
        true if Confluence is currently using a Hypersonic database
      • isUsingH2

        public boolean isUsingH2()
        Placing this method in ConfluenceActionSupport is a bit of a hack, but it is surprisingly difficult to have a generic piece of logic that can be used in decorators.
        Returns:
        true if Confluence is currently using an H2 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, Struts actions will implement this to provide extra details in the context such as content objects, and so on.

        Specified by:
        getWebInterfaceContext in interface WebInterface
      • 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)
      • setContentUiSupport

        public void setContentUiSupport​(ContentUiSupport contentUiSupport)
      • setTimeZoneManager

        public void setTimeZoneManager​(com.atlassian.sal.api.timezone.TimeZoneManager timeZoneManager)
      • setConfluenceAccessManager

        public void setConfluenceAccessManager​(ConfluenceAccessManager confluenceAccessManager)
      • setAccessModeService

        public void setAccessModeService​(AccessModeService accessModeService)
      • getPersonService

        @Deprecated(forRemoval=true)
        protected PersonService getPersonService()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 8.8.0, use the personService protected field directly when extending this class.
        Do not provide public getters for beans that allow mutation. Such beans can be accessed from Velocity templates.
      • setApiPersonService

        public void setApiPersonService​(PersonService personService)