8 Replies Latest reply on Feb 24, 2007 6:56 AM by Ronald van Kuijk

    Finding tasks efficiently using ContextInstance?

    John Unwin Newbie

      The TaskMgmtSession class has several methods for finding tasks belonging to "actors" - either individual actors or many at a time.

      BUT... is there a way to efficiently find tasks using the values in context variables?

      Let me elaborate... I have tasks assigned to users. Each task relates to a Customer (a POJO persistable by Hibernate). I store Customer objects in the ContextInstance associated with each ProcessInstance. jBPM persists my Customer objects and I can examine them later when I retrieve the tasks. So far so good.

      Now... I want to list all active tasks, in any process, for a specific customer (e.g. custNumb = 123). Is there an efficient way?

      The seemingly inefficient way is to retrieve all active processes, retrieve the ContextInstance, retrieve the variable named "customer" and examine the context to see if the Customer.custNumb == 123.

      Thanks
      John