Hi Vincent,

The data returned from a query is partial (taskData.isPartial() == true) (we
don't get all the data returned in the query results). To ensure you have
all attributes you need to use the first chunk of code you mentioned below.

-Rob


On Mon, Apr 20, 2009 at 5:35 PM, Vincent Vallarine <[email protected]>wrote:

> The two snippets of code I think should work the same, I'm trying to get
> all value of a custom field.  The first chuck works fine.  The second
> chunck does not work, I get the exact number of task back that I expect
> and all the data is correct except when I do a
> "getMappedAttribute("my_custom_field")" using the query, the result is
> always null.
>
>
> // WORKING SNIPPET
> TaskData taskData = connector.getTaskData(repository, taskId,
>  new NullProgressMonitor());
>
> System.out.println("Getting attribute for task id " + id);
>
> //works fine, can get the custom value out of attrib
> TaskAttribute attrib = taskData.getRoot().getMappedAttribute(
>  "my_custom_field");
>
>
>
>
> //NOT WORKING SNIPPET
> String QUERY_NAME = "Query Page Name";
> String QUERY_STRING = "/buglist.cgi?product=SomeProject";
> IRepositoryQuery repositoryQuery = TasksUi.getRepositoryModel()
>  .createRepositoryQuery(repository);
> repositoryQuery.setUrl(repository.getRepositoryUrl() + QUERY_STRING);
> repositoryQuery.setSummary(QUERY_NAME);
>
> final Set<TaskData> changedTaskData = new HashSet<TaskData>();
> TaskDataCollector resultCollector = new TaskDataCollector() {
>
>  public void accept(TaskData taskData) {
>    changedTaskData.add(taskData);
>  }
> };
>
> IStatus status = connector.performQuery(repository,
>  repositoryQuery, resultCollector, null, new NullProgressMonitor());
>
> for (TaskData taskData : changedTaskData) {
>
>  //Always returns null!!!
>  TaskAttribute attrib = taskData.getRoot().getMappedAttribute(
>    "my_custom_field");
>
> }
>
> _______________________________________________
> mylyn-dev mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/mylyn-dev
>



-- 
Robert Elves
Tasktop Developer, http://tasktop.com/
Mylyn Committer, http://eclipse.org/mylyn
_______________________________________________
mylyn-integrators mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators

Reply via email to