It's all about the answers!

Ask a question

Query workitem subscriptions from java API

Daan van der Munnik (29113127) | asked Jan 02 '12, 9:41 a.m.
When I try to query workitems by the IWorkItem.SUBSCRIPTIONS_PROPERTY using the java API, an exception is thrown (when I start iterating over the results): Unknown queryable field: internalSubscriptions

My code looks as follows:

IContributor subscriber = teamRepository.contributorManager().fetchContributorByUserId("myuid", null);

if (subscriber == null)
throw new ItemNotFoundException("UserId not found");

IQueryableAttribute subscriptionAttribute = factory.findAttribute(projectArea, IWorkItem.SUBSCRIPTIONS_PROPERTY, auditableClient, null);
AttributeExpression subscriptionExpression = new AttributeExpression(subscriptionAttribute, AttributeOperation.CONTAINS, subscriber);

Term term= new Term(Operator.AND);

IQueryResult<IResolvedResult<IWorkItem>> result = queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);

while (result.hasNext(null))

When I omit the subscriptionExpression from the query it works fine. Using this result set (which is then of course much bigger) I can get the subscriptions from each workitem in the result set and do the filtering afterward, but this seems sub-optimal.



Be the first one to answer this question!

Register or to post your answer.