Created
August 5, 2013 15:58
-
-
Save jamieechlin/6157054 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package examples | |
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.issue.Issue | |
import com.atlassian.jira.issue.search.SearchProvider | |
import com.atlassian.jira.jql.parser.JqlQueryParser | |
import com.atlassian.jira.web.bean.PagerFilter | |
import org.apache.log4j.Logger | |
def log = Logger.getLogger("com.onresolve.jira.groovy.MyScript") | |
def Issue issue = issue | |
log.debug("issue id is: ${issue.id}") | |
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class) | |
if (issue.key) { | |
def queryStr = "issueFunction in subtasksOf (\"issueFunction in parentsOf('key = ${issue.key}')\") and key != ${issue.key}" | |
log.debug("queryStr: $queryStr") | |
def query = jqlQueryParser.parseQuery(queryStr) | |
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class) | |
def user = ComponentAccessor.getJiraAuthenticationContext().getUser() | |
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()) | |
log.debug(results.getIssues()*.key) | |
return results.getIssues()*.key | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment