|  | 
| 
| Re: Programmatic new task creation from Java into Bugzilla???? [message #66273 is a reply to message #65215] | Sun, 08 March 2009 18:10  |  | 
| Eclipse User  |  |  |  |  | Hi Vinny 
 recently had the same problem. I managed to figure it out by rummaging through
 the code:
 
 AbstractTaskDataHandler taskDataHandler = connector
 .getTaskDataHandler();
 TaskAttributeMapper mapper = taskDataHandler
 .getAttributeMapper(repository);
 
 TaskData newTask = new TaskData(mapper, repository
 .getConnectorKind(), repository.getRepositoryUrl(), "");
 
 TaskMapping taskMappingInit = new TaskMapping() {
 public String getProduct() {
 return "My Product";
 }
 };
 
 taskDataHandler.initializeTaskData(repository, newTask,
 taskMappingInit, new NullProgressMonitor());
 
 TaskAttribute attribute = newTask.getRoot().getAttribute(
 BugzillaAttribute.SHORT_DESC.getKey());
 attribute.setValue("Test Bug");
 
 attribute = newTask.getRoot().getAttribute(
 BugzillaAttribute.LONG_DESC.getKey());
 attribute.setValue("--- Description ---");
 
 attribute = newTask.getRoot().getAttribute(
 BugzillaAttribute.COMPONENT.getKey());
 attribute.setValue("RCP Client");
 
 client.postTaskData(newTask, new NullProgressMonitor());
 
 
 Regards
 Alex
 
 Vinny schrieb am 13.02.2009 22:38:
 > Sorry, this is a duplicate to my previous post but I'm not sure if this
 > is the best place to post this question.  Please advise if I should post
 > elsewhere.
 > I've used the example code at:
 >  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.mylyn/s andbox/org.eclipse.mylyn.examples.bugzilla/src/org/eclipse/m ylyn/internal/examples/bugzilla/Main.java?root=Tools_Project &view=markup
 >
 >
 >
 > to query a bug report and modify a comment but I can't seem to find how
 > to create a new bug from the Java API.  Is the Java API fully
 > functionally?  I.e., can everything be done programatically that can be
 > done from the Mylyn GUI?  After a few days of poking around, it seems
 > like the API is not fully developed.
 > Can anyone show an example of how to create a NEW bug and put it into
 > the Bugzilla DB from a Java program?
 >
 > I'm trying to interface with Bugzilla 3.2.2.
 >
 > Would really appreciate the help!   Thanks in advance!
 >
 |  |  |  | 
| 
| Re: Programmatic new task creation from Java into Bugzilla???? [message #596597 is a reply to message #65215] | Sun, 08 March 2009 18:10  |  | 
| Eclipse User  |  |  |  |  | Hi Vinny 
 recently had the same problem. I managed to figure it out by rummaging through
 the code:
 
 AbstractTaskDataHandler taskDataHandler = connector
 .getTaskDataHandler();
 TaskAttributeMapper mapper = taskDataHandler
 .getAttributeMapper(repository);
 
 TaskData newTask = new TaskData(mapper, repository
 .getConnectorKind(), repository.getRepositoryUrl(), "");
 
 TaskMapping taskMappingInit = new TaskMapping() {
 public String getProduct() {
 return "My Product";
 }
 };
 
 taskDataHandler.initializeTaskData(repository, newTask,
 taskMappingInit, new NullProgressMonitor());
 
 TaskAttribute attribute = newTask.getRoot().getAttribute(
 BugzillaAttribute.SHORT_DESC.getKey());
 attribute.setValue("Test Bug");
 
 attribute = newTask.getRoot().getAttribute(
 BugzillaAttribute.LONG_DESC.getKey());
 attribute.setValue("--- Description ---");
 
 attribute = newTask.getRoot().getAttribute(
 BugzillaAttribute.COMPONENT.getKey());
 attribute.setValue("RCP Client");
 
 client.postTaskData(newTask, new NullProgressMonitor());
 
 
 Regards
 Alex
 
 Vinny schrieb am 13.02.2009 22:38:
 > Sorry, this is a duplicate to my previous post but I'm not sure if this
 > is the best place to post this question.  Please advise if I should post
 > elsewhere.
 > I've used the example code at:
 >  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.mylyn/s andbox/org.eclipse.mylyn.examples.bugzilla/src/org/eclipse/m ylyn/internal/examples/bugzilla/Main.java?root=Tools_Project &view=markup
 >
 >
 >
 > to query a bug report and modify a comment but I can't seem to find how
 > to create a new bug from the Java API.  Is the Java API fully
 > functionally?  I.e., can everything be done programatically that can be
 > done from the Mylyn GUI?  After a few days of poking around, it seems
 > like the API is not fully developed.
 > Can anyone show an example of how to create a NEW bug and put it into
 > the Bugzilla DB from a Java program?
 >
 > I'm trying to interface with Bugzilla 3.2.2.
 >
 > Would really appreciate the help!   Thanks in advance!
 >
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.04733 seconds