Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to call next review date defined under Page Properties macro?

Amit Siddhartha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 28, 2019

What parameter needs to pass in the below code to fetch next review date, owner and description defined under Page properties macro with ID=metadate in tabular form?

import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.spaces.Space
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.sal.api.component.ComponentLocator
import groovy.xml.MarkupBuilder


def spaceManager = ComponentLocator.getComponent(SpaceManager)
def pageManager = ComponentLocator.getComponent(PageManager)

def spaces = spaceManager.allSpaces.findAll {it.isGlobal()}.take(10)

Map<Space, List<Page>> pagesInfo = spaces.collectEntries { space ->

[
(space): pageManager.getPages(space, true).findAll {
it instanceof Page
}.take(3)
]
}


def writer = new StringWriter()
def builder = new MarkupBuilder(writer)
def date = new Date()

builder.table(class: "aui") {
thead {
tr {
th("Space")
th("Page")
th("Author")
th("Next review date")
}
}

tbody {
pagesInfo.each { space, pages ->

if (pages.size() > 0) {

pages.each { page ->
tr {
th() {
b(space.name)
}
td(page.title)
td(page.creator?.name ?: "N/A")
td(page.Date = new Date())
}
}
}
}
}
}

return writer.toString()

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events