Activiti
  1. Activiti
  2. ACT-1080

Getting task variables for more then one task

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 5.8
    • Fix Version/s: Sooner
    • Component/s: Engine
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I need a method that allows to get task variables for more then one task. I propose to add the following methods in the TaskService interface:

      Map<String, Map<String, Object>> getVariables(Collection<String> taskIds, Collection<String> variableNames);
      Map<String, Map<String, Object>> getVariablesLocal(Collection<String> taskIds, Collection<String> variableNames);

      In our project we have a task list that has to display more then basic task data. In the current version of Activiti (5.8) we would have to find tasks by the TaskQuery and then retrieve variables for each task separately. I would like to retrieve variables for multiple tasks in a single call.

        Activity

        Hide
        Andrzej Dengusiak added a comment -

        Commited revision 3171 in "consdata" branch:
        https://fisheye.codehaus.org/changelog/activiti?cs=3171

        Tom, can you review the change and merge it to trunk?

        Show
        Andrzej Dengusiak added a comment - Commited revision 3171 in "consdata" branch: https://fisheye.codehaus.org/changelog/activiti?cs=3171 Tom, can you review the change and merge it to trunk?
        Hide
        Tom Baeyens added a comment -

        I don't see the point in adding these two methods.
        What is the problem with looping over the tasks and then getting the variables?

        Show
        Tom Baeyens added a comment - I don't see the point in adding these two methods. What is the problem with looping over the tasks and then getting the variables?
        Hide
        Andrzej Dengusiak added a comment -

        There's a performance problem (known as n+1 selects problem) when you have a list of e.g. 50 tasks on a page and want to display certain variables for each task.
        If you loop over tasks and get these variables via TaskService.getVariables(taskId,variableNames), then activiti makes 50 extra calls to database. In our solution you need only 1 extra database call to get variables for the whole task list.

        Show
        Andrzej Dengusiak added a comment - There's a performance problem (known as n+1 selects problem) when you have a list of e.g. 50 tasks on a page and want to display certain variables for each task. If you loop over tasks and get these variables via TaskService.getVariables(taskId,variableNames), then activiti makes 50 extra calls to database. In our solution you need only 1 extra database call to get variables for the whole task list.
        Hide
        Daniel Meyer (camunda) added a comment -

        If this is an issue in your project, I think this should be addressed in your own codebase.I don't think the usecase is that common (have not really seen it yet).

        Show
        Daniel Meyer (camunda) added a comment - If this is an issue in your project, I think this should be addressed in your own codebase.I don't think the usecase is that common (have not really seen it yet).
        Hide
        Bernd Ruecker (camunda) added a comment -

        I seen this some time, but I think it is hard to generalize on this basis. You could still add your own command in order to retrieve what you need in one database query.
        For a general solution it is a bit too specific and we should discuss all possible solutions to do this.

        Show
        Bernd Ruecker (camunda) added a comment - I seen this some time, but I think it is hard to generalize on this basis. You could still add your own command in order to retrieve what you need in one database query. For a general solution it is a bit too specific and we should discuss all possible solutions to do this.
        Hide
        Dawid Wrzosek added a comment -

        We have used three other workflow engines in 6 different projects and in each project we had to display some process variables for the whole task list. From our experience we can say that this is a much desired addition to tasks API.

        Show
        Dawid Wrzosek added a comment - We have used three other workflow engines in 6 different projects and in each project we had to display some process variables for the whole task list. From our experience we can say that this is a much desired addition to tasks API.
        Hide
        Daniel Meyer (camunda) added a comment -

        Unscheduling for 5.9

        Show
        Daniel Meyer (camunda) added a comment - Unscheduling for 5.9
        Hide
        Bernd Ruecker (camunda) added a comment -

        I am still in favor of not introducing this to the engine as public API. You can add it as own command, provide specific custom queries (https://app.camunda.com/confluence/display/foxUserGuide/Performance+Tuning+with+custom+Queries) and we think of SQL injection in the query API (ACT-1293), so I close this issue.

        Show
        Bernd Ruecker (camunda) added a comment - I am still in favor of not introducing this to the engine as public API. You can add it as own command, provide specific custom queries ( https://app.camunda.com/confluence/display/foxUserGuide/Performance+Tuning+with+custom+Queries ) and we think of SQL injection in the query API ( ACT-1293 ), so I close this issue.

          People

          • Assignee:
            Tom Baeyens
            Reporter:
            Jakub Wilczewski
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: