Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mylyn-dev] Retrieving a Bugzilla Custom Field is failing

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");

}



Back to the top