Hey community,
maybe someone out there can help me out on this one. I've written a small user macro to set certain content properties in order to get/display them (via a different user macro) somewhere on a Confluence page.
The whole setup worked like a charm until I upgraded to the latest Confluence version and installed a reverse proxy with SSL before the Tomcat. The whole system is still working flawlessly (application links to JIRA/Bitbucket, other macros etc.)... but something seems to have broken the macro.
This is the macro itself (don't mind the "tollgate_step macro", which is simply some fancy CSS stuff):
## Macro title: SWTollGate
## Macro has a body: N
## Body processing:
## Output: Selected output option
##
## Developed by: Dominic Finke
## Date created: 06/03/2018
## Installed by: Dominic Finke
## @param swstep:title=SW TG Step|type=enum|enumValues=TG1,TG2,TG3,TG4,TG5|default=TG1|desc=SW TollGate Step
## @param swstepduedate:title=SW Step Due Date|type=date|default=|desc=Due Date Of This SW TollGate Step - Format dd-mm-yyyy
#set($returnstatus="InProgress")
#foreach ($mflabel in $content.getLabels())
#if($mflabel.toString()=="$paramswstep.toLowerCase()")
#set($returnstatus="Done")
#end
#end
<ac:structured-macro ac:macro-id="663211e4-2bb1-40fa-afff-55b919fc1b47" ac:name="tollgate_step" ac:schema-version="1">
<ac:parameter ac:name="title">$paramswstep</ac:parameter>
<ac:parameter ac:name="status">$returnstatus</ac:parameter>
</ac:structured-macro>
<p><b>Due: $paramswstepduedate</b></p>
#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, "dueDate$paramswstep", "$paramswstepduedate")
When rendering on a page, it should look / was looking like this:
But now it looks like this:
Something is clearly messed up and I can't figure out what it is. Any ideas?
Cheers,
Dom
Okay... almost forgot this. Just in case someone else has an issue like that - I already stumbled over the solution.
Turns out that Atlassian made it way more easy to get a hold of the properties in newer Confluence versions.
This:
#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, "dueDate$paramswstep", "$paramswstepduedate")
can now be achieved by this:
$content.getProperties().setStringProperty("dueDate$paramswstep", "$paramswstepduedate")
After removing the gazillion lines and put in this one-liner, everything is working normal again. Awesome! :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.