Confluence : Saving Theme Configurations with Bandana
This page last changed on Nov 14, 2006 by jnolen.
To persist the configuration of a theme you can make use of the Bandana persistence framework. Defining a Settings BeanThe recommended way of saving the settings, is to create a simple configuration bean which implements the Serializable interface. package com.atlassian.confluence.extra.leftnavigation; import java.io.Serializable; public class LeftNavSettings implements Serializable { private String space; private String page; public String getSpace() { return space; } public void setSpace(String space) { this.space = space; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } } Saving the BeanBandana can be used to save a configuration object with a given context, where the context refers to a space.
// Create a setting bean. LeftNavSettings settings = new LeftNavSettings(); settings.setSpace("example Space"); settings.setPage("example Page"); // Save the bean with the BandanaManager bandanaManager.setValue(new ConfluenceBandanaContext(spaceKey), THEMEKEY, settings);
Retrieving the BeanThe configuration object can be retrieved by using bandanaManager.getValue. This method will get the configuration object, starting with the given context and looking up in the context hierarchy if no context is found.
LeftNavSettings settings = (LeftNavSettings) bandanaManager.getValue(new ConfluenceBandanaContext(spaceKey), THEMEKEY);
|
![]() |
Document generated by Confluence on May 01, 2007 19:27 |