I have the following code, after much searching which will return a list of issues in an Epic .
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.fugue.Option
import com.atlassian.jira.issue.Issue
//Method to get the greenhopper bean instance
def getBean(String beanId)
{
def ghPlugin = ComponentAccessor.getPluginAccessor().getEnabledPlugin("com.pyxis.greenhopper.jira")
def descriptor = ghPlugin.getModuleDescriptor("greenhopper-launcher")
def applicationContext = descriptor.getModule().greenHopperCacheManager.applicationContext
def beanInstance = applicationContext.getBean(beanId)
return beanInstance;
}
//method to return list of issue keys in an Epic
def getEpicIssueKeys(Issue issue) {
def epic = (Option)Option.option(issue)
def epicLinkManagerImpl = getBean("epicLinkManagerImpl");
issuesInEpic = epicLinkManagerImpl.getIssuesInEpic(issue)
return issuesInEpic
}
if(issue.issueType.name=="Epic") {
return getEpicIssueKeys(issue)
}
return null
For an Epic issue, will deliver something like:
[PR-1173, PR-1174, PR-1175, PR-1191, PR-1190, PR-1193, PR-1192, PR-1195,
PR-1194, PR-1197, PR-1196, PR-1177, PR-1199, PR-1176, PR-1198, PR-1179,
PR-1178, PR-1180, PR-1182, PR-1181, PR-1184, PR-1183, PR-1186, PR-1185,
PR-1188, PR-1187, PR-1201, PR-1189, PR-1200, INF-89, INF-90, PR-1227,
PR-1523, PR-1524]
Now I need to to be able to iterate over that list, retrieve the issue associated with the key and sum the value of a custom field, say 'issueValue' which is double type. That's where I got lost.
Can anyone suggest/demonstrate how to do this?