3 Replies Latest reply on Dec 8, 2006 11:49 PM by zhongboqing

    Get finished tasks

    Ansgar Thobe Newbie

      Hi!
      Is there a way to get a list of all tasks for an actor, both the finished and the unfinished?
      As far as i know, the unfinished tasks is no problem about the jbpmContext.getTaskList( ActorId )
      Is there an analog method for the finished tasks?

      Thank you!

        • 2. Re: Get finished tasks
          Chris OBrien Novice

          You can always just do a hibernate query against the DB

          • 3. Re: Get finished tasks
            zhongboqing Newbie

            1, you can add the query in the file "org\jbpm\db\hibernate.queries.hbm.xml" ,like

            <![CDATA[
            select ti
            from org.jbpm.taskmgmt.exe.TaskInstance as ti
            where ti.actorId = :actorId
            and ti.isOpen = true and ti.end is not null
            ]]>


            2, you can add the method findFinishedTaskInstances int the java file "org\jbpm\db\TaskMgmtSession.java"

            /**
            * get the finished tasllist for a given actor.
            */
            public List findFinishedTaskInstances(String actorId) {
            List result = null;
            try {
            Query query = session.getNamedQuery("TaskMgmtSession.findFinishedTaskInstancesByActorId");
            query.setString("actorId", actorId);
            result = query.list();
            } catch (Exception e) {
            log.error(e);
            jbpmSession.handleException();
            throw new JbpmException("couldn't get task instances list for actor '"+actorId+"'", e);
            }
            return result;
            }
            3, rebuild the jpdl