How to get PageProperty body / key-value-pairs

I have a Page with a table containing key value pairs as a PageProperty.

I want to get those key value pairs.

I tried this java-code:

 ContentProperties properties = page.getProperties();
List<ContentProperty> cpList = properties.asList();

Iterator<ContentProperty> cpItr = cpList.iterator();
while(cpItr.hasNext()) {
ContentProperty cp = cpItr.next();
System.out.println("cp.propertieName: " + cp.getName());
System.out.println("cp.getStringValue: " + cp.getStringValue());
System.out.println("cp.toString: " + cp.toString());
if(cp.getContentEntity() != null){
System.out.println("CEBodyAsString: " + cp.getContentEntity().getBodyAsString());
}

}

 and it returns this:

[INFO] [talledLocalContainer] cp.propertieName: macro-count.code

[INFO] [talledLocalContainer] cp.getStringValue: 15-3

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@6d19f3c3

[INFO] [talledLocalContainer] cp.propertieName: macro-count.attachments

[INFO] [talledLocalContainer] cp.getStringValue: 15-1

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@4e2bde3b

[INFO] [talledLocalContainer] cp.propertieName: macro-count.toc

[INFO] [talledLocalContainer] cp.getStringValue: 15-1

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@3f71c272

[INFO] [talledLocalContainer] cp.propertieName: macro-count.jira.jqlQuery

[INFO] [talledLocalContainer] cp.getStringValue: 15-2

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@e5bc385

[INFO] [talledLocalContainer] cp.propertieName: macro-count.roadmap

[INFO] [talledLocalContainer] cp.getStringValue: 15-1

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@2cfebe66

[INFO] [talledLocalContainer] cp.propertieName: macro-count.unknown

[INFO] [talledLocalContainer] cp.getStringValue: 15-2

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@3cb477c4

[INFO] [talledLocalContainer] cp.propertieName: macro-count.jira.key

[INFO] [talledLocalContainer] cp.getStringValue: 15-1

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@d674072

[INFO] [talledLocalContainer] cp.propertieName: macro-count.info

[INFO] [talledLocalContainer] cp.getStringValue: 15-2

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@5d70fdb0

[INFO] [talledLocalContainer] cp.propertieName: macro-count.status

[INFO] [talledLocalContainer] cp.getStringValue: 15-3

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@42465f6

[INFO] [talledLocalContainer] cp.propertieName: macro-count.details

[INFO] [talledLocalContainer] cp.getStringValue: 18-1

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@5527e0ac

[INFO] [talledLocalContainer] cp.propertieName: macro-create-events-published-for-version

[INFO] [talledLocalContainer] cp.getStringValue: null

[INFO] [talledLocalContainer] cp.toString: com.atlassian.confluence.content.ContentProperty@5f33968d

So it seems to me that all the ContentProperties have empty ContentEntityObjects.

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

791 views 33 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you