Last updated Oct 3, 2024

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 your pom.xml includes the following dependency:

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

The AbstractCreateBlueprintPageAction 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 Struts module.

You cannot, at this stage, use custom names for your Struts 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 from displaying.

Deprecation Warning

 The AbstractCreateBlueprintPageAction is no longer 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 BlueprintManager (see how to retrieve it). It gives access to the following method.

Method 
createAndPinIndexPage

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

UserBlueprintConfigManager

If you need to interact with the blueprint configuration, you can use UserBlueprintConfigManager (see how to retrieve it). It gives an access to the following 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 blueprint API at a low level, you can also use BlueprintContentGenerator (see how to retrieve it) to get access to the render context. It gives an access to following methods.

Component KeyMethods
createIndexPageObject

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

generateBlueprintPageObject

Creates an unsaved content page object for a create-Blueprint-page request.

Rate this page: