scripted cql function performance question

Aileen April 6, 2018

Hello !

I'm trying to write a custom cql function to get all unresolved comments, and I will paste the code below, but it's super slow and I think is causing some threads to be stuck - and then pages are unable to be edited, etc, etc.

Any suggestions would be greatly appreciated !

import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.spaces.Space
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.confluence.pages.Comment
import com.atlassian.confluence.pages.CommentManager


String spaceKey = params[0]


def ids = []

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

Space space = spaceManager.getSpace(spaceKey)

for (Page page : pageManager.getPages(space, true)) {
    for (Comment comment : commentManager.getPageComments(page.getId(), new Date(0))) {
        if (comment.isInlineComment() && comment.getStatus().isOpen()) {
            def parent = comment.getParent()
            if ((parent != null && parent.getStatus().isOpen())|| parent == null) {
                ids << String.valueOf(page.getId())
            }
        }
    }
}

return ids

I also posted this in the forums:  https://community.atlassian.com/t5/Adaptavist-questions/Unresolved-in-line-comments-cql-function/qaq-p/750210#U767447

Thank you!

/Aileen

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events