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