public class

CustomMacroModuleDescriptor

extends AbstractModuleDescriptor<T>
implements MacroMetadataSource MacroModuleDescriptor PluginModuleFactory<T> UserLocaleAware ApplicationContextAware
java.lang.Object
   ↳ com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
     ↳ com.atlassian.confluence.plugin.descriptor.CustomMacroModuleDescriptor

Class Overview

A plugin macro in Confluence with metadata and notation guide help.

Summary

[Expand]
Inherited Fields
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
Public Constructors
CustomMacroModuleDescriptor()
Public Methods
Macro createModule()
void disabled()
void enabled()
Macro.BodyType getBodyType()
Used by code that automatically converts a V2 macro to an XHTML macro.
String getHelp()
Returns the macro help as rendered HTML, or null if there is no help.
ResourceDescriptor getHelpDescriptor()
Returns the macro help descriptor, or null if there is no help.
String getHelpSection()
Returns the section of notation guide in which the macro help appears.
MacroMetadata getMacroMetadata()
Macro getModule()
Returns the macro defined by this module descriptor.
boolean hasBody()
A method that determines the return value of hasBody() without initialising the module (or macro).
boolean hasHelp()
Returns true if the macro has help, otherwise false.
void init(Plugin plugin, Element element)
void setApplicationContext(ApplicationContext applicationContext)
void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
void setMacroMetadataParser(MacroMetadataParser macroMetadataParser)
[Expand]
Inherited Methods
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
From class java.lang.Object
From interface com.atlassian.confluence.macro.browser.MacroMetadataSource
From interface com.atlassian.confluence.plugin.descriptor.MacroModuleDescriptor
From interface com.atlassian.confluence.plugin.module.PluginModuleFactory
From interface com.atlassian.confluence.util.i18n.UserLocaleAware
From interface com.atlassian.plugin.ModuleDescriptor
From interface com.atlassian.plugin.Resourced
From interface com.atlassian.plugin.StateAware
From interface org.springframework.context.ApplicationContextAware

Public Constructors

public CustomMacroModuleDescriptor ()

Public Methods

public Macro createModule ()

public void disabled ()

public void enabled ()

public Macro.BodyType getBodyType ()

Used by code that automatically converts a V2 macro to an XHTML macro. V2 macros without a body are automatically converted but bodied macros must specify their body type as a 'body-type attribute value ("PLAIN_TEXT", "RICH_TEXT" or "NONE" - indicates the macro really has no body after all) in the <macro> definition in the atlassian_plugin.xml.

Returns
  • BodyType.NONE for bodless macros and for bodied macros BodyType.PLAIN_TEXT, BodyType.RICH_TEXT or null if the attribute was not specified or was invalid.

public String getHelp ()

Returns the macro help as rendered HTML, or null if there is no help. The help is defined as a resource with type "velocity" and name "help" inside the macro descriptor. The resource tag can have a location attribute, referring to a file within the plugin, or a body.

public ResourceDescriptor getHelpDescriptor ()

Returns the macro help descriptor, or null if there is no help. The help is defined as a resource with type "velocity" and name "help" inside the macro descriptor. The resource tag can have a location attribute, referring to a file within the plugin, or a body.

See Also

public String getHelpSection ()

Returns the section of notation guide in which the macro help appears. Should be one of the values defined in NotationHelpAction#SECTION_KEYS. If the macro has no help, returns null.

public MacroMetadata getMacroMetadata ()

Returns
  • MacroMetadata for this macro, may be null if not defined in the descriptor.

public Macro getModule ()

Returns the macro defined by this module descriptor.

public boolean hasBody ()

A method that determines the return value of hasBody() without initialising the module (or macro). This result of this method is currently required _before_ all plugin modules are parsed and registered (including other plugin modules that may declare spring components). As such, initialising modules when the spring context is not fully initialized will result in invalid plugins being registered. In other words we don't want to break lazy initialization of plugin modules and re-introduce problems like CONF-13386.

This is only a best effort attempt. If there is any error constructing the macro using one of its constructors or an error executing hasBody(), then the value is considered false. This should only happen to small percentage of macros.

Returns

public boolean hasHelp ()

Returns true if the macro has help, otherwise false. Help can be provided by defining a resource inside the macro descriptor in the plugin XML descriptor file. The help resource has a type of "velocity" and a name of "help". It can have either a body or a "location" attribute with a reference to a Velocity file within the plugin.

public void init (Plugin plugin, Element element)

public void setApplicationContext (ApplicationContext applicationContext)

Throws
BeansException

public void setI18NBeanFactory (I18NBeanFactory i18NBeanFactory)

public void setMacroMetadataParser (MacroMetadataParser macroMetadataParser)