How to Create Expression for Planned for attribute using Java API
![]() Hello All,
We are trying to create Query from Java API(we don't want to run the shared Query), the condition should include Project area, Modified Date and Planned For Attribute. we are trying the below code but we are getting below exception
Exception in thread "main" java.lang.IllegalArgumentException: Argument must be an instance of IAuditableHandle at com.ibm.team.workitem.common.internal.model.SetAttributeType.toString(SetAttributeType.java:73) 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:175) at com.ibm.team.workitem.common.expression.AttributeExpression.saveState(AttributeExpression.java:165) at com.ibm.team.workitem.common.expression.Term.saveState(Term.java:209) at com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:137) at com.ibm.team.workitem.common.internal.expression.XMLExpressionSerializer.serialize(XMLExpressionSerializer.java:56) at com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:93) at com.ibm.team.workitem.common.internal.query.impl.QueryDescriptorCustomImpl.setExpression(QueryDescriptorCustomImpl.java:86)
The code we are trying is mentioned below for Planned for attribute
IQueryableAttribute workItemPlannedForAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE)
.findAttribute(projectArea, com.ibm.team.workitem.api.common.IWorkItem.PLANNED_FOR, auditableClient, null); AttributeExpression workItemPlannedForExpression = new AttributeExpression(workItemPlannedForAttribute, AttributeOperation.MATCHES, PlannedFor); |
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Sep 19 '17, 10:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Sep 19 '17, 10:09 a.m. You need to be careful with the operations. MATCHES is full text or text compare. Some example code: IAuditableCommon auditableCommon = (IAuditableCommon) teamRepository .getClientLibrary(IAuditableCommon.class); See https://rsjazz.wordpress.com/2012/10/05/handling-iterations-automation-for-the-planned-for-attribute/ for the development line helper code. Navin R S selected this answer as the correct answer
|
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.