Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Use a Java-Plugin to add a Macro in a Page

rpenkert May 26, 2015

Hi,

How can I add a Macro into a Page with a Java-Plugin?.

I found that : https://answers.atlassian.com/questions/251765

But i doesn´t helped me at all.

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
rpenkert May 27, 2015

There are two ways to manage that.

The first way doesn´t work for me, using the Rest-API:

https://developer.atlassian.com/confdev/confluence-rest-api/confluence-rest-api-examples

because i got a verry confusing error at the PUT-Command.

BUT

with the Rest-Api GET command, i could find that XHTML-Statement which integrates the Plugin in the Page-Body.

So use the following code to add a Plugin:

Page page = pageManager.getPage(YOUR-PLUGIN-ID);
ContentEntityObject pageCeo = page.getContentEntityObject();
BodyContent bc = pageCeo.getBodyContent();
String body = bc.getBody();
String newBody = "<ac:structured-macro ac:name=\"YOUR-PLUGIN-NAME\" />" +body;
bc.setBody(newBody);
pageCeo.setBodyContent(bc);
TAGS
AUG Leaders

Atlassian Community Events