Skip to main content

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

Hi, all...

I'm currently using the headless Mylyn API to retrieve JIRA tasks and have been testing against the JIRA installation at mylyn.eclipse.org.

My code is structured essentially as follows (a pattern that I'm ape-ing from the unit tests):

        JiraClient client =
                    new JiraClient(new WebLocation(url,
                                                   credentials.getUsername(),
                                                   credentials.getPassword()));

        ///////////////////////////////////////////////////////////////////////
        //  Build the filter that will represent our JIRA query...
        ///////////////////////////////////////////////////////////////////////
        FilterDefinition filter = new FilterDefinition();

        // Specify a date-range/interval of updated values to query...
        filter.setUpdatedDateFilter(new DateRangeFilter(new Date(2008, 6, 30),
                                                        new Date(2008, 7, 31)));
      
        filter.setProjectFilter(new ProjectFilter(new Project("CUSTOMFIELDS")));

        // Do the query...
        JiraIssueCollector collector = new JiraIssueCollector();
        client.search(filter, collector, null);

        assertTrue(collector.isDone());
        assertTrue(collector.getIssues().size() > 0);

        List<JiraIssue> issues = collector.getIssues();

        for(JiraIssue issue : issues )
        {
            System.err.println(issue);
            tab(); System.err.println("project = " + issue.getProject());
            tab(); System.err.println("updated = " + issue.getUpdated());
        }


Basic authentication to the repository is fine, as I do indeed get results back.  I'm just not sure that I understand the semantics of the FilterDefinition entirely, because I'm not quite getting back what I expect (please see below).  I used the DateRangeFilter and thought I was restricting my query to updated dates that would lie within the month of July 2008, but I get a bunch of stuff outside that interval.  As well, my attempt to restrict to the project CUSTOMFIELDS doesn't seem to have worked since although some CUSTOMFIELDS stuff comes through, several other projects are also represented in the results.  Still using the filters gives me fewer returned values than I get when I don't use them at all (only 13 rather than the full 100 that my JiraCollector implementation specifies as its maxHits value).

SCRATCH-189 asdf - wiki
    project = null
    updated = Tue Aug 12 19:08:29 PDT 2008
PRONE-8439 testUpdateTask
    project = null
    updated = Wed Aug 20 19:36:54 PDT 2008
PRONE-8397 testUpdateTask
    project = null
    updated = Fri Aug 15 13:50:25 PDT 2008
PRONE-8355 testUpdateTask
    project = null
    updated = Thu Aug 14 17:56:20 PDT 2008
PRONE-8313 testUpdateTask
    project = null
    updated = Tue Aug 12 18:45:30 PDT 2008
PRONE-8271 testUpdateTask
    project = null
    updated = Tue Aug 12 18:35:39 PDT 2008
PRONE-8229 testUpdateTask
    project = null
    updated = Tue Aug 12 17:30:30 PDT 2008
PRONE-8198 test123
    project = null
    updated = Fri Aug 08 16:07:47 PDT 2008
PRONE-8146 testUpdateTask
    project = null
    updated = Fri Aug 08 16:08:48 PDT 2008
PRONE-5059 asdf
    project = null
    updated = Mon Aug 11 20:31:14 PDT 2008
DEMO-2 stack trace
    project = null
    updated = Fri Aug 22 18:12:44 PDT 2008
CUSTOMFIELDS-1471 abc
    project = null
    updated = Fri Aug 22 21:03:06 PDT 2008
CUSTOMFIELDS-665 testUpdateIssue
    project = null
    updated = Wed Aug 20 17:40:27 PDT 2008

So my guesses and questions are:

  • Am I totally misunderstanding how the DateRangeFilter works?  What should I be giving it if I want to query on a time-valued field for all of the things updated in a given interval [time_0, time_1]?
  • Why does the project field always come back null on the returned JiraIssues?
  • Do I utterly misunderstand how the ProjectFilter works?  The class appears to be a fairly simple data container and passing in both the uppercase JIRA project key as well as the friendly project name (i.e. "CUSTOMFIELDS" vs "Custom Fields") both appear to fail to restrict the result by filtering out projects that don't match that.  I'm not sure whether this is related to the null project values that come back or not.
Thanks in advance for any pointers or suggestions.  The API seems fairly simple in this respect, but there must be something that I'm doing in a fundamentally unsound way to get the unexpected results...

Jerry


Back to the top