Custom actions with the Blueprint API

The confluence-create-content-plugin provides an  AbstractCreateBlueprintPageAction  that you can extend to add custom behavior.  To use this module, make sure you pom.xml includes the following dependency:

		<dependency>
			<groupId>com.atlassian.confluence.plugins</groupId>
			<artifactId>confluence-create-content-plugin</artifactId>
			<version>${create-content.version}</version>
			<scope>provided</scope>
		</dependency>

This dependency provides a couple of useful methods for working with Blueprints:

  • populateBlueprintPage loads the blueprint content template and generates a blueprint page from the template and the context.
  • getOrCreateIndexPage gets the index page for the blueprint or creates one if it doesn't exist, and pins it to the sidebar.

For more details on how to write and link an action in Confluence, see XWork-WebWork Module.

You cannot, at this stage, use custom names for your XWork actions that render the editor. You must use createpage and docreatepage. Using anything else prevents the buttons on the bottom left of the Confluence Editor (say for altering page level restrictions) from displaying.

Deprecation Warning

 The AbstractCreateBlueprintPageAction is no longer being used internally and is slated for removal in a future release. Please let us know via the Feedback form if your plugin currently extends this action, or if you plan to extend it.

BlueprintManager Interface

If you need to interact with the Blueprints API at a low level, you can use this component:

<component-import key="blueprintManager" interface=" com.atlassian.confluence.plugins.createcontent.actions.BlueprintManager" />

 This components gives access to this method:

Method  
createAndPinIndexPage

Creates a index page if required for this blueprint, and pins it to the Space Sidebar.

UserBlueprintConfigManager

If you need to interact with the Blueprints configuration, you can use this component:

<component-import key="userBlueprintConfigManager" interface="com.atlassian.confluence.plugins.createcontent.extensions.UserBlueprintConfigManager"/>

This component gives access to this method:

Method  
setBlueprintCreatedByUser

Flags that a Blueprint of a certain type has been created by a given user

BlueprintContentGenerator Interface

If you need to interact with the Blueprints API at a low level, you can also use this component to get access to the render context:

<component-import key="contentGenerator" interface=" com.atlassian.confluence.plugins.createcontent.actions.BlueprintContentGenerator" />

 This components gives access to these two methods:

Component Key Methods
createIndexPageObject

Creates a content page object given a plugin template and a render context.

generateBlueprintPageObject

Creates an index page object given a plugin template and a render context.

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport