find severity name of a WorkItem
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
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
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.