Class UserMacroAction
- java.lang.Object
-
- com.opensymphony.xwork2.ActionSupport
-
- com.atlassian.confluence.core.ConfluenceActionSupport
-
- com.atlassian.confluence.admin.actions.macros.UserMacroAction
-
- All Implemented Interfaces:
WebInterface
,MessageHolderAware
,com.opensymphony.xwork2.Action
,com.opensymphony.xwork2.interceptor.ValidationAware
,com.opensymphony.xwork2.LocaleProvider
,com.opensymphony.xwork2.TextProvider
,com.opensymphony.xwork2.Validateable
,Serializable
- Direct Known Subclasses:
AddUserMacroAction
,RemoveUserMacroAction
,UpdateUserMacroAction
public class UserMacroAction extends ConfluenceActionSupport
Super class for updating the user macro library and the action for viewing the library- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
macro
protected com.atlassian.renderer.v2.macro.MacroManager
macroManager
protected MacroMetadataManager
macroMetadataManager
protected UserMacroConfig
userMacro
protected UserMacroLibrary
userMacroLibrary
-
Fields inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
accessModeService, CANCEL, DEVMODE, eventManager, i18NBeanFactory, labelManager, languageManager, LICENSE_EXPIRED, LICENSE_USERS_EXCEEDED, messageHolder, permissionManager, permitted, personService, pluginAccessor, PREVIEW, settingsManager, spacePermissionManager, systemInformationService, userAccessor, webInterfaceManager
-
-
Constructor Summary
Constructors Constructor Description UserMacroAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addUpdateMacro(UserMacroConfig userMacro)
Add the updated macro to the user macro library.int
countUserMacrosWithoutMetadata()
int
countUserMacrosWithWikiTemplates()
String
doDefault()
Convenient Action execution method which defaults to returning INPUTList<String>
getBodyTypes()
Populates the body type select box Only used by AddUserMacroAction and UpdateUserMacroAction If this class gets any more complex consider using delegationList<HTMLPairType>
getCategories()
Populates the category multiple-select box Only used by AddUserMacroAction and UpdateUserMacroAction If this class gets _any_ more complex consider using delegationboolean
getShowInMacroBrowser()
String
getTemplateHtml()
protected List<UserMacroConfig>
getToBeValidatedUserMacros(@Nullable UserMacroConfig macroConfig)
UserMacroConfig
getUserMacro()
List<UserMacroConfig>
getUserMacros()
List<String>
getVisibleTypes()
boolean
isMissingMetadata(String macroName)
boolean
isPermitted()
boolean
isWikiTemplate(String macroName)
void
setMacro(String macro)
void
setMacroManager(com.atlassian.renderer.v2.macro.MacroManager macroManager)
void
setMacroMetadataManager(MacroMetadataManager macroMetadataManager)
void
setShowInMacroBrowser(boolean showInMacroBrowser)
void
setUserMacro(UserMacroConfig userMacro)
void
setUserMacroLibrary(UserMacroLibrary userMacroLibrary)
protected void
validateMacroForm()
protected void
validateMacroMissingContextVariables(@Nullable UserMacroConfig macroConfig)
protected void
validateNewMacroName(String name)
-
Methods inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
addActionError, addActionMessage, addFieldError, addPermissionTypeTo, addToHistory, formatFriendlyDate, getAccessMode, getActionName, getActionName, getAuthenticatedUser, getBootstrapManager, getBootstrapStatusProvider, getCancel, getCancelResult, getConfluenceAccessManager, getContentUiSupport, getContext, getCurrentRequest, getCurrentSession, getDateFormatSetting, getDateFormatter, getDefaultResourceBundle, getDefaultTimeZone, getDocBean, getDocLink, getEventManager, getFriendlyDateFormatter, getFrontendServiceURL, getGlobalSettings, getHelper, getI18n, getInstalledLanguages, getLabelManager, getLanguageJs, getLanguageManager, getLanguageUserFriendly, getLocale, getLocaleManager, getLocaleString, getMessageHolder, getNiceContentType, getPermissionManager, getPermissionTypes, getPermittedEntitiesOf, getPermittedEntitiesOf, getPermittedEntitiesOf, getPersonService, getPreviousLoginDate, getRemoteUser, getSession, getSystemInformationService, getText, getText, getText, getText, getText, getText, getText, getText, getTextStatic, getTextStatic, getTextStrict, getTimeZone, getUserAccessor, getUserByName, getUserFullName, getUserHasBrowseUsersPermission, getUserHasLicensedAccess, getUserInterfaceState, getUserLocaleDefaultDatePattern, getUserProfilePicUrl, getWebInterfaceContext, getWebInterfaceManager, hasPermissionForSpace, isAnonymousUser, isCanceled, isDevMode, isEmailVisible, isExternalUserManagementEnabled, isLabelable, isPrintableVersion, isSkipAccessCheck, isUserStatusPluginEnabled, isUsingH2, isUsingHSQL, setAccessModeService, setApiDateFormatService, setApiPersonService, setBootstrapManager, setBootstrapStatusProvider, setCancel, setConfluenceAccessManager, setContentUiSupport, setEventManager, setFormatSettingsManager, setI18NBean, setI18NBeanFactory, setLabelManager, setLanguageManager, setLocaleManager, setLoginManager, setMessageHolder, setPermissionManager, setPluginAccessor, setPreviousLoginDate, setServletRequestSupplier, setSettingsManager, setSpacePermissionManager, setSystemInformationService, setTimeZoneManager, setUserAccessor, setWebInterfaceManager, useSkipAccessCheck, withServletRequestSupplier
-
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, execute, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocaleProvider, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, validate
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.opensymphony.xwork2.LocaleProvider
isValidLocale, isValidLocaleString
-
Methods inherited from interface com.atlassian.confluence.validation.MessageHolderAware
validate
-
-
-
-
Field Detail
-
userMacro
protected UserMacroConfig userMacro
-
userMacroLibrary
protected UserMacroLibrary userMacroLibrary
-
macroManager
protected com.atlassian.renderer.v2.macro.MacroManager macroManager
-
macroMetadataManager
protected MacroMetadataManager macroMetadataManager
-
macro
protected String macro
-
-
Method Detail
-
getUserMacro
public UserMacroConfig getUserMacro()
-
getUserMacros
public List<UserMacroConfig> getUserMacros()
-
setUserMacroLibrary
public void setUserMacroLibrary(UserMacroLibrary userMacroLibrary)
-
setMacroManager
public void setMacroManager(com.atlassian.renderer.v2.macro.MacroManager macroManager)
-
setMacroMetadataManager
public void setMacroMetadataManager(MacroMetadataManager macroMetadataManager)
-
setMacro
public void setMacro(String macro)
-
setUserMacro
public void setUserMacro(UserMacroConfig userMacro)
-
doDefault
public String doDefault() throws Exception
Description copied from class:ConfluenceActionSupport
Convenient Action execution method which defaults to returning INPUT- Overrides:
doDefault
in classConfluenceActionSupport
- Throws:
Exception
-
addUpdateMacro
protected void addUpdateMacro(UserMacroConfig userMacro)
Add the updated macro to the user macro library. HasBody isn't displayed in the UI and it isn't worth updating with JS and killing the acceptance tests, so we set it here based on the body type. We also set hidden at this point.
-
isPermitted
public boolean isPermitted()
- Overrides:
isPermitted
in classConfluenceActionSupport
-
isWikiTemplate
public boolean isWikiTemplate(String macroName)
- Parameters:
macroName
- the name of the macro to check- Returns:
- true if the macro has a wiki formatted template.
-
isMissingMetadata
public boolean isMissingMetadata(String macroName)
-
countUserMacrosWithWikiTemplates
public int countUserMacrosWithWikiTemplates()
-
countUserMacrosWithoutMetadata
public int countUserMacrosWithoutMetadata()
-
getBodyTypes
public List<String> getBodyTypes()
Populates the body type select box Only used by AddUserMacroAction and UpdateUserMacroAction If this class gets any more complex consider using delegation- Returns:
- list of body types
-
getCategories
public List<HTMLPairType> getCategories()
Populates the category multiple-select box Only used by AddUserMacroAction and UpdateUserMacroAction If this class gets _any_ more complex consider using delegation- Returns:
- list of categories
-
getShowInMacroBrowser
public boolean getShowInMacroBrowser()
-
setShowInMacroBrowser
public void setShowInMacroBrowser(boolean showInMacroBrowser)
-
getTemplateHtml
public String getTemplateHtml()
-
validateNewMacroName
protected void validateNewMacroName(String name)
-
validateMacroForm
protected void validateMacroForm()
-
validateMacroMissingContextVariables
protected void validateMacroMissingContextVariables(@Nullable UserMacroConfig macroConfig)
-
getToBeValidatedUserMacros
protected List<UserMacroConfig> getToBeValidatedUserMacros(@Nullable UserMacroConfig macroConfig)
-
-