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

get IVersionable(Handle) from UUID

How do I get IVersionable(Handle) from the UUID on the server.

I'am implementing a RPC service which can only take certain parameters when called from a client(https://jazz.net/wiki/bin/view/Sandbox/JAFServiceFramework)

I am passing a UUID object for a versionable and want to resolve that to a IVersinable(handle) instance.

I have asked a similar question earlier, but that was for resolving a UUID to a WorkItem. I have resolved that(See https://jazz.net/forum/questions/94483/get-workitem-from-uuid )

Anyone knows how to do that ?

1

0 votes


Accepted answer

Permanent link
  IAuditableHandle createAuditableHandle(IItemType itemType, UUID itemUuid, UUID stateUuid)
in IAuditableCommon

here is a different approach,  without needing to know the type in advance

if u have the UUID object
IItemHandle handle = IComponent.ITEM_TYPE.createHandle(uuid, null);
if u only have a String 
IItemHandle handle = IComponent.ITEM_TYPE.createHandle(UUID.valueOf(uuid_string), null);
for example
 IComponentHandle compphandle = (IComponentHandle) IComponent.ITEM_TYPE.createItemHandle(UUID.valueOf(compuuid), null);
or
 IWorkItemHandle workitemhandle = (IWorkItemHandle) IWorkItem.ITEM_TYPE.createItemHandle(UUID.valueOf(uuid), null);
ITeamRepository repo = ...;
IItem item = repo.itemManager.fetchCompleteItem(handle, IItemManager.DEFAULT, null);
IItemType type = item.getItemType();
System.out.println("Simple type name: " + type.getName());
System.out.println("Type's namespace: " + type.getNamespaceURI());

Martin Dam Pedersen selected this answer as the correct answer

4 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
× 10,938
× 1,202

Question asked: Nov 21 '12, 7:55 a.m.

Question was seen: 6,398 times

Last updated: Mar 18 '14, 11:31 a.m.

Confirmation Cancel Confirm