JIRA 4.0 : How do I get a handle to the model (issues) then iterate?
This page last changed on Feb 23, 2006 by bpatters7.
All of the objects defined externally to these methods are available to a JIRA plugin via [dependency injection]. /** * Retrieve a list of all the issues in the current project. * Note that several of these objects are passed via dependency injection as * constructor parameters. * @return list of Issue objects */ public List getAllIssuesInCurrentProject() { SearchRequest sr = new SearchRequest(authenticationContext.getUser()); sr.addParameter(new ProjectParameter(currentProjectId)); List issuesGenericValues = null; List issues = new ArrayList(); try { issuesGenericValues = searchProvider.search(sr, authenticationContext.getUser()); // convert to issue types issues = convertGenericValuesToIssues(issuesGenericValues); } catch (SearchException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. errorMessage += "exception: " + e.getMessage(); } return issues; } /** * GenericValue objects are the frequently used return type, but dealing with * Issue object is more helpful for this plugin. Hence this convenience method * converts a collection of GenericValues to Issue objects. * * @param issuesGenericValues * @return List of issues */ public List convertGenericValuesToIssues (Collection issuesGenericValues) { List issues = new ArrayList(); for (Iterator iterator = issuesGenericValues.iterator(); iterator.hasNext();) { GenericValue genericValue = (GenericValue) iterator.next(); issues.add(issueFactory.getIssue(genericValue)); } return issues; } |
![]() |
Document generated by Confluence on Oct 06, 2009 00:31 |