4 Replies Latest reply on Sep 12, 2013 5:08 AM by Thomas Colditz

    query usertasks without having parameters

    Thomas Colditz Newbie

      Hi all,

       

      I've got a question about TaskService. Is it possible to ge t a List of all 'active' Tasks even if I dont know the "Assignee" nor anything else. I just want to get the whole list and then decide how to go on. Its no big problem if it doesnt work, I just would like to know if there is a way to get it.

      Thanks for helping!


      Greeting,

      Tom

        • 1. Re: query usertasks without having parameters
          Mauricio Salatino Master

          I think that you can use the admin user for that.. meaning to get all the Tasks where the admin is the administrator should retrieve all the tasks

          • 2. Re: query usertasks without having parameters
            Thomas Colditz Newbie

            Thank you for reply.

            Is the administrator always related to usertasks? I usually dont load the user.properties in my embedded app. Do I have to load it to get this work?

            • 3. Re: query usertasks without having parameters
              Kris Verlaenen Master

              Yes, by default we always assign an Adminstrator user to a task created by a process.  The users.properties file is only used for authentication in the web applications, you don't need that if you access the task service embedded.

              • 4. Re: Re: query usertasks without having parameters
                Thomas Colditz Newbie

                Hi Kris,

                 

                since it doesnt work for me, what am I still doing wrong? The following code:

                List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Administrator", "en-UK");
                
                

                let me get this:

                 

                0    12/09 10:57:09,227[AWT-EventQueue-0] ERROR internal.ast.ErrorCounter.reportError  - <AST>:0:0: unexpected end of subtree
                0    12/09 10:57:09,227[AWT-EventQueue-0] ERROR internal.ast.ErrorCounter.reportError  - <AST>:0:0: unexpected end of subtree

                <AST>:0:0: unexpected end of subtree

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3185)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:706)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:562)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4515)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4417)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4086)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1947)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1900)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1875)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1872)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1872)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1872)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1872)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1872)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:794)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:595)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299)

                    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247)

                    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248)

                    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)

                    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)

                    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)

                    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)

                    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)

                    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:219)

                    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1240)

                    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)

                    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:257)

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParameters(JbpmServicesPersistenceManagerImpl.java:447)

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParametersInTransaction(JbpmServicesPersistenceManagerImpl.java:396)

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParametersInTransaction(JbpmServicesPersistenceManagerImpl.java:414)

                    at org.jbpm.services.task.impl.TaskQueryServiceImpl.getTasksAssignedAsPotentialOwner(TaskQueryServiceImpl.java:75)

                    at org.jbpm.services.task.identity.UserGroupTaskQueryServiceDecorator.getTasksAssignedAsPotentialOwner(UserGroupTaskQueryServiceDecorator.java:46)

                    at org.jbpm.services.task.impl.TaskServiceEntryPointImpl.getTasksAssignedAsPotentialOwner(TaskServiceEntryPointImpl.java:320)

                    at org.jbpm.runtime.manager.impl.task.SynchronizedTaskService.getTasksAssignedAsPotentialOwner(SynchronizedTaskService.java:309)

                    at applicationSetup.Model.queryTasks(Model.java:278)

                    at applicationSetup.Controller.queryTasks(Controller.java:79)

                    at applicationSetup.Controller.fillTaskComboBox(Controller.java:56)

                    at applicationSetup.Controller.access$19(Controller.java:56)

                    at applicationSetup.Controller$ButtonActionListener.actionPerformed(Controller.java:188)

                    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

                    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

                    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

                    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

                    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

                    at java.awt.Component.processMouseEvent(Unknown Source)

                    at javax.swing.JComponent.processMouseEvent(Unknown Source)

                    at java.awt.Component.processEvent(Unknown Source)

                    at java.awt.Container.processEvent(Unknown Source)

                    at java.awt.Component.dispatchEventImpl(Unknown Source)

                    at java.awt.Container.dispatchEventImpl(Unknown Source)

                    at java.awt.Component.dispatchEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

                    at java.awt.Container.dispatchEventImpl(Unknown Source)

                    at java.awt.Window.dispatchEventImpl(Unknown Source)

                    at java.awt.Component.dispatchEvent(Unknown Source)

                    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

                    at java.awt.EventQueue.access$000(Unknown Source)

                    at java.awt.EventQueue$3.run(Unknown Source)

                    at java.awt.EventQueue$3.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.awt.EventQueue$4.run(Unknown Source)

                    at java.awt.EventQueue$4.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.awt.EventQueue.dispatchEvent(Unknown Source)

                    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                    at java.awt.EventDispatchThread.run(Unknown Source)

                Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Operation failed

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParametersInTransaction(JbpmServicesPersistenceManagerImpl.java:407)

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParametersInTransaction(JbpmServicesPersistenceManagerImpl.java:414)

                    at org.jbpm.services.task.impl.TaskQueryServiceImpl.getTasksAssignedAsPotentialOwner(TaskQueryServiceImpl.java:75)

                    at org.jbpm.services.task.identity.UserGroupTaskQueryServiceDecorator.getTasksAssignedAsPotentialOwner(UserGroupTaskQueryServiceDecorator.java:46)

                    at org.jbpm.services.task.impl.TaskServiceEntryPointImpl.getTasksAssignedAsPotentialOwner(TaskServiceEntryPointImpl.java:320)

                    at org.jbpm.runtime.manager.impl.task.SynchronizedTaskService.getTasksAssignedAsPotentialOwner(SynchronizedTaskService.java:309)

                    at applicationSetup.Model.queryTasks(Model.java:278)

                    at applicationSetup.Controller.queryTasks(Controller.java:79)

                    at applicationSetup.Controller.fillTaskComboBox(Controller.java:56)

                    at applicationSetup.Controller.access$19(Controller.java:56)

                    at applicationSetup.Controller$ButtonActionListener.actionPerformed(Controller.java:188)

                    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

                    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

                    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

                    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

                    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

                    at java.awt.Component.processMouseEvent(Unknown Source)

                    at javax.swing.JComponent.processMouseEvent(Unknown Source)

                    at java.awt.Component.processEvent(Unknown Source)

                    at java.awt.Container.processEvent(Unknown Source)

                    at java.awt.Component.dispatchEventImpl(Unknown Source)

                    at java.awt.Container.dispatchEventImpl(Unknown Source)

                    at java.awt.Component.dispatchEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

                    at java.awt.Container.dispatchEventImpl(Unknown Source)

                    at java.awt.Window.dispatchEventImpl(Unknown Source)

                    at java.awt.Component.dispatchEvent(Unknown Source)

                    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

                    at java.awt.EventQueue.access$000(Unknown Source)

                    at java.awt.EventQueue$3.run(Unknown Source)

                    at java.awt.EventQueue$3.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.awt.EventQueue$4.run(Unknown Source)

                    at java.awt.EventQueue$4.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.awt.EventQueue.dispatchEvent(Unknown Source)

                    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                    at java.awt.EventDispatchThread.run(Unknown Source)

                Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select new org.jbpm.services.task.query.TaskSummaryImpl( 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, t.subTaskStrategy, t.taskData.parentId ) from org.jbpm.services.task.impl.model.TaskImpl 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.services.task.impl.model.OrganizationalEntityImpl 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 ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') group by t.id]

                    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1364)

                    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1300)

                    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:266)

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParameters(JbpmServicesPersistenceManagerImpl.java:447)

                    at org.jbpm.shared.services.impl.JbpmServicesPersistenceManagerImpl.queryWithParametersInTransaction(JbpmServicesPersistenceManagerImpl.java:396)

                    ... 46 more

                Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select new org.jbpm.services.task.query.TaskSummaryImpl( 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, t.subTaskStrategy, t.taskData.parentId ) from org.jbpm.services.task.impl.model.TaskImpl 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.services.task.impl.model.OrganizationalEntityImpl 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 ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') group by t.id]

                    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)

                    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)

                    at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79)

                    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:255)

                    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)

                    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)

                    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)

                    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)

                    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)

                    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:219)

                    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1240)

                    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)

                    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:257)

                    ... 48 more

                 

                What does the "unexpected end of subtree" mean? Can u please help me?

                 

                Greetings

                Tom