Programmatically adding a comment to a work item
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.
When trying to create a comment using the following code
I get an com.ibm.team.repository.common.internal.ImmutablePropertyException being thrown by
IWorkItem workingCopy = workItemClient.findWorkItemById(456, IWorkItem.FULL_PROFILE, null);
IComments comments= workingCopy.getComments();
IComment comment= comments.createComment( teamRepository.loggedInContributor(),
XMLString.createFromPlainText( "This is my new commend from the java api"));
comments.append(comment);
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!
Thanks!
When trying to create a comment using the following code
IWorkItem workingCopy = workItemClient.findWorkItemById(456, IWorkItem.FULL_PROFILE, null);
IComments comments= workingCopy.getComments();
IComment comment= comments.createComment( teamRepository.loggedInContributor(),
XMLString.createFromPlainText( "This is my new commend from the java api"));
comments.append(comment);
I get an com.ibm.team.repository.common.internal.ImmutablePropertyException being thrown bycomments.append(comment);any pointers?
I'm getting the same error. Any idea what may cause the error? Please help.
Thanks!
Thanks!
When trying to create a comment using the following code
IWorkItem workingCopy = workItemClient.findWorkItemById(456, IWorkItem.FULL_PROFILE, null);
IComments comments= workingCopy.getComments();
IComment comment= comments.createComment( teamRepository.loggedInContributor(),
XMLString.createFromPlainText( "This is my new commend from the java api"));
comments.append(comment);
I get an com.ibm.team.repository.common.internal.ImmutablePropertyException being thrown bycomments.append(comment);any pointers?
I'm getting the same error. Any idea what may cause the error? Please
help.
I get an
com.ibm.team.repository.common.internal.ImmutablePropertyException
being thrown by
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
I'm able to modify the working copy now. Thanks alot for the help. Really appreciated! Thanks.
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
I'm getting the same error. Any idea what may cause the error? Please
help.
I get an
com.ibm.team.repository.common.internal.ImmutablePropertyException
being thrown by
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