It's all about the answers!

Ask a question

Problem creating WorkItem by Java APIs


Alberto Ceravolo (1698) | asked Mar 15 '10, 12:07 p.m.
Hi, i'm new to RTC, and i'm tryng to create a workitem using the examples in "WorkItem Java APIs" section, but i get an exception and a notification like:

Summary: Attribute 'ODC Activity' not set
Description: The 'ODC Activity' attribute needs to be set (work item <04>).

Summary: Attribute 'ODC Trigger' not set
Description: The 'ODC Trigger' attribute needs to be set (work item <04>).

......

Summary: Attribute 'Description' not set
Description: The 'Description' attribute needs to be set (work item <04>).

Obviously the problem is that some attributes are mandatory and i have to set them. So, how can I set an attribute of a workitem? I tried
workItem.setValue(IAttribute attr,Object value); but i don't know how get an IAttribute object. Sorry but i didn't find any documentation.

One answer



permanent link
Patrick Streule (4.9k21) | answered Mar 17 '10, 4:51 a.m.
JAZZ DEVELOPER
On 3/15/10 5:08 PM, albjazz wrote:
Hi, i'm new to RTC, and i'm tryng to create a workitem using the
examples in "WorkItem Java APIs" section, but i get an
exception and a notification like:

Summary: Attribute 'ODC Activity' not set
Description: The 'ODC Activity' attribute needs to be set (work item
04>).

Summary: Attribute 'ODC Trigger' not set
Description: The 'ODC Trigger' attribute needs to be set (work item
04>).

.....

Summary: Attribute 'Description' not set
Description: The 'Description' attribute needs to be set (work item
04>).

Obviously the problem is that some attributes are mandatory and i have
to set them. So, how can I set an attribute of a workitem? I tried
workItem.setValue(IAttribute attr,Object value); but i don't know how
get an IAttribute object. Sorry but i didn't find any documentation.

You can get an IAttribute using the following method of IWorkItemClient:

IAttribute findAttribute(IProjectAreaHandle projectArea, String
identifier, IProgressMonitor monitor) throws TeamRepositoryException;

E.g.:
IAttribute descriptionAttribute=
findAttribute(workItem.getProjectArea(), IWorkItem.DESCRIPTION_PROPERTY,
monitor);

--
Regards,
Patrick
Jazz Work Item Team

Your answer


Register or to post your answer.