It's all about the answers!

Ask a question

[closed] Getting Attributes of a Defect work items


Myroslav Palenychka (51175) | asked May 29 '09, 3:42 p.m.
closed Jun 20 '15, 4:17 p.m. by Ralph Schoon (63.3k33646)
Hello,

I have done some examples with work items and I cannot find how I can retrieve fields like Filed Against and Planned for attributes of a work item. I was looking in methods of IWorkItem and there is no method get PlannedFor. What should I do and which class should I use for that?

Regards,
Myroslav

The question has been closed for the following reason: "The question is answered, right answer was accepted" by rschoon Jun 20 '15, 4:17 p.m.

13 answers



permanent link
Patrick Streule (4.9k21) | answered May 31 '09, 7:52 a.m.
JAZZ DEVELOPER
I have done some examples with work items and I cannot find how I can
retrieve fields like Filed Against and Planned for attributes of a
work item. I was looking in methods of IWorkItem and there is no
method get PlannedFor. What should I do and which class should I use
for that?

The methods are IWorkItem#getValue(IAttribute attribute) and
IWorkItem#setValue(IAttribute attribute, Object value)

In order to get the IAttribute, you would use:

IWorkItemClient client= repository.getClientLibrary(IWorkItemClient.class);
IAttribute filedAgainst= client.findAttribute(projectArea,
IWorkItem.CATEGORY_PROPERTY, monitor);

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Myroslav Palenychka (51175) | answered Jun 02 '09, 11:13 a.m.
I was able to get attributes with IAttribute class however all I need is to display it as a String, say found in: "1.1.1". When I output IAttribute I get:
Found in: com.ibm.team.workitem.common.internal.model.impl.DeliverableHandleImpl@1c771c77 (stateId: <unset>, itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@69526952, immutable: true)

Thanks,
Myroslav

I have done some examples with work items and I cannot find how I can
retrieve fields like Filed Against and Planned for attributes of a
work item. I was looking in methods of IWorkItem and there is no
method get PlannedFor. What should I do and which class should I use
for that?

The methods are IWorkItem#getValue(IAttribute attribute) and
IWorkItem#setValue(IAttribute attribute, Object value)

In order to get the IAttribute, you would use:

IWorkItemClient client= repository.getClientLibrary(IWorkItemClient.class);
IAttribute filedAgainst= client.findAttribute(projectArea,
IWorkItem.CATEGORY_PROPERTY, monitor);

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Patrick Streule (4.9k21) | answered Jun 02 '09, 1:39 p.m.
JAZZ DEVELOPER
I was able to get attributes with IAttribute class however all I need
is to display it as a String, say found in: "1.1.1". When I
output IAttribute I get:
Found in:
com.ibm.team.workitem.common.internal.model.impl.DeliverableHandleImpl@1c771c77
(stateId: <unset>, itemId: ,
origin:
com.ibm.team.repository.client.internal.TeamRepository@69526952,
immutable: true)

You will have to resolve the resulting deliverable:

IDeliverableHandle handle= (IDeliverableHandle)
workItem.getValue(foundInAttribute);
IDeliverable deliverable= auditableClient.resolveAuditable(handle,
IDeliverable.SMALL_PROFILE, monitor);

display(deliverable.getName());


--
Regards,
Patrick
Jazz Work Item Team

permanent link
Myroslav Palenychka (51175) | answered Jun 04 '09, 2:37 p.m.
Thanks for your replay Patrik. I was able to get and display Found In attribute as there is attribute IWorkItem.FOUND_IN_PROPERTY. However for Planned for and Filed against I still have a problem. In the class IWorkIteam I cannot find PLANNED_FOR_PROPERTY String attribute. I don't think it is there. How I can display Planned for and Filed against properties of a work item?

Thanks,
Myroslav


I was able to get attributes with IAttribute class however all I need
is to display it as a String, say found in: "1.1.1". When I
output IAttribute I get:
Found in:
com.ibm.team.workitem.common.internal.model.impl.DeliverableHandleImpl@1c771c77
(stateId: <unset>, itemId: ,
origin:
com.ibm.team.repository.client.internal.TeamRepository@69526952,
immutable: true)

You will have to resolve the resulting deliverable:

IDeliverableHandle handle= (IDeliverableHandle)
workItem.getValue(foundInAttribute);
IDeliverable deliverable= auditableClient.resolveAuditable(handle,
IDeliverable.SMALL_PROFILE, monitor);

display(deliverable.getName());


--
Regards,
Patrick
Jazz Work Item Team

permanent link
Patrick Streule (4.9k21) | answered Jun 05 '09, 4:37 a.m.
JAZZ DEVELOPER
Thanks for your replay Patrik. I was able to get and display Found In
attribute as there is attribute IWorkItem.FOUND_IN_PROPERTY. However
for Planned for and Filed against I still have a problem. In the
class IWorkIteam I cannot find PLANNED_FOR_PROPERTY String attribute.
I don't think it is there. How I can display Planned for and Filed
against properties of a work item?

There were terminology changes over time, so the properties you are
looking for are:

Filed Against: IWorkItem.CATEGORY_PROPERTY
Planned For: IWorkItem.TARGET_PROPERTY

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Myroslav Palenychka (51175) | answered Jun 05 '09, 11:00 a.m.
Thanks, I was able to successfully get the Category with using ICategoryHandle and ICategory classes. I still have problems with TARGET_PROPERTY.

IIterationHandle iterHandle = (IIterationHandle)item.getValue(plannedFor);

Iteration iter = auditableClient.resolveAuditable(iterHandle,IIteration.SMALL_PROFILE, monitor);


But there is no attriubute IIteration.SMALL_PROFILE in class IIteration. Am I doing something wrong?

Thanks,
Myroslav


Thanks for your replay Patrik. I was able to get
and display Found In
attribute as there is attribute IWorkItem.FOUND_IN_PROPERTY. However
for Planned for and Filed against I still have a problem. In the
class IWorkIteam I cannot find PLANNED_FOR_PROPERTY String attribute.
I don't think it is there. How I can display Planned for and Filed
against properties of a work item?

There were terminology changes over time, so the properties you are
looking for are:

Filed Against: IWorkItem.CATEGORY_PROPERTY
Planned For: IWorkItem.TARGET_PROPERTY

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Samit Mehta (31103) | answered Jun 05 '09, 7:03 p.m.
JAZZ DEVELOPER
Myroslav,

Try the following:


IIteration iter = (IIteration) repository.itemManager().fetchCompleteItem(iterHandle, IItemManager.DEFAULT, monitor);


Regards,
Samit Mehta

permanent link
Patrick Streule (4.9k21) | answered Jun 07 '09, 7:01 a.m.
JAZZ DEVELOPER
Iteration iter =
auditableClient.resolveAuditable(iterHandle,IIteration.SMALL_PROFILE,
monitor);


But there is no attriubute IIteration.SMALL_PROFILE in class
IIteration. Am I doing something wrong?

Use Samit's approach or alternatively, you can use

ItemProfile.ITERATION_DEFAULT

instead of

IIteration.SMALL_PROFILE

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Myroslav Palenychka (51175) | answered Jun 10 '09, 12:54 p.m.
Thanks to your and Samits replies.

Another question I have is how to retrieve all iterations available for a project ares. I check the ProjectArea class and could not get a method for it.

Thanks,
Myroslav


Iteration iter =
auditableClient.resolveAuditable(iterHandle,IIteration.SMALL_PROFILE,
monitor);


But there is no attriubute IIteration.SMALL_PROFILE in class
IIteration. Am I doing something wrong?

Use Samit's approach or alternatively, you can use

ItemProfile.ITERATION_DEFAULT

instead of

IIteration.SMALL_PROFILE

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Ryan Manwiller (1.3k1) | answered Jun 10 '09, 1:58 p.m.
JAZZ DEVELOPER
Try:

IProjectArea.getDevelopmentLines()
IDevelopmentLine.getIterations()
IIteration.getChildren()

---
Ryan Manwiller
Jazz Team