4 Replies Latest reply on Oct 29, 2013 10:44 PM by quangtin3

    getTasksAssignedAsPotentialOwnerByStatus fails when User has no groups

    jhrobbin Newbie



      I wasn't sure if I should create a JIRA issue for this or if perhaps I'm simply doing something wrong.



      We are using 5.4 snapshot and after a recent update we are now getting exceptions in SyncTaskServiceWrapper.getTasksAssignedAsPotentialOwnerByStatus when the User is not a member of any groups.



      We have implemented theUserGroupCallback interface for use with our own implementation for user and group management.  We have some users who are not a member of any groups.  For those users, UserGroupCallback.getGroupsForUser will return empty list.


      However, even though there are no groupIds, TaskServiceSession.getTasksAssignedAsPotentialOwnerByStatus still runs the named query "TasksAssignedAsPotentialOwnerByStatusWithGroups" and supplies an empty list parm to the query. 


      When the query is run with an empty list it fails with the following exception:

      Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from org.jbpm.task.Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, org.jbpm.task.OrganizationalEntity potentialOwners where t.archived = 0 and ( potentialOwners.id = :userId or potentialOwners.id in () ) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in (:status0_, :status1_, :status2_, :status3_) and t.taskData.expirationTime is null]


      Please advise.