2016-12-05 34 views
1

這裏例如如何獲得關於這個問題的評論的數量

import com.atlassian.jira.ComponentManager 
def commentManager = ComponentManager.getInstance(). 
getCommentManager() 
def numberOfComments = commentManager.getComments(issue).size() 
return numberOfComments ? numberOfComments as Double : null 

但現在的ComponentManager已經過時?並且我嘗試:

import com.atlassian.jira.component.ComponentAccessor 
def commentManager = ComponentAccessor.commentManager 
def numberOfComment = commentManager.getComments(issue).size() 

但是,如何獲取應用的特定項目? Simmilary getInstance()。

+0

你的變量名是** **非常怪異...'ComponentManager's沒有*「CommentManager」 * S,這並不甚至使任何意義,是非常誤導...只是說 – specializt

+0

看看這裏 http://stackoverflow.com/questions/35348346/getting-issue-comments-jira-python – SgtDroelf

回答

0

這是如何訪問註釋的例子:

import com.atlassian.jira.component.ComponentAccessor 
List<String> list = new ArrayList<String>(); 
def comments = ComponentAccessor.commentManager.getComments(issue) 
if (comments) { 

for (item in comments) { 
    list.add(item.getBody()); 
} 
return list 
}