You have to refresh the repository configuration before fetching
issues from the server. This will enable the parser to map project ids
received from the repository to Project objects. Here is an example
how to do that:
public class JiraClientExample {
private static final String URL = "https://mylyn.eclipse.org/jiratest";
public static void main(String[] args) {
if (args.length != 2) {
System.err.println("usage: JiraClientExample username
password");
System.exit(1);
}
JiraClient client = new JiraClient(new WebLocation(URL,
args[0], args[1]));
try {
// retrieve repository configuration
System.out.println("Retrieving repository
configuration...");
client.getCache().refreshDetails(null);
// access task information
FilterDefinition filter = new FilterDefinition();
filter.setUpdatedDateFilter(new DateRangeFilter(new
Date(2008, 6,
30), new Date(2008, 7, 31)));
filter.setProjectFilter(new
ProjectFilter(client.getCache().getProjectByKey("SCRATCH")));
// do the search
System.out.println("Performing search...");
JiraIssueCollector collector = new
JiraIssueCollector(100);
client.search(filter, collector, null);
for (JiraIssue issue : collector.getResults()) {
System.out.println(issue.getKey() + ": " +
issue.getSummary() + "
(" + issue.getProject().getName()
+ ", " + issue.getUpdated() +
")");
}
} catch (JiraException e) {
e.printStackTrace();
} finally {
CommonsNetPlugin.getExecutorService().shutdown();
}
}
}
The should print out:
Retrieving repository configuration...
Performing search...
SCRATCH-189: asdf - wiki (Manual Testing, Tue Aug 12 19:08:29 PDT 2008)
I'll commit this example to CVS as a reference:
249249: implement example that demonstrates JIRA core API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249249
Steffen
_______________________________________________
mylyn-integrators mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators