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

How to get PageProperty body / key-value-pairs

Johannes R September 11, 2017

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
TAGS
AUG Leaders

Atlassian Community Events