2 Replies Latest reply on May 3, 2013 8:53 AM by nofranksuk

    Best practices for building custom tasklist queries

    nofranksuk

      Hi All,

       

      I'm currently evaluating Jbpm 5.4 for my company and am creating a non-trivial prototype. I have the task service started in a servlet to which the task client connects over hornetq.

       

      I need to be able to display a list of "current" group tasks to a user per process type, so filtered on process id. I can see how the built-in task list queries are executed via the Command object in the TaskClient and how these relate to the queries specified in the Taskorm-JPA2.xml packaged with the TaskService. What I'm unclear on is the best way to go about including my own queries to construct task lists.

       

      I note the query method on the task client has been deprecated though this seems like the best option I have. Ideally I would extend the TaskClient class and provide my own methods working in the same way as the existing ones. Has this functionality been replaced by something else? Another way I can think of implementing it is via remote calls  to the task server via ejb3 or web services that utilise the task persistence context but this doesn't seem like a good solution. Any advice would be greatly appreciated.

       

       

      Olly Edgell

        • 1. Re: Best practices for building custom tasklist queries
          salaboy21

          This sounds as a good approach: "Ideally I would extend the TaskClient class and provide my own methods working in the same way as the existing ones. "

          The query method was deprecated, because "it allows you to do any query on the database and can be harmful from the security point of view". I'm not completely agree with that Deprecation, but this is how it is right now.

          Let us know how it goes with the extension.

          1 of 1 people found this helpful
          • 2. Re: Best practices for building custom tasklist queries
            nofranksuk

            Hi, I extended the TaskClient class. It was straight forward enough. Anyone using the class would just see a few extra task list methods, the only real different to them is the use of a QueryGenericResponseHandler instead of a BlockingTaskResponseHandler.

             

            I am agreement with you that this method should not be deprecated if it's functionality hasn't been replaced in some way. Incidentally, when I was writing and testing the queries I did receive an exception informing me that only Select statements were supported so perhaps this protection is now built in. It was actually caused by some line breaks in the query string as apposed to me trying to do any writing to the task tables!