Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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:

...

							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.

0 votes



One answer

Permanent link
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

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Apr 03 '09, 3:55 a.m.

Question was seen: 6,684 times

Last updated: Apr 03 '09, 3:55 a.m.

Confirmation Cancel Confirm