It's all about the answers!

Ask a question

Retrieving workitem attributes programmatically


Marcel Porz (632) | asked Apr 03 '09, 3:55 a.m.
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:

...

							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



permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Apr 06 '09, 8:11 a.m.
JAZZ DEVELOPER
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

Your answer


Register or to post your answer.