I need to access a page property via a (user) macro.
Is this possible?
Is this what you are looking for?
#set ($containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager')) #set ($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null)) #set ($containerManager=$getInstanceMethod.invoke(null,null)) #set ($containerContext=$containerManager.containerContext) #set ($contentPropertyManager=$containerContext.getComponent('contentPropertyManager')) $contentPropertyManager.setStringProperty($content, "myProperty", "Stuff") $contentPropertyManager.getStringProperty($content, "myProperty")
Thanks. myProperty would be set according to https://confluence.atlassian.com/display/DOC/Page+Properties+Macro (like Deadline in the example in that page), right?
Ah ... got it. You are looking for how to access values within a page properties macro. Not sure you could do it with a user macro. Mainly it is for paring with the page properties report macro.
$content is a reference to the current page objet? Your code showed me how to move forward. In my scenario myProperty is a JIRA issueId associated with a page that display info about that issue.
It looks like you're new here. Sign in or register to get started.