How to join expressions using term to get the specific workitems
I want to get defect WorkItems which have foundIn values assigned to either Test1 or Test2 (for example) for particular project. so i have two expressions related to these found in values
Term term1 = new Term(Operator.AND);
term1.add(projectAreaExpression); //For particular project
term1.add(workItemTypeExpression); //For workitem type defect
Term term2 = new Term(Operator.OR);
term2.add(foundIn1Expression); //For found in value set to Test1
term2.add(foundIn2Expression); //For found in value set to Test2
How can we join these 2 terms that we can use it below to get the specific workItems?
com.ibm.team.workitem.common.query.IQueryResult<iresolvedresult<iworkitem>> results = queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);
Term term1 = new Term(Operator.AND);
term1.add(projectAreaExpression); //For particular project
term1.add(workItemTypeExpression); //For workitem type defect
Term term2 = new Term(Operator.OR);
term2.add(foundIn1Expression); //For found in value set to Test1
term2.add(foundIn2Expression); //For found in value set to Test2
How can we join these 2 terms that we can use it below to get the specific workItems?
com.ibm.team.workitem.common.query.IQueryResult<iresolvedresult<iworkitem>> results = queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);
One answer
I have figured out the way to achieve this as below.
--------------------------
term1.add(term2);
com.ibm.team.workitem.common.query.IQueryResult<iresolvedresult<iworkitem>> results = queryClient.getResolvedExpressionResults(projectArea, term1, IWorkItem.FULL_PROFILE);
-------------------------
class Term extends Expression so you can add term as well in place of expression.
--------------------------
term1.add(term2);
com.ibm.team.workitem.common.query.IQueryResult<iresolvedresult<iworkitem>> results = queryClient.getResolvedExpressionResults(projectArea, term1, IWorkItem.FULL_PROFILE);
-------------------------
class Term extends Expression so you can add term as well in place of expression.