It's all about the answers!

Ask a question

How to get workitem from changeset inside the plugin ?


praveen patidar (8612342) | asked Oct 30 '12, 4:18 a.m.
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);
                        }
                    }
                }

Comments
praveen patidar commented 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 commented Oct 30 '12, 5:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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 commented Oct 30 '12, 12:47 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

ProviderFactory is no service. I answered on another question. see the link in my last answer.

Accepted answer


permanent link
Ralph Schoon (54.0k13641) | 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



permanent link
Ralph Schoon (54.0k13641) | 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
praveen patidar commented Oct 30 '12, 8:16 p.m. | edited Oct 30 '12, 8:18 p.m.

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


praveen patidar commented Oct 30 '12, 8:17 p.m.

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

Your answer


Register or to post your answer.