It's all about the answers!

Ask a question

find severity name of a WorkItem


Andy Berner (61127) | asked Jul 24 '08, 12:45 p.m.
If I have a work item, it's easy to get the ID of the severity assigned:

Identifier<ISeverity> theSev= theDefect.getSeverity();
String sevName = theSev.getStringIdentifier();

(for example, this will give a value such as severity.literal.l6)

But I don't see how to get the display name of the severity, such as "Blocker", since I don't see how convert the Identifier<ISeverity> object to the ISeverity object itself.

I can go the other way! If I have an ISeverity object, I can get the Identifier:

ISeverity iAmBlocker theSev ...
String blockersName = theSev.getName //"Blocker"
Identifier<ISeverity> blockersID = theSev.getIdentifier2();
String blockerIDName = blockersID.getStringIdentifier(); //"severity.literal.l6"

But given a work item, how do I find out if it's severity is "Blocker"?

One answer



permanent link
Christof Marti (681) | answered Jul 28 '08, 4:03 a.m.
You can use the following (with projectArea= workItem.getProjectArea()):

IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
IAttribute severityAttribute= workItemClient.findAttribute(projectArea, IWorkItem.SEVERITY_PROPERTY, null);
IEnumeration<ISeverity> severityEnumeration= (IEnumeration<ISeverity>) workItemClient.resolveEnumeration(severityAttribute, null);
ISeverity severity= severityEnumeration.findEnumerationLiteral(severityIdentifier);

Note that 'severity' might be null because the user can remove literals from an enumeration that are already in use.

Regards,

Christof
Jazz Work Item team

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.