Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mylyn-integrators] Peculiar Headless API Behavior Trying to Do Filtered Jira Queries Against mylyn.eclipse.org

Hi, Steffen...

Say is there a checked-in or otherwise available of the equivalent sort of query performed against a Bugzilla database?  I've prowled the unit tests a bit looking for something to imitate but am not sure that I'm looking in the right place.  The integrators docs web page shows a sample query for retrieving a single bug---if possible I'd like to find an example somewhere of setting up the details for a query that lets me work within a date range, for a specific product, etc....

Jerry

On Tue, Sep 30, 2008 at 6:33 PM, Steffen Pingel <steffen.pingel@xxxxxxxxxxx> wrote:
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 = "" href="https://mylyn.eclipse.org/jiratest" target="_blank">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
mylyn-integrators@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators


Back to the top