Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

Java, the OLPC, and community responsibility

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!
Replies: 2 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Creating tasks programmatically

At 5:35 AM on Aug 7, 2008, Matthias Paul Scholz wrote:

Hi,

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

  Click to reply to this thread Reply
1. At 11:31 AM on Aug 7, 2008, Matthias Paul Scholz wrote:

Re: Creating tasks programmatically - Unsupported Operation exception

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?

  Click to reply to this thread Reply
2. At 1:37 PM on Aug 7, 2008, Steffen Pingel wrote:

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

thread.rss_message