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

Programatically querying using Category property of workitem

Hi all,

I am trying to extract workitems that belong to only a particular category. For this I am modified the query to extract a particular type as follows:

IQueryableAttribute categoryAttribute= findAttribute(projectArea, auditableClient, IWorkItem.CATEGORY_PROPERTY, null);
AttributeExpression categoryExpression = new AttributeExpression(categoryAttribute, AttributeOperation.STARTS_WITH, "Agile");
Term term= new Term(Operator.AND);
term.add(categoryExpression);
return queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);

But I get the following exception:

Argument must be an instance of IAuditableHandle
at com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:69)
at com.ibm.team.workitem.common.internal.expression.AttributeValueFactory$ConstantValue.saveState(AttributeValueFactory.java:58)
at com.ibm.team.workitem.common.expression.AttributeExpression.saveValueProxy(AttributeExpression.java:165)
at com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:155)
at com.ibm.team.workitem.common.expression.Term.saveState(Term.java:189)
at com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:132)
at com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:57)
at com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:40)
at com.ibm.team.workitem.common.internal.query.QueryCommon.createQuery(QueryCommon.java:258)
at com.ibm.team.workitem.common.internal.query.QueryCommon.getResolvedExpressionResults(QueryCommon.java:123)
I am guessing that the implementation of
Now when I execute this I get the following IllegalArgumentException:
Argument must be an instance of IAuditableHandle
at com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:69)
at com.ibm.team.workitem.common.internal.expression.AttributeValueFactory$ConstantValue.saveState(AttributeValueFactory.java:58)
at com.ibm.team.workitem.common.expression.AttributeExpression.saveValueProxy(AttributeExpression.java:165)
at com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:155)
at com.ibm.team.workitem.common.expression.Term.saveState(Term.java:189)
at com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:132)
at com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:57)
at com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:40)
at com.ibm.team.workitem.common.internal.query.QueryCommon.createQuery(QueryCommon.java:258)
at com.ibm.team.workitem.common.internal.query.QueryCommon.getResolvedExpressionResults(QueryCommon.java:123)

I think that though CATEGORY_PROPERTY and TYPE_PROPERTY return the same type, their implementaiton is different. Is there any other way that I can query with the category type?

Thanks,
Ramya.

0 votes



5 answers

Permanent link
On 6/18/10 1:53 PM, ramya wrote:
Hi all,

I am trying to extract workitems that belong to only a particular
category. For this I am modified the query to extract a particular
type as follows:

IQueryableAttribute categoryAttribute= findAttribute(projectArea,
auditableClient, IWorkItem.CATEGORY_PROPERTY, null);
AttributeExpression categoryExpression = new
AttributeExpression(categoryAttribute,
AttributeOperation.STARTS_WITH, "Agile");
Term term= new Term(Operator.AND);
term.add(categoryExpression);
return queryClient.getResolvedExpressionResults(projectArea, term,
IWorkItem.FULL_PROFILE);

But I get the following exception:

Argument must be an instance of IAuditableHandle
at
com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:69)
at
com.ibm.team.workitem.common.internal.expression.AttributeValueFactory$ConstantValue.saveState(AttributeValueFactory.java:58)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveValueProxy(AttributeExpression.java:165)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:155)
at
com.ibm.team.workitem.common.expression.Term.saveState(Term.java:189)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:132)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:57)
at
com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:40)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.createQuery(QueryCommon.java:258)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.getResolvedExpressionResults(QueryCommon.java:123)
I am guessing that the implementation of
Now when I execute this I get the following IllegalArgumentException:
Argument must be an instance of IAuditableHandle
at
com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:69)
at
com.ibm.team.workitem.common.internal.expression.AttributeValueFactory$ConstantValue.saveState(AttributeValueFactory.java:58)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveValueProxy(AttributeExpression.java:165)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:155)
at
com.ibm.team.workitem.common.expression.Term.saveState(Term.java:189)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:132)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:57)
at
com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:40)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.createQuery(QueryCommon.java:258)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.getResolvedExpressionResults(QueryCommon.java:123)

I think that though CATEGORY_PROPERTY and TYPE_PROPERTY return the
same type, their implementaiton is different. Is there any other way
that I can query with the category type?

Thanks,
Ramya.


Categories are items (as opposed to the work item type which is a
string), so you must pass in the ICategoryHandle for the desired category.

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
Hi Patrick,

Thanks for your reply. Can you also tell me where I should pass the ICategoryHandle? I have created the ICategoryHandle as follows:

IWorkItemClient workItemClient = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);
ICategoryHandle categoryHandle = workItemClient.findCategoryByNamePath(projectArea, path, null);

I am not sure on where how I should add this ICategoryHandle to my Term.

Thanks,
Ramya.

On 6/18/10 1:53 PM, ramya wrote:
Hi all,

I am trying to extract workitems that belong to only a particular
category. For this I am modified the query to extract a particular
type as follows:

IQueryableAttribute categoryAttribute= findAttribute(projectArea,
auditableClient, IWorkItem.CATEGORY_PROPERTY, null);
AttributeExpression categoryExpression = new
AttributeExpression(categoryAttribute,
AttributeOperation.STARTS_WITH, "Agile");
Term term= new Term(Operator.AND);
term.add(categoryExpression);
return queryClient.getResolvedExpressionResults(projectArea, term,
IWorkItem.FULL_PROFILE);

But I get the following exception:

Argument must be an instance of IAuditableHandle
at
com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:69)
at
com.ibm.team.workitem.common.internal.expression.AttributeValueFactory$ConstantValue.saveState(AttributeValueFactory.java:58)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveValueProxy(AttributeExpression.java:165)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:155)
at
com.ibm.team.workitem.common.expression.Term.saveState(Term.java:189)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:132)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:57)
at
com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:40)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.createQuery(QueryCommon.java:258)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.getResolvedExpressionResults(QueryCommon.java:123)
I am guessing that the implementation of
Now when I execute this I get the following IllegalArgumentException:
Argument must be an instance of IAuditableHandle
at
com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:69)
at
com.ibm.team.workitem.common.internal.expression.AttributeValueFactory$ConstantValue.saveState(AttributeValueFactory.java:58)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveValueProxy(AttributeExpression.java:165)
at
com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:155)
at
com.ibm.team.workitem.common.expression.Term.saveState(Term.java:189)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:132)
at
com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:57)
at
com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:40)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.createQuery(QueryCommon.java:258)
at
com.ibm.team.workitem.common.internal.query.QueryCommon.getResolvedExpressionResults(QueryCommon.java:123)

I think that though CATEGORY_PROPERTY and TYPE_PROPERTY return the
same type, their implementaiton is different. Is there any other way
that I can query with the category type?

Thanks,
Ramya.


Categories are items (as opposed to the work item type which is a
string), so you must pass in the ICategoryHandle for the desired category.

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
Thanks for your reply. Can you also tell me where I should pass the
ICategoryHandle? I have created the ICategoryHandle as follows:

IWorkItemClient workItemClient = (IWorkItemClient)
repository.getClientLibrary(IWorkItemClient.class);
ICategoryHandle categoryHandle =
workItemClient.findCategoryByNamePath(projectArea, path, null);

I am not sure on where how I should add this ICategoryHandle to my
Term.

You modify your existing category expression to look like this:

AttributeExpression categoryExpression = new
AttributeExpression(categoryAttribute, AttributeOperation.EQUALS,
categoryHandle);

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
That works! Thank you very much, Patrick!
Appreciate your help.
Ramya.

Thanks for your reply. Can you also tell me where I should pass the
ICategoryHandle? I have created the ICategoryHandle as follows:

IWorkItemClient workItemClient = (IWorkItemClient)
repository.getClientLibrary(IWorkItemClient.class);
ICategoryHandle categoryHandle =
workItemClient.findCategoryByNamePath(projectArea, path, null);

I am not sure on where how I should add this ICategoryHandle to my
Term.

You modify your existing category expression to look like this:

AttributeExpression categoryExpression = new
AttributeExpression(categoryAttribute, AttributeOperation.EQUALS,
categoryHandle);

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
I'm trying to do exactly this, but seeing your code:

workItemClient.findCategoryByNamePath(projectArea, path, null); 

I'm not quite sure what path is or how to do it in the documentation says it is a List of string but I don't know what should be in it

Any advice?

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,954

Question asked: Jun 18 '10, 7:52 a.m.

Question was seen: 6,905 times

Last updated: Jul 19 '12, 3:21 p.m.

Confirmation Cancel Confirm