Class UserMacroAction

java.lang.Object
org.apache.struts2.ActionSupport
com.opensymphony.xwork2.ActionSupport
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, org.apache.struts2.action.Action, org.apache.struts2.interceptor.ValidationAware, org.apache.struts2.Validateable
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:
  • Field Details

    • 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 Details

    • UserMacroAction

      public UserMacroAction()
  • Method Details

    • setDocBean

      public void setDocBean(DocumentationBean docBean)
    • 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 class ConfluenceActionSupport
      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()
      Description copied from class: ConfluenceActionSupport
      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
    • getVisibleTypes

      public List<String> getVisibleTypes()
    • 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)