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

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);
                        }
                    }
                }

0 votes

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.


Accepted answer

Permanent link
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

0 votes


One other answer

Permanent link
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();
.......

0 votes

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

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
× 10,941

Question asked: Oct 30 '12, 4:18 a.m.

Question was seen: 5,816 times

Last updated: Oct 30 '12, 8:18 p.m.

Confirmation Cancel Confirm