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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Tuesday in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

387 views 17 9
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