Welcome to the Jazz Community Forum
How can I get more information from query result?

I have retrieve workitem list by executing a query. This query returns some defects, but IWorkItem interface only have limited method to get basic information.How can I get Severity,Project Area,Team Area,Creation Date,Created Owner?
following is part of my code:
The result is:
workitem Owner:
com.ibm.team.repository.common.model.impl.ContributorHandleImpl@10b010b0 (stateId: <unset>, itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@73c073c, immutable: true)
getProjectArea():com.ibm.team.process.internal.common.impl.ProjectAreaHandleImpl@11041104 (stateId: , itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@73c073c, immutable: true)
getPriority():com.ibm.team.workitem.common.model.IPriority:priority.literal.l07
getSeverity():com.ibm.team.workitem.common.model.ISeverity:severity.literal.l3
How can I get the result just I want?like follow:
workitem Owner:some people's name
ProjectArea:The real Project area
Priority:High/Low/
SecurityNormal/Major
following is part of my code:
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"workitem Owner: "+workItem.getOwner()+getProjectArea() "+workItem.getProjectArea()+"getPriority()"+workItem.getPriority()
+"getSeverity()"+workItem.getSeverity()
}
The result is:
com.ibm.team.repository.common.model.impl.ContributorHandleImpl@10b010b0 (stateId: <unset>, itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@73c073c, immutable: true)
getProjectArea():com.ibm.team.process.internal.common.impl.ProjectAreaHandleImpl@11041104 (stateId: , itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@73c073c, immutable: true)
getPriority():com.ibm.team.workitem.common.model.IPriority:priority.literal.l07
getSeverity():com.ibm.team.workitem.common.model.ISeverity:severity.literal.l3
How can I get the result just I want?like follow:
workitem Owner:some people's name
ProjectArea:The real Project area
Priority:High/Low/
SecurityNormal/Major
3 answers

I have retrieve workitem list by executing a query. This query returns
some defects, but IWorkItem interface only have limited method to get
basic information.How can I get Severity,Project Area,Team
Area,Creation Date,Created Owner?
For Severity and Priority, see my answer in the other post.
For handles like Owner, Created By and Project Area, you have to resolve
them to an item:
E.g. for Owner:
IContributor owner= auditableClient.resolveAuditable(handle,
ItemProfile.CONTRIBUTOR_DEFAULT, monitor);
Analogous for other types.
The Team Area is a bit special, as it is calculated. Use
IProcessAreaHandle teamOrProject=
workItemClient.findProcessArea(workItem, monitor);
and resolve the handle analogous to the snippet above.
--
Regards,
Patrick
RTC Work Item Component Lead

I have retrieve workitem list by executing a query. This query returns
some defects, but IWorkItem interface only have limited method to get
basic information.How can I get Severity,Project Area,Team
Area,Creation Date,Created Owner?
For Severity and Priority, see my answer in the other post.
For handles like Owner, Created By and Project Area, you have to resolve
them to an item:
E.g. for Owner:
IContributor owner= auditableClient.resolveAuditable(handle,
ItemProfile.CONTRIBUTOR_DEFAULT, monitor);
Analogous for other types.
The Team Area is a bit special, as it is calculated. Use
IProcessAreaHandle teamOrProject=
workItemClient.findProcessArea(workItem, monitor);
and resolve the handle analogous to the snippet above.
--
Regards,
Patrick
RTC Work Item Component Lead
Hi Patrick
We have got lots of components as your method,but we still can't get owner(we have got creater),state,and creationDate can you tell me how to get them?
Thank you for your time!

On 11/18/10 11:53 AM, liumawang wrote:
Well, JDT's code completion would be a way to find out.
IWorkItem has:
getOwner()
getState2()
getCreationDate()
To get the state name, you have to use:
IWorkflowInfo info= workItemClient.findWorkflowInfo(workitem, monitor);
String name= info.getStateName(workitem.getState2());
--
Regards,
Patrick
RTC Work Item Component Lead
We have got lots of components as your method,but we still can't
get owner(we have got creater),state,and creationDate can you tell me
how to get them?
Well, JDT's code completion would be a way to find out.
IWorkItem has:
getOwner()
getState2()
getCreationDate()
To get the state name, you have to use:
IWorkflowInfo info= workItemClient.findWorkflowInfo(workitem, monitor);
String name= info.getStateName(workitem.getState2());
--
Regards,
Patrick
RTC Work Item Component Lead