The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
I've investigated the Trac connector tests from the cvs and came up with
the following code to create a completely new taskin my remote Trac
repository:
final TaskRepository taskRepository =
TasksUiPlugin.getRepositoryManager().getRepository(getRepositoryUrl());
final AbstractRepositoryConnector connector =
TasksUi.getRepositoryManager().getRepositoryConnector(taskRepository.getConnectorKind());
AbstractTaskDataHandler taskDataHandler =
connector.getTaskDataHandler();
TaskAttributeMapper attributeMapper =
taskDataHandler.getAttributeMapper(taskRepository);
TaskData taskData = new TaskData(attributeMapper,
taskRepository.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
ITaskMapping taskMapping = new DefaultTaskMapping();
taskDataHandler.initializeTaskData(taskRepository, taskData, taskMapping,
new NullProgressMonitor());
AbstractTaskDataHandler handler = connector.getTaskDataHandler();
RepositoryResponse returnValue = handler.postTaskData(taskRepository,
taskData, null, null);
However, the last call spawns an "Unsupported Operation" exception in the
TracTaskHandler.postTaskData() method.
Why?
Creating tasks programmatically
At 5:35 AM on Aug 7, 2008, Matthias Paul Scholz wrote:
I'm trying to create Mylyn tasks programmatrically, i.e., adding tasks to
a Trac repository via the Mylyn 3.0 Tasks API and a Trac connector.
However, I did not find any useful documentation how to do so and I am
presently out of my wits here.
Can some one provide help, please?
Maybe there is some example code somewhere?
Best and thanks,
MP
2 replies so far (
Post your own)
Re: Creating tasks programmatically - Unsupported Operation exception
I've investigated the Trac connector tests from the cvs and came up withthe following code to create a completely new taskin my remote Trac
repository:
final TaskRepository taskRepository =
TasksUiPlugin.getRepositoryManager().getRepository(getRepositoryUrl());
final AbstractRepositoryConnector connector =
TasksUi.getRepositoryManager().getRepositoryConnector(taskRepository.getConnectorKind());
AbstractTaskDataHandler taskDataHandler =
connector.getTaskDataHandler();
TaskAttributeMapper attributeMapper =
taskDataHandler.getAttributeMapper(taskRepository);
TaskData taskData = new TaskData(attributeMapper,
taskRepository.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
ITaskMapping taskMapping = new DefaultTaskMapping();
taskDataHandler.initializeTaskData(taskRepository, taskData, taskMapping,
new NullProgressMonitor());
AbstractTaskDataHandler handler = connector.getTaskDataHandler();
RepositoryResponse returnValue = handler.postTaskData(taskRepository,
taskData, null, null);
However, the last call spawns an "Unsupported Operation" exception in the
TracTaskHandler.postTaskData() method.
Why?
Re: Creating tasks programmatically - Unsupported Operation exception
> However, the last call spawns an "Unsupported Operation" exception in the> TracTaskHandler.postTaskData() method.
You need to set the version to XML_RPC:
repository.setVersion(Version.XML_RPC.name());
The Main class of org.eclipse.mylyn.tests.report plugin has sample code how
to setup a Trac repository.
Steffen