How to programmatically retrieve work items owned by a user?
I have tried the following to retrieve work items owned by a particular user in a project area from a plain Java client.
//------------------------------------------------------------------------------------ IQueryableAttribute projectAreaAttribute= findAttribute(projectArea, auditableClient, IWorkItem.PROJECT_AREA_PROPERTY, null); AttributeExpression projectAreaExpression= new AttributeExpression(projectAreaAttribute, AttributeOperation.EQUALS, projectArea); IQueryableAttribute assignedToAttribute= findAttribute(projectArea, auditableClient, IWorkItem.OWNER_PROPERTY, null); AttributeExpression assignedToExpression= new AttributeExpression(assignedToAttribute, AttributeOperation.EQUALS, "test"); Term term= new Term(Operator.AND); term.add(projectAreaExpression); term.add(assignedToExpression); return queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.SMALL_PROFILE); //------------------------------------------------------------------------------------ I get the following error while retrieving results: 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: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) Can someone help? |
4 answers
Kamal Suruguchi (151●1●21●14)
| answered May 31 '11, 11:58 a.m.
edited Feb 12 '17, 6:42 p.m. by Geoffrey Clemm (30.1k●3●30●35) Full source code of a similar class (with no query on OWNER_PROPERTY) is available here: https://jazz.net/wiki/pub/Main/QueryDevGuide/DupeFinder.java
|
The owner attribute is of type 'Contributor'. So you can compare the attribute against a string, but need to pass in a object of Contributor.
Use ITeamRepository.contributorManager() to get a hold of contributors. |
Kamal Suruguchi (151●1●21●14)
| answered Jun 10 '11, 10:27 a.m.
edited Feb 12 '17, 6:43 p.m. by Geoffrey Clemm (30.1k●3●30●35) I have now tried the following:
Comments
Bryan Miller - Integration Developer
commented Jun 14 '12, 7:04 p.m.
Did you ever find an answer to this question? |
I'm convinced we'll never find a useful answer on this forum. Nearly a complete waste of time.
Comments
sam detweiler
commented Aug 02 '16, 9:12 a.m.
this is not a forum for programming help. many of the folks that contribute here, like me, do it because we can, and like to.. but we might not have direct experience with the exact scenario you are attempting.
Ralph Schoon
commented Aug 02 '16, 9:18 a.m.
| edited Aug 02 '16, 9:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You will not find an answer unless you follow my hints and set up your environment for debugging. If you want to do this you need development skills and you need to setup your environment as hinted. Otherwise you will stumble around and get nowhere. This is complex stuff and you can't just take it lightly. If you can't see the source and debug in your environment, again, follow https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ and get that working first.
Bryan Miller - Integration Developer
commented Aug 02 '16, 2:25 p.m.
Abraham, I empathize with your situation. Not a lot of developers frequent the forums so responses can be sporadic. I have seen excellent responses and dialog on occasion which have proven helpful. I recommend reading Ralph's page and a few of the other good web pages on development for RTC and the Jazz Platform in general.
Abraham Ayorinde
commented Aug 02 '16, 2:40 p.m.
Guys. Please don't mind me. I was simply frustrated and irritated. I'm swamped with 4 coding projects all in different languages, with this one being perhaps the most importance with the least amount of work to be able to do what I ultimately want to be able to do. You guys have been great. Thanks again.
Bryan Miller - Integration Developer
commented Aug 02 '16, 3:37 p.m.
:-) Completely understand.
|
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.