[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[mylyn-integrators] Creating and storing a new BugzillaTask in repository
|
Hello ,
i'm new to plugin development and and trying to generate a new
BugzillaTask automatically
and store it in my repository. Can somebody tell me how to do this.
When i read the data of an existing task out the repository and change
it , it gets saved correctly.
my read a task and change some values code :
TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();
connector.init(taskList);
RepositoryTaskData taskData =
TasksUiPlugin.getTaskDataManager().getNewTaskData(REPOSITORYURL, "1");
taskData.setNewComment("some comment...");
BugzillaClient client = connector.getClientManager().getClient(repository);
client.postTaskData(taskData);
this saves the comment ... i'm happy :) (or better use ?)
now i want to create a completely new Task and tried something like
this...
BugzillaTask task1 = new BugzillaTask(REPOSITORYURL, "10", "my
programmed demo demo BUG 2!");
but couldn't find a way to store the BugzillaTask...
So i debugged what happens when i create a new task with the
BugzillaTaskEditor and submit it to my repository
and found the submitToRepository method where the task is created with
String taskId = connector.getTaskDataHandler().postTaskData(repository,
taskData, new SubProgressMonitor(monitor, 1));
So i tried to build the taskData and do it the same way.
My task Data :
RepositoryTaskData repoTaskData =
newRepositoryTaskData(newBugzillaAttributeFactory(),BugzillaCorePlugin.REPOSITORY_KIND,REPOSITORYURL,"15","task");
repoTaskData.setAttributeValue(BugzillaReportElement.PRODUCT.getKeyString(),
taskData.getProduct());
repoTaskData.setAttributeValue(BugzillaReportElement.COMPONENT.getKeyString(),
"RCP Plugins");
repoTaskData.setAttributeValue(BugzillaReportElement.BLOCKED.getKeyString(),
"");
repoTaskData.setAttributeValue(BugzillaReportElement.BUG_STATUS.getKeyString(),
IBugzillaConstants.VALUE_STATUS_NEW);
repoTaskData.setAttributeValue(BugzillaReportElement.BUG_SEVERITY.getKeyString(),
IBugzillaConstants.DEFAULT_SEVERITY_VALUES[3]);
repoTaskData.setAttributeValue(BugzillaReportElement.ASSIGNED_TO.getKeyString(),
"");
repoTaskData.setAttributeValue(BugzillaReportElement.VERSION.getKeyString(),
"unspecified");
repoTaskData.setAttributeValue(BugzillaReportElement.NEWCC.getKeyString(),
"");
repoTaskData.setAttributeValue(BugzillaReportElement.SHORT_DESC.getKeyString(),
"KRITZEL KRATZEL");
repoTaskData.setAttributeValue(BugzillaReportElement.REP_PLATFORM.getKeyString(),
"PC");
repoTaskData.setAttributeValue(BugzillaReportElement.OP_SYS.getKeyString(),
IBugzillaConstants.DEFAULT_OS_VALUES[6]);
repoTaskData.setAttributeValue(BugzillaReportElement.DEPENDSON.getKeyString(),
"");
repoTaskData.setAttributeValue(BugzillaReportElement.BUG_FILE_LOC.getKeyString(),
"http://");
repoTaskData.setAttributeValue(BugzillaReportElement.PRIORITY.getKeyString(),
"P3");
repoTaskData.setAttributeValue(BugzillaReportElement.DESC.getKeyString(),
"some text");
repoTaskData.setNew(true);
Cause i have no access to a monitor(new SubProgressMonitor(monitor,
1)) i tried it with:
String taskId = connector.getTaskDataHandler().postTaskData(repository,
repoTaskData, new NullProgressMonitor());
but it ends up in a
org.eclipse.core.runtime.CoreException: A repository error has occurred.
at
org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient.parseHtmlError(BugzillaClient.java:1135)
at
org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient.postTaskData(BugzillaClient.java:879)
at
org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.postTaskData(BugzillaTaskDataHandler.java:158)
can somebody please give me a small explenation how to achive this. This
would be great :)
Of course if read the
http://wiki.eclipse.org/index.php/Mylar_Integrator_Reference and also
the Quick Example
but i guess this is not running with the current API ?
thanks ivan