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

How do I get workitem details out of WorkItemHandleImpl ?

Hi,
I need to get WorkItem details  on 'associate changeset to workitem' operation.
I have WorkItemHandleImpl from the SaveClosedChangeSetOperationData .
I need help to get IWorkItem out of WorkItemHandleImpl.
UUID is available but I don't know how to get workitem with UUID.
Thank in advance,
Yehiel

0 votes


Accepted answer

Permanent link
Yehil, I would suggest to search the Extensions Workshop.

It depends on what you do and where (Client extension, Plain Java client Libraries or Server extension)
An extension should extend AbstractService which provides important operations such as getAuthenticatedContributor() and getService() to get services that are listed in the prerequisites.

You use AbstractService.getService(Class<T> class) so

IAuditableCommon common = (IAuditableCommon) this.getService(IAuditableCommon.class)

Clients and client extensions you get Client Libraries using

IAuditableClient auditableClient = (IAuditableClient) iTeamrepository.getClientLibrary(IAuditableClient.class);


Ralph Schoon selected this answer as the correct answer

0 votes


3 other answers

Permanent link
The API often returns object handles instead of the full object
–To get the object from an IHandle use a resolve operation provided by the Services/Client Libraries. Objects might not be resolvable due to permissions. There are differences in the server and client API:

Server API uses services
        IAuditableCommon.resolveAuditable(handle, profile, monitor)
        IAuditableCommon.resolveAuditablesPermissionAware(handles, profile, monitor)
Example:
IWorkItem workItem = auditableCommon.resolveAuditable((IAuditableHandle) handle,IWorkItem.SMALL_PROFILE, monitor);     

Client API uses Client Libraries.
        IAuditableClient auditableClient = (IAuditableClient) repository.getClientLibrary(IAuditableClient.class);
        IWorkItem workItem = auditableClient.resolveAuditable((IAuditableHandle) handle,IWorkItem.FULL_PROFILE, monitor);       
 
On the client side the ItemManager provides the ability to resolve/fetch an item from a handle:
        ITeamrepository.itemManager().fetchCompleteItem(itemHandle, flags, monitor)

Profiles are used to determine how much data needs to be loaded when resolving a handle
–General profiles: ItemProfile.createFullProfile(IProjectArea.ITEM_TYPE)
–Special profiles: IWorkItem.SMALL_PROFILE, IQueryDescriptor.FULL_PROFILE
–On the client ItemManager flags are IItemManager.DEFAULT (cached), IItemManager.REFRESH (refresh cache)

Sometimes it is necessary to find the team repository containing an object; use getOrigin()
 ITeamRepository repository = (ITeamRepository) iItem.getOrigin();





1 vote

Comments

Thanks Ralph, for your answer.

I don't know how to get IAuditableCommon on SaveClosedChangeSetOperationData .
I know hoe to get it on deliver operation or save work item operation but I don't know how to get the work-item from the data I get with SaveClosedChangeSetOperationData (This is the operation for associating Change-set to work-item).
I searched the forum but didn't find any clue.
Waiting for your help,
Yehiel


Permanent link
 Hi Ralph,
I'm now facing problem with the plugin prerequisites.
I saw one workshop example :  https://jazz.net/library/article/634/ 
Can you write some links to available extension workshops ?
Thanks.

0 votes


Permanent link
That is what is there. I would suggest looking at the error in the log and to add that service to the prerequisites as described in the workshop. You add it in the plugin.xml.

Like:
.
.
.
         <extensionService
               componentId="net.jazz.rtcext.workitem.extensions"
               implementationClass="net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant">
            <prerequisites>
            <prerequisites>
               <requiredService
                  interface="com.ibm.team.workitem.service.IWorkItemServer"/>
               <requiredService
                  interface="com.ibm.team.build.internal.common.ITeamBuildService"/>
               <requiredService
                  interface="com.ibm.team.build.internal.common.ITeamBuildRequestService"/>
            </prerequisites>
        </extensionService>
.
.

0 votes

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
× 12,023

Question asked: Jul 08 '12, 8:04 a.m.

Question was seen: 5,006 times

Last updated: Jul 13 '12, 8:22 a.m.

Confirmation Cancel Confirm