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

How to check whether a workitem has either a changeset or an attachment

Hi,

I need to check whether a workitem has either a changeset or an attachment in my server side extensions.
Please provide me small snippet if anybody has done it !!!

0 votes

Comments

IWorkItemReferencesworkItemReferences=workItemCommon.resolveWorkItemReferences(newState, monitor);List<IReference> references = workItemReferences.getReferences(WorkItemEndPoints.ATTACHMENT);
for(IReference reference:references){
IAttachmentHandle attachmentHandle=(IAttachmentHandle) reference.resolve();
 IAttachment attachment=(IAttachment) itemService.fetchItem(attachmentHandle, IRepositoryItemService.COMPLETE);if(attachment!=null){
IContributorHandle attachmentContributorHandle = attachment.getCreator();
 IContributor attachmentContributor = (IContributor) itemService.fetchItem(attachmentContributorHandle, IRepositoryItemService.COMPLETE);
                    String attachmentowner = attachmentContributor.getName();
                    System.out.println("Owner is ------- "+attachmentowner);
                }
            }



One answer

Permanent link
See https://rsjazz.wordpress.com/ use the search box in the top right to search for attachment.

0 votes

Comments

I need to know whether the attachment is added to a workitem or not. If in case attachment is added, i need to retrieve the user who added the attachment in my follow up action in the server extension plugin.

Please see above

You perform Rational Team Concert Extensions Workshop to understand what you are doing, how and how to debug it and to learn how you can compare the old state and the new state.

Once you understand what the old state and the new state in a participant is and how to access its data, you should be able to understand if there is something new and what.

Yes.
How to retrieve the content in an attachment file in server side extensions.
IContent content = attachment.getContent();
String contentType = content.getContentType();

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: Jun 23 '15, 7:25 a.m.

Question was seen: 2,850 times

Last updated: Jun 26 '15, 3:33 a.m.

Confirmation Cancel Confirm