If you've followed the steps in Confluence Blueprints and Writing a Blueprint - Intermediate and find that your Blueprint needs more flexibility, you're probably going to want a custom action and may have to interact with some other components made available by the Blueprint API.
The Blueprint API is provided by a plugin called the confluence-create-content-plugin, so to interact with the API you will have to add a dependency in your project's pom.xml
.
1 2<dependency> <groupId>com.atlassian.confluence.plugins</groupId> <artifactId>confluence-create-content-plugin</artifactId> <!-- 1.5.25 is the version released with Confluence 5.1.4 --> <version>1.5.25</version> <scope>provided</scope> </dependency>
If the only functionality you need to add to the default behaviour is to take some action after the Blueprint is created, you can listen for the BlueprintPageCreateEvent
.
1 2public class MyBlueprintListener { private static final ModuleCompleteKey MY_BLUEPRINT_KEY = new ModuleCompleteKey( "com.atlassian.confluence.plugins.myplugin", "myplugin-blueprint"); public MyBlueprintListener(EventPublisher eventPublisher) { eventPublisher.register(this); } @EventListener public void onBlueprintCreateEvent(BlueprintPageCreateEvent event) { ModuleCompleteKey moduleCompleteKey = event.getBluePrintKey(); if (MY_BLUEPRINT_KEY.equals(moduleCompleteKey)) { // Take some action when a My Plugin Blueprint is created System.out.println("Created your kind of blueprint"); } } }
You will also need to register the class as a component in your atlassian-plugin.xml
1 2<component key="my-listener" class="myplugin.MyBlueprintListener" />
We are currently in the process of updating this Blueprints API for v2.
Please contact us if you require access to these managers in your plugin.
If you need to interact with the Blueprints API at a low level, you can import and use these components:
Component Key | Interface | Methods |
---|---|---|
blueprintManager | com.atlassian.confluence.plugins.createcontent.actions.BlueprintManager |
|
contentGenerator | com.atlassian.confluence.plugins.createcontent.actions.BlueprintContentGenerator |
|
Rate this page: