Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mylyn » Creating tasks programmatically
Creating tasks programmatically [message #55450] Thu, 07 August 2008 09:35 Go to next message
Eclipse UserFriend
Originally posted by: matthias.scholz.interactive-objects.com

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
Re: Creating tasks programmatically - Unsupported Operation exception [message #55502 is a reply to message #55450] Thu, 07 August 2008 15:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.scholz.interactive-objects.com

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(getReposi toryUrl());
final AbstractRepositoryConnector connector =
TasksUi.getRepositoryManager().getRepositoryConnector(taskRe pository.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 [message #55528 is a reply to message #55502] Thu, 07 August 2008 17:37 Go to previous message
Steffen Pingel is currently offline Steffen PingelFriend
Messages: 706
Registered: July 2009
Senior Member
> 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
Re: Creating tasks programmatically - Unsupported Operation exception [message #592273 is a reply to message #55450] Thu, 07 August 2008 15:31 Go to previous message
Eclipse UserFriend
Originally posted by: matthias.scholz.interactive-objects.com

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(getReposi toryUrl());
final AbstractRepositoryConnector connector =
TasksUi.getRepositoryManager().getRepositoryConnector(taskRe pository.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 [message #592284 is a reply to message #55502] Thu, 07 August 2008 17:37 Go to previous message
Steffen Pingel is currently offline Steffen PingelFriend
Messages: 706
Registered: July 2009
Senior Member
> 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
Previous Topic:JIRA Connector: Error when connection via HTTP
Next Topic:Generic Web named expressions ({Id}.+?) - are these supported?
Goto Forum:
  


Current Time: Fri Nov 08 22:53:09 GMT 2024

Powered by FUDForum. Page generated in 0.02549 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top