It's all about the answers!

Ask a question

Finding what type of Item a UUID represents


K M (38325251) | asked Nov 28 '11, 3:03 p.m.
Is there a way to find the type of ITEM (Baseline, workspace, snapshot...) a UUID represents?

10 answers



permanent link
Nick Edgar (6.5k711) | answered Nov 28 '11, 7:08 p.m.
JAZZ DEVELOPER
Well, there isn't any official API for this, but you can do:
- copy the UUID
- paste it into a URL of the form:
<your_repo>/resource/itemOid/com.ibm.team.scm.Component/_DC6QYM0yEd2CTNaxDdYRfg?_mediaType=text/xml
(replacing the UUID there with yours)
- open this in a web browser
- there the XML should indicate the type

For example, in this case the item in our self-hosting repository is a workspace, so the XML is:

<?xml version="1.0" encoding="UTF-8" ?>
<scm:Workspace
xmlns:repository="com.ibm.team.repository"
xmlns:scm="com.ibm.team.scm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" itemId="_DC6QYM0yEd2CTNaxDdYRfg" properties="">
...


Here, the XML namespace is the id for the component (com.ibm.team.scm) defining the item type (Workspace).

permanent link
K M (38325251) | answered Nov 29 '11, 7:13 a.m.
Sorry I need to be able to do this using the Java API, is it possible.

permanent link
Nick Edgar (6.5k711) | answered Nov 29 '11, 10:00 a.m.
JAZZ DEVELOPER
You could try just creating a handle of a given type with the UUID, fetching it, then seeing what the actual type is.

e.g.
IItemHandle handle = IComponent.ITEM_TYPE.createHandle(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());

permanent link
Nick Edgar (6.5k711) | answered Nov 29 '11, 10:03 a.m.
JAZZ DEVELOPER
Just curious: why do you need to do this? Normally the UUID should be paired with its item type.

permanent link
K M (38325251) | answered Dec 01 '11, 2:27 p.m.
Since name are not unique in rtc we are storing UUID, it would be nice to know what a UUID represents when we have problems.

permanent link
Nick Edgar (6.5k711) | answered Dec 01 '11, 3:18 p.m.
JAZZ DEVELOPER
In RTC itself, when we store a reference to another item, we store an item handle, which is: item type + item UUID .

I suggest you store the item type too, not just the UUID.

permanent link
Steve Woodbridge (1352326) | answered Jan 26 '12, 8:02 p.m.
We have problem where the end user will be presented with an error message and part of the message is "... Type=WorkItem, Itemid=(UUID...and then the value). But it doesn't tell us which field in the Work item it pertains to. It doesn't always occur. But it would be nice if we could instruct the person what to do in order to see which field is the problem.

We just do basic configuration of a Work Items - so we are not doing anything special that includes overt creation / association of UUIDs.

Does this point to something wrong in RTC 3.0.1 ? (not the fact that we get an error, but the fact that we do see the name of the field that is in error).

permanent link
Nick Edgar (6.5k711) | answered Jan 26 '12, 8:24 p.m.
JAZZ DEVELOPER
Please file a work item against the Work Items team for this issue, including what steps lead to that error. At minimum, it's a pretty poor error message, and we're doing a pass to improve error messages in general in 4.0 M8 (our next milestone, starting next week).

permanent link
Steve Woodbridge (1352326) | answered Jan 26 '12, 8:26 p.m.
Will do. Thanks for the response.

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.