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);
}
}
}
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
One other answer
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
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 You Very Much
Have a Good Day
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 You Very Much
Have a Good Day
Comments
praveen patidar
Oct 30 '12, 5:21 a.m.While Adding the Using Prerequisite I am getting the Excpetion like this
The "com.ibm.team.scm.common.providers.ProviderFactory" service was not registered.
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 30 '12, 5:55 a.m.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.
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 30 '12, 12:47 p.m.ProviderFactory is no service. I answered on another question. see the link in my last answer.