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
praveen patidar
Oct 30 '12, 5:21 a.m.Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 30 '12, 5:55 a.m.Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 30 '12, 12:47 p.m.