It's all about the answers!

Ask a question

get IVersionable(Handle) from UUID

Martin Dam Pedersen (1352814) | asked Nov 21 '12, 7:55 a.m.
retagged Mar 18 '14, 11:31 a.m. by Evan Hughes (2.4k1318)
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(

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 )

Anyone knows how to do that ?

Accepted answer

permanent link
sam detweiler (12.5k6195201) | answered Nov 21 '12, 8:49 a.m.
edited Mar 18 '14, 9:38 a.m.
  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);
 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

Your answer

Register or 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.