Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Query workitem subscriptions from java API

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):

com.ibm.team.repository.common.transport.ServiceMethodInvocationError: com.ibm.team.repository.common.query.QueryException: 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);
term.add(projectAreaExpression);
term.add(subscriptionExpression);

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.

Thanks,

Daan

0 votes


Be the first one to answer this question!

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Jan 02 '12, 9:41 a.m.

Question was seen: 3,848 times

Last updated: Jan 02 '12, 9:41 a.m.

Confirmation Cancel Confirm