Programmatically adding a comment to a work item
My goal is to add a comment programatically using the plain Java SDK. The API for work items doesn't immediately make this apparent. I've scoured over the RtcSdk wiki. And it is ripe with creating new work items. However, I'm stuck not seeing how to add a comment.
|
9 answers
My goal is to add a comment programatically using the plain Java SDK. The API for work items doesn't immediately make this apparent. I've scoured over the RtcSdk wiki. And it is ripe with creating new work items. However, I'm stuck not seeing how to add a comment. workItem.setHTMLDescription(XMLString.createFromPlainText(fDescription)); The plain java code example covers the rest. |
Thanks for replying.
Which example might you be referring to? |
Thanks for replying. No problem! https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation Plain-Java Client The WorkItemInitialization class does most of the work. You can set whatever fields you need inside the execute field. |
A snippet that adds as comment to a work item:
IComments comments= workingCopy.getComments(); IComment comment= comments.createComment(authenticatedUser, getText(commentString)); comments.append(comment); -- Regards, Patrick Jazz Work Item Team |
When trying to create a comment using the following code
I get an com.ibm.team.repository.common.internal.ImmutablePropertyException being thrown by comments.append(comment);any pointers? |
I'm getting the same error. Any idea what may cause the error? Please help.
Thanks! When trying to create a comment using the following code |
I'm getting the same error. Any idea what may cause the error? Please help.
Thanks! When trying to create a comment using the following code |
I'm getting the same error. Any idea what may cause the error? Please You can't modify the work item itself, you need to modify a working copy: IWorkItemWorkingCopyManager workingCopyManager= workItemClient.getWorkItemWorkingCopyManager(); workingCopyManager.connect(handle, ...); WorkItemWorkingCopy workingCopy= workingCopyManager.getWorkingCopy(handle); // modify work item IWorkItem workItem= workingCopy.getWorkItem(); ... workingCopy.save(null); -- Regards, Patrick Jazz Work Item Team Comments
Ananya Joisa
commented Aug 27 '12, 3:16 p.m.
Hi Patrick, I am getting a cannot resolve error for IWorkItemWorkingCopyManager, workItemClient etc. From where do I import these? Thanks. |
I'm able to modify the working copy now. Thanks alot for the help. Really appreciated! Thanks.
I'm getting the same error. Any idea what may cause the error? Please You can't modify the work item itself, you need to modify a working copy: IWorkItemWorkingCopyManager workingCopyManager= workItemClient.getWorkItemWorkingCopyManager(); workingCopyManager.connect(handle, ...); WorkItemWorkingCopy workingCopy= workingCopyManager.getWorkingCopy(handle); // modify work item IWorkItem workItem= workingCopy.getWorkItem(); ... workingCopy.save(null); -- Regards, Patrick Jazz Work Item Team |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.