API to find the UUID of work item ?
IWorkItem storyDetails = (IWorkItem) teamRepository.itemManager().fetchCompleteItem(workItemHandle, ItemManager.DEFAULT, monitor);
storyDetails.getItemId().toString()
above code gives below result
[UUID _n-JfsjeBEeWvWq64jXWwMA]
my requirement is only UUID value alone not with in brackets
Is there any API call which gives diretly just _n-JfsjeBEeWvWq64jXWwMA UUID value?
|
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Nov 12 '15, 10:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can get that from an ItemHandle or the Item using anItemHandle.getItemId().getUuidValue()
So storyDetails.getItemId().getUuidValue() should give it to you. It is always worth to look at an object like the UUID and check the access methods it provides. vijayakumar ramesh selected this answer as the correct answer
Comments
vijayakumar ramesh
commented Nov 13 '15, 5:47 a.m.
Thanks Ralph, Sam and Tiago for the support and help. |
One other answer
Hi!
The main problem is that the UUID object is represented by the class:
com.ibm.team.repository.common.UUID
and the the toString method is implemented to generate such value.
If you inspect how the com.ibm.team.repository.common.UUID create the UUID value, you will see that the algorithm to create the final value is based on two properties:
lsb - less significant bits
msb - most significant bits
Based on that, I did some hack to get the private fields (lsb and msb) from the com.ibm.team.repository.common.UUID object. With this two values you can instantiate (using this constructor java.util.UUID.UUID(long mostSigBits, long leastSigBits) a java.util.UUID object and finally print the real UUID value.
Comments
vijayakumar ramesh
commented Nov 12 '15, 9:31 a.m.
storyDetails.getItemId().toString()
method prints the [UUID _n-JfsjeBEeWvWq64jXWwMA] this value
Is it possible to share u r code regarding above LSB and MSB ?
sam detweiler
commented Nov 12 '15, 11:39 a.m.
ralph has the right answer below.
|
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.