Retrieving workitem attributes programmatically
Hi,
I want to retrieve the attributes of workitems programmatically. I need the string representation of each attribute. It works for summary, id, comments and status. But I don't know how to retrieve e.g. the severity attribute.
Here is my code:
...
Thanks and Regards
Marcel.
I want to retrieve the attributes of workitems programmatically. I need the string representation of each attribute. It works for summary, id, comments and status. But I don't know how to retrieve e.g. the severity attribute.
Here is my code:
...
if (jazzAttributeName
.equalsIgnoreCase(ATTRIBUTE_INTERNALSTATE)) {
Identifier<IState> internalState = resolved.getItem().getState2();
IWorkflowInfo workflowInfo = workItemClient.findWorkflowInfo(resolved.getItem(), null);
String stateName = workflowInfo.getStateName(internalState);
myWorkItem.SetWorkItemAttribute(
jazzAttributeName, stateName);
}
if (jazzAttributeName
.equalsIgnoreCase(ATTRIBUTE_INTERNALSEVERITY)) {
Identifier<ISeverity> severity = resolved.getItem().getSeverity();
????????
}
Thanks and Regards
Marcel.
One answer
Hi Marcel
For enumeration attributes (e.g. severity, priority), you have to resolve the according enumeration and can then find he display name for a literal.
IAttribute attribute= workItemClient.findAttribute(projectArea, ATTRIBUTE_INTERNALSEVERITY, monitor)
IEnumeration<?> enumeration= workItemClient.resolveEnumeration(attribute, monitor);
ILiteral severityLiteral= enumeration.findEnumerationLiteral(severity);
severityLiteral.getName();....
Regards
Marcel
Jazz Work Item team
For enumeration attributes (e.g. severity, priority), you have to resolve the according enumeration and can then find he display name for a literal.
IAttribute attribute= workItemClient.findAttribute(projectArea, ATTRIBUTE_INTERNALSEVERITY, monitor)
IEnumeration<?> enumeration= workItemClient.resolveEnumeration(attribute, monitor);
ILiteral severityLiteral= enumeration.findEnumerationLiteral(severity);
severityLiteral.getName();....
Regards
Marcel
Jazz Work Item team