2 Replies Latest reply on Jul 21, 2005 8:38 AM by kukeltje

    how to get ordered (by created date) task instances?

    kukeltje

      Download and look at the webui code, change it (extend it) and submit it to the project. :-)

      Ronald

        • 1. Re: how to get ordered (by created date) task instances?
          brittm

          The most direct way to get your tasks in order is in a TreeSet with a custom Comparator. Use code similar to the following in your JSP/Bean

          TreeSet tasks = new TreeSet(
           new Comparator() {
           public int compare(Object a, Object b) {
           TaskInstance ta = (TaskInstance)a;
           TaskInstance tb = (TaskInstance)b;
           java.util.Date startDateA = ta.getCreate();
           java.util.Date startDateB = tb.getCreate();
           return startDateA.compareTo(startDateB);
           }
           }
           );
          tasks.addAll(taskMgmtSession.findTaskInstances(actor));

          That's all there is to it.

          -Britt

          • 2. Re: how to get ordered (by created date) task instances?
            kukeltje

            Exactely.

            My reply to your other thread was:

            Then you make sure it is ALWAYS ordered by create date. Not everyone wants that. Sometimes you only want task for a certain state, or ordered by priority. I therefor think it should not be in solved by selecting it in the database but in the ui.