Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [mylyn-integrators] Creation of tasks

Hi Maarten,
thanks a lot for your tips. In the meantime, I managed to create a task for bugzilla. But the same code is not working for jira. I guess that jira expects a different set of properties available in the task. Is there a chance to get a list of the properties that a repository expects for a task? I think without this information it will be hard to create tasks in a repository transparent way. What I am looking for is a way to switch repositories my code is working on. Is this feasible at all with regards to the expected task attributes by the repository?
 
Regards,
Stefan


Von: mylyn-integrators-bounces@xxxxxxxxxxx [mailto:mylyn-integrators-bounces@xxxxxxxxxxx] Im Auftrag von Maarten Meijer
Gesendet: Montag, 22. September 2008 16:52
An: Mylyn Integrators list
Betreff: Re: [mylyn-integrators] Creation of tasks

Maybe some of my comments can be of help.

ITask is an object that holds just sufficient information to display and filter the task in the Task List, TaskData is a container that holds everything to be displayed in the Rich Task Editor. This Task Editor is different for each kind of repository. 

A new Task starts life as a local task (which it is it has not yet been synchronized), but with the intended repository included as an attribute. Upon synchronization it changes into a task for that specific repository and gets form the repository its unique ID.

The sequence is as follows:
  protected TaskRepository repository;

public void testProgrammaticCreation() {

try {
assertNotNull("repository null", repository);

ITask newTask = TasksUiUtil.createOutgoingNewTask(CONNECTOR_KIND, REPOSITORY_URL);
assertNotNull("Task creation failed", newTask);
assertNotNull("Task creation failed - ID", newTask.getTaskId());

MyAttributeMapper mapper = new MyAttributeMapper(repository);
assertNotNull("Mapper creation failed", mapper);

TaskData data = "" style="COLOR: #7f0055">new TaskData(mapper,CONNECTOR_KIND, REPOSITORY_URL, newTask
.getTaskId());
assertNotNull("TaskData creation failed", mapper);

boolean success = connector.getTaskDataHandler().initializeTaskData(repository, data,
new DefaultTaskMapping(), new NullProgressMonitor());
assertTrue("TaskData not initialized", success);

Map<String, TaskAttribute> dataAttributes = data.getRoot().getAttributes();
assertNotNull("TaskData no attributes", dataAttributes);
System.out.println(dataAttributes.toString());

Map<String, String> taskAttributes = newTask.getAttributes();
assertNotNull("TaskData no attributes", taskAttributes);
System.out.println(taskAttributes.toString());
} catch (CoreException e) {
fail(e.getMessage());
}
}

You need the taskdata to have things show up in the editor. 

Maarten

Hi all,
I´m currently trying to trigger creation of tasks programmatically through the mylyn api. I succeeded in creating local tasks in the local repository, but failed for any other repository (I tried bugzilla,but my guess is that similar issues will happen with other repositories as well). I think I´m struggling a bit with the difference between ITask and TaskData.

The issues I faced were:

  • The task initially was shown in the "uncategorized" container rather than the "unsubmitted" container for the bugzilla repository. I think this issue can be solved by manually putting the task there. The interesting thing is that after a restart of eclipse, the task is moved there automatically ;-)
  • Opening the task editor for this task fails and shows an empty bugzilla page. Debugging into the code I recognized that there is a NPE because the editor tries to access the TaskData of the task which does not exist.

Currently, I´m using the API  TasksUiUtil.createOutgoingNewTask() to create the task. Could you give me some advises on this topic? Especially on the handling of ITask and TaskData. Is it at all possible to create tasks for various repositories using the mentioned way?

Thanks in advance,
Stefan

_______________________________________________
mylyn-integrators mailing list
mylyn-integrators@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators


Back to the top