4 Replies Latest reply on Sep 14, 2011 6:40 AM by calca

    Accessing tasks via task variables in jbpm5

    imran.h

      Is there a way to 'query' tasks using their task variables?

       

      A somewhat related question is how to access a human task's variables once you get all the tasks for an owner. I can get all the task summaries and thus the tasks, but can't seem to find a way to access a tasks variables programmatically:

       

       

      Thanks again for your help.

        • 1. Re: Accessing tasks via task variables in jbpm5
          calca

          Hi Asad, just for curiosity.. why you would need to query tasks using variables? I don't know how you could make it, as task input and output seems to be serialized in Content table. You could query tasks by other criteria (from Task, TaskSummary, OrganizationalEntity) as it is done in orm.xml places in human tasks. You can just create an EntityManagerFactory like

          entityManagerFactory = Persistence.createEntityManagerFactory("org.drools.task")

          And then use the EntityManager to make queries.

           

          About getting access to task variables, as said before, they are serialized content. You can check here to see how to get the variables:

          http://dcalca.wordpress.com/2011/05/06/variables-in-jbpm5-human-tasks/

          http://dcalca.files.wordpress.com/2011/05/input.png

           

          Regards,

           

          Demian

          1 of 1 people found this helpful
          • 2. Re: Accessing tasks via task variables in jbpm5
            imran.h

            Thanks for your reply. I basically need it because I am not building my processes into jbpm from scratch, instead i am trying to incorporate it into an existing monolithic app. Since the Front end already exists, being able to query tasks based on their vraiables would allow me to make an incremental change and use the same UI to fetch certian types of tasks.

            From you comment about all that being serialized it seems, I might need to just do this in filtering in the app itself. Hopefully scale wont be an issue.

            • 3. Re: Accessing tasks via task variables in jbpm5
              heathcliff

              I agree that variables should be stored not as serialized data but in some tabels... some time ie you would like to see all the processes which have some variable set to specific value.

              • 4. Re: Accessing tasks via task variables in jbpm5
                calca

                Well, in the case of processes you can use the audit data (jbpm-bam), which will record nodes, variables and objects (as strings). And it also could be extended to fit your needs.

                 

                Demian