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

How to find the Author and WI associated to change set using plain java Api

 Hello,


I want to get report with change set comment,author, date of checkin, and summary of WI associated with it.


0 votes



2 answers

Permanent link

Assuming you got an IChangeSet cs, you can retrieve the author this way:

IContributorHandle authorHandle = cs.getModifiedBy();

I have no examples of retrieving the work item associated to a change set using plain Java API, but I think that this example that makes use of server side Java API can be adapted to plain Java API:

AbstractService abstractService = ....;
linkService = abstractService.getService(ILinkService.class);
ILinkServiceLibrary linkLibrary = (ILinkServiceLibrary) this.linkService.getServiceLibrary(ILinkServiceLibrary.class); 
IItemReference changeSetRef = IReferenceFactory.INSTANCE.createReferenceToItem(cs); 
ILinkQueryPage linkPage = linkLibrary.findLinks(ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID, changeSetRef);
List<IWorkItem> workItems = new ArrayList<IWorkItem>(); 
IWorkItem workItem = null;

for (ILink link : linkPage.getAllLinksFromHereOn()) {
IWorkItemHandle IWorkItemHandle = (IWorkItemHandle) link.getTargetRef().resolve();
workItem = (IWorkItem) this.repositoryItemService.fetchItem(IWorkItemHandle, IRepositoryItemService.COMPLETE);
workItems.add(workItem);
}

1 vote

Comments
Thanks for answer

But user name i get it in uuid format not proper name or ID.

I will try to get the link WI.
 

The Java API usually returns handles and you have to resolve the handle, to get all the data. See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ for some introduction. On that blog are many examples with code. You can search also e.g. for IContributorHandle and find code that uses this. 


Permanent link

 See https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ for the genral approach. That is however server API. Instead of WorkItemService you want to use the IWorkitemCommon or IWorkItemClient and instead of the itemservice you use the ITeamRepository you get. Also see

for client link APIs.


0 votes

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
× 1,700
× 1,220

Question asked: Jul 12 '21, 1:47 a.m.

Question was seen: 1,003 times

Last updated: Jul 12 '21, 5:20 a.m.

Confirmation Cancel Confirm