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.
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.
5 answers
On 6/18/10 1:53 PM, ramya wrote:
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
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
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.
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
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
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
That works! Thank you very much, Patrick!
Appreciate your help.
Ramya.
You modify your existing category expression to look like this:
AttributeExpression categoryExpression = new
AttributeExpression(categoryAttribute, AttributeOperation.EQUALS,
categoryHandle);
--
Regards,
Patrick
Jazz Work Item Team
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