Adding comments while creating workitem using java APi
![]()
Sudipto Sarkar (63●7●42)
| asked Jul 31 '15, 6:19 a.m.
edited Jul 31 '15, 6:28 a.m. by Ralph Schoon (62.0k●3●36●43)
Hi Everyone,
I am creating a workitem using plain Java Api. I want to add some comments while creating. Please help me. I got solution to modify the existing workitem and then add comment, but my use case id to add a comment while creating workitem. Thanks, Sud |
Accepted answer
![]()
Ralph Schoon (62.0k●3●36●43)
| answered Jul 31 '15, 6:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
See https://rsjazz.wordpress.com/2013/07/12/work-item-command-line-client-to-add-a-comment/
This is no different to modifying the work item. You do it in a WorkItemOperation private static class WorkItemInitialization extends WorkItemOperation { private String fSummary; private ICategoryHandle fCategory; public WorkItemInitialization(String summary, ICategoryHandle category) { super("Initializing Work Item"); fSummary = summary; fCategory = category; } @Override protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException { IWorkItem workItem = workingCopy.getWorkItem(); workItem.setHTMLSummary(XMLString.createFromPlainText(fSummary)); workItem.setHTMLDescription(XMLString.createFromPlainText(fSummary)); workItem.setCategory(fCategory); ListYou add the comment in the execute section. You run it this way. WorkItemInitialization operation = new WorkItemInitialization("Test", category); IWorkItemHandle handle = operation.run(workItemType, monitor); Sudipto Sarkar selected this answer as the correct answer
Comments Hi,
https://rsjazz.wordpress.com/2013/07/12/work-item-command-line-client-to-add-a-comment/
|
One other answer
![]()
IComments comments = workItem.getComments();
IComment newComment = comments.createComment(repo.loggedInContributor(), XMLString.createFromPlainText("New Comment")); comments.append(newComment); Comments As described in https://rsjazz.wordpress.com/2013/07/12/work-item-command-line-client-to-add-a-comment/
|