It's all about the answers!

Ask a question

How to get the available work items in a Project Area


Maria Velasco (4641) | asked Jan 23 '09, 6:05 p.m.
Hello,

We are new to using the Jazz APIs and we are trying to get all the available work items (specifically Defects) in a certain Project Area. Can anyone please help us out on how to get started?

We have read the following https://jazz.net/wiki/bin/view/Main/QueryDevGuide; however, when it gets to the following line

IQueryResult<IResolvedResult<IWorkItem>> result = queryClient.getResolvedExpressionResults(projectAreaHandle, projectExpression, profile);

we get an InvocationTargetException.

Any help would be appreciated and I apologize for the lack of knowledge as we are still trying to learn it all.

Thank you.

3 answers



permanent link
Kinny Kun (5183) | answered Jan 23 '09, 6:30 p.m.
Hi,

I'm new to the Jazz Api as well and I'm facing the similar issue. I want to know how to get all the existing work items from the project area using the Jazz Api. Any help is appreciated.

I'm at the point where I got the IProjectArea and IProjectAreaHandle objects. How can I get all the work items from this point on?

Many thanks!

permanent link
Patrick Streule (4.9k21) | answered Feb 03 '09, 4:48 a.m.
JAZZ DEVELOPER
I'm new to the Jazz Api as well and I'm facing the similar issue. I
want to know how to get all the existing work items from the project
area using the Jazz Api. Any help is appreciated.

I'm at the point where I got the IProjectArea and IProjectAreaHandle
objects. How can I get all the work items from this point on?

Possibility 1)

IProjectAreaHandle projectArea=...;
IAuditableClient auditableClient=...;
IQueryClient queryClient=...

IQueryableAttribute attribute=
QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea,
IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, monitor);
Expression expression= new AttributeExpression(attribute,
AttributeOperation.EQUALS, projectArea);
IQueryResult<IResolvedResult<IWorkItem>> results=
queryClient.getResolvedExpressionResults(projectArea, expression,
IWorkItem.SMALL_PROFILE);


Possibility 2)

IProjectAreaHandle projectArea=...;
IAuditableClient auditableClient=...;

IItemQuery query= IItemQuery.FACTORY.newInstance(WorkItemQueryModel.ROOT);
IPredicate predicate=
WorkItemQueryModel.ROOT.projectArea()._eq(query.newItemHandleArg())
query.filter(predicate);
ItemQueryIterator<IWorkItemHandle> iterator= new
ItemQueryIterator<IWorkItemHandle>(auditableClient, query, new Object[] {
projectArea });


--
Regards,
Patrick
Jazz Work Item Team

permanent link
Maria Velasco (4641) | answered Feb 03 '09, 12:09 p.m.
I'm new to the Jazz Api as well and I'm facing the similar issue. I
want to know how to get all the existing work items from the project
area using the Jazz Api. Any help is appreciated.

I'm at the point where I got the IProjectArea and IProjectAreaHandle
objects. How can I get all the work items from this point on?

Possibility 1)

IProjectAreaHandle projectArea=...;
IAuditableClient auditableClient=...;
IQueryClient queryClient=...

IQueryableAttribute attribute=
QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea,
IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, monitor);
Expression expression= new AttributeExpression(attribute,
AttributeOperation.EQUALS, projectArea);
IQueryResult<IResolvedResult<IWorkItem>> results=
queryClient.getResolvedExpressionResults(projectArea, expression,
IWorkItem.SMALL_PROFILE);


Possibility 2)

IProjectAreaHandle projectArea=...;
IAuditableClient auditableClient=...;

IItemQuery query= IItemQuery.FACTORY.newInstance(WorkItemQueryModel.ROOT);
IPredicate predicate=
WorkItemQueryModel.ROOT.projectArea()._eq(query.newItemHandleArg())
query.filter(predicate);
ItemQueryIterator<IWorkItemHandle> iterator= new
ItemQueryIterator<IWorkItemHandle>(auditableClient, query, new Object[] {
projectArea });


--
Regards,
Patrick
Jazz Work Item Team

Thank you, this helped!

Your answer


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