Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Java Server Side : How check if a comment has been add

 
Hello,

I'm coding a  java plugin and i would like to know how check if a comment has been add during the saving...

Thanks for your help ?

Antoine


0 votes


Accepted answer

Permanent link
Hi Antoine,

I have code that adds a comment to a work item.  I've poked around it, and it looks like you could do something like the following before saving the work item with a new comment:

IComments comments= workItem.getComments();
int numberOfComments = comments.getContents().length;

Then after you save the work item, you could check that contents[numberOfComments].toString() is your comment.

I don't have an environment setup to see if getContents() is returning what I expect it will, so hopefully that will work for you (or at least get you started).
Antoine LELEU selected this answer as the correct answer

1 vote


One other answer

Permanent link
 
Hi Lauren,

Thanks for your answer.

I tried your solution, i compared the "numberOfComments" betwen the old and new state during the saving and it works perfectly..

Thanks again !

Antoine

0 votes

Comments

I'm glad it worked for you!

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: May 14 '13, 11:22 a.m.

Question was seen: 4,566 times

Last updated: May 15 '13, 11:57 a.m.

Confirmation Cancel Confirm