It's all about the answers!

Ask a question

Converting enumeration attribute values to consumable String


Chibuzo Obi (3112) | asked Jun 13 '08, 9:52 a.m.
Hello,
I'm trying to retrieve the value of a workItem attribute, which is an enumeration type. When I call the IWorkitem.getValue(IAttribute) method, I get the following String: com.ibm.team.workitem.common.model.ILiteral:enumRepeatability.literal.l6

I was expecting a value of "Unassigned". Therefore how can I derive the actual value I'm looking for?
Thanks in advance.

2 answers



permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Jun 16 '08, 2:48 a.m.
JAZZ DEVELOPER
Hi
You can resolve the enumeration using: IWorkItemCommon#resolveEnumeration(IAttributeHandle attribute, IProgressMonitor monitor), which returns an IEnumeration. This can be asked about a literal for a certain id (in your case 'enumRepeatability.literal.l6'). On the literal, getName should return the expected 'Unassigned'.

HTH

Marcel
Jazz Work Item team

Comments
SEC Servizi commented May 15 '13, 11:22 a.m.

There is an API constant to refer to the 'Unassigned' value?


permanent link
Chibuzo Obi (3112) | answered Jun 16 '08, 3:34 a.m.
Yes, thanks very much Marcel.
I already implemented it through that method - by retrieving all the literals from the IAttribute's IEnumeration, and iterating through them while doing an id comparison. When found, I'd invoke the getName on the literal.

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.