com.atlassian.confluence.admin.actions.macros
Class UserMacroAction

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.atlassian.confluence.core.ConfluenceActionSupport
          extended by com.atlassian.confluence.admin.actions.macros.UserMacroAction
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:
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
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
CANCEL, DEVMODE, eventManager, i18NBeanFactory, labelManager, languageManager, LICENSE_EXPIRED, LICENSE_USERS_EXCEEDED, log, messageHolder, permissionManager, permitted, pluginAccessor, PREVIEW, settingsManager, spacePermissionManager, userAccessor, 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
UserMacroAction()
           
 
Method Summary
protected  void addUpdateMacro(UserMacroConfig userMacro)
          Add the updated macro to the user macro library.
 int countUserMacrosWithoutMetadata()
           
 int countUserMacrosWithWikiTemplates()
           
 String doDefault()
          Default webwork action execution method.
 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
 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
 boolean getShowInMacroBrowser()
           
 UserMacroConfig getUserMacro()
           
 List<UserMacroConfig> getUserMacros()
           
 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 validateNewMacroName(String name)
           
 
Methods inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
addActionError, addActionMessage, addFieldError, addPermissionTypeTo, addToHistory, formatFriendlyDate, getActionName, getActionName, getBootstrapManager, getCancel, getCancelResult, getContext, getDateFormatSetting, getDateFormatter, getDefaultResourceBundle, getDocLink, getEventManager, getFriendlyDateFormatter, getGlobalSettings, getHelper, getI18n, getInstalledLanguages, getLabelManager, getLanguageManager, getLanguageUserFriendly, getLocale, getLocaleManager, getLocaleString, getMessageHolder, getNiceContentType, getPermissionTypes, getPermittedEntitiesOf, getPermittedEntitiesOf, getPermittedEntitiesOf, getPreviousLoginDate, getRandom, getRemoteUser, getSession, getSystemInformationService, getText, getText, getText, getText, getTextStatic, getTextStatic, getTextStrict, getTimeZone, getUser, getUserAccessor, getUserFullName, getUserInterfaceState, getWebInterfaceContext, getWebInterfaceManager, hasPermissionForSpace, isAnonymousUser, isCanceled, isDevMode, isEmailVisible, isExternalUserManagementEnabled, isLabelable, isPermissionCheck, isPermittedAsString, isPrintableVersion, isSharedMode, isUserStatusPluginEnabled, isUsingHSQL, setBootstrapManager, setCancel, setContentUiSupport, setEventManager, setFormatSettingsManager, setI18NBean, setI18NBeanFactory, setLabelManager, setLanguageManager, setLocaleManager, setLoginManager, setMessageHolder, setPermissionCheck, setPermissionManager, setPluginAccessor, setPreviousLoginDate, setSettingsManager, setSpacePermissionManager, setSystemInformationService, setUserAccessor, setWebInterfaceManager
 
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

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
Constructor Detail

UserMacroAction

public UserMacroAction()
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
Default webwork action execution method.

Overrides:
doDefault in class ConfluenceActionSupport
Returns:
the action result
Throws:
Exception - if something goes wrong

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 class ConfluenceActionSupport

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)

validateNewMacroName

protected void validateNewMacroName(String name)

validateMacroForm

protected void validateMacroForm()


Copyright © 2003-2013 Atlassian. All Rights Reserved.