How to get workitem from changeset inside the plugin ?
![]()
Hello
I am struggling with the APIs to get the workitem related to the change set. However I found something in the code but the I am not able to get the ServerProviderFactory provider = getService(ServerProviderFactory.class); object. I have done configuration for this service in the prerequisite of the Plugin but not able to access the API. Please provide me the API that is able to get the WorkItem from the Change Set. I can get the workitemhandle from below code but the issue with the provide attribute. for (Iterator iterator = links.keySet().iterator(); iterator.hasNext(); ) { IChangeSet changeSet = (IChangeSet) iterator.next(); String comment = null; List workItemHandles = new ArrayList(); List<ILink> oslcLinks = ChangeSetLinks.findLinks(provider, changeSet, new String[] { ILinkConstants.CHANGESET_OSLC_CM_CHANGEREQUEST_LINKTYPE_ID }, monitor); boolean hasOslcLinks = !oslcLinks.isEmpty(); if (changeSet != null) { comment = changeSet.getComment(); List linkTargets = (List) links.get(changeSet); for (Iterator iterator2 = linkTargets.iterator(); iterator2.hasNext();) { IAuditable referencedItem = (IAuditable) iterator2.next(); if(referencedItem instanceof IWorkItemHandle) { workItemHandles.add(referencedItem); } } } |
Accepted answer
![]()
Ralph Schoon (61.5k●3●36●43)
| answered Oct 30 '12, 12:46 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please have a look here: https://jazz.net/forum/questions/85775/how-to-identify-the-associated-work-item-type-of-a-change-set-using-event-handler
praveen patidar selected this answer as the correct answer
|
One other answer
![]()
Ralph Schoon (61.5k●3●36●43)
| answered Oct 30 '12, 5:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,
if you have a handle you need to resolve the handle to the work item to access the attributes. http://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ shows an example in
updateParent:
IWorkItem parent = (IWorkItem)workItemServer.getAuditableCommon().resolveAuditable(parentHandle,IWorkItem.FULL_PROFILE,monitor).getWorkingCopy();
Comments Thanks a Lot the article https://jazz.net/forum/questions/85775/how-to-identify-the-associated-work-item-type-of-a-change-set-using-event-handler really helps a lot.... I am struggling with this since a long.
Thanks a Lot the article https://jazz.net/forum/questions/85775/how-to-identify-the-associated-work-item-type-of-a-change-set-using-event-handler really helps a lot.... I am struggling with this since a long.
|
Comments
While Adding the Using Prerequisite I am getting the Excpetion like this
The "com.ibm.team.scm.common.providers.ProviderFactory" service was not registered.
Too few information, if you try to add to the required services prerequisite, you are probably trying to add something that is not a service.
ProviderFactory is no service. I answered on another question. see the link in my last answer.