Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-8924

[Task Assignment] Bulk Delegation Operation

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Major
    • None
    • None
    • Runtime Engine
    • None
    • NEW
    • NEW

    Description

      The bulk delegation operation adds the ability of delegating a set of tasks at the same time additional information related to the tasks is stored/updated in DB. All the delegations and the additional information updates will be resolved transactionally.

      The PlanningTask is the task related information that needs to be updated by the bulk delegation, see attached screenshot.

      PlanningTask {
         private long taskId;
         private String assignedUser;
         private int index;
         private short published;
      }
      
      

      The simplified bulk delegation has the following example signature and semantic:

      BulkDelegationItem {
          private long taskId;
          private String targetUserId;
          private int index;
          private short published;	
      }
      
      bulkDelegate(String containerId, String userId, List<BulkDelegationItem> delegationItems);
      
      

      The semantic looks like this:

      BEGIN TRANSACTION
      	for (BulkDelegationItem item : delegationItems) {
      		delegate(containerId, userId, item.getTargetUserId());
      		saveOrUpdate(new PlanningTask(item.getTaskId(), 
                                                        item.getTargetUserId(), 
                                                        item.getIndex(), 
                                                        item.getPublished());                		
      	}
      COMMIT;
      
      

      However a more generic implementation is expected:

      BulkDelegationItem {
      	private long taskId;
      	private String targetUserId;	
      	/*
                Have the ability to pass a "command" that will be executed as part of the delegation for each item.
                This command has access to an object e.g. TaskInfo that let us know information about the task is about to be delegated. e.g: 
                    taskInfo.getActualOwner() //what's the current owner of the task that it's about to be delegated
                    taskInfo.getStatus()      //what's the current status of the task that it's about to be delegated, e.g. Ready, Reserved etc.		
                           
               And finally have access to the entity manager for doing the necessary updates in the PlanningTask.
                In this way the command can decide the necessary update or might even throw an  exception and make the bulk operation rollback if necessary.		
      	*/
      	ParametrizedCommand<{TaskInfo, EntityManager}> command; /* command executed as part of the delegation */
      }
      
      

      Finally the extended semantic looks like this:

      BEGIN TRANSACTION
      	for (BulkDelegationItem item : delegationItems) {
      		TaskInfo taskInfo = /* create the taskInfo for the task that is about to be delegated */	
      		EntityManager em =  /* get the reference to the EntityManager */
      		delegate(containerId, userId, item.getTargetUserId()); 
      		item.getCommand().execute(taskInfo, em); /* let the command do the necessary updates */
      	}
      COMMIT;  /* if any of the task delegations fails or the commands fails all the updates are rolledback */
      
      
      

      Attachments

        Activity

          People

            kverlaen@redhat.com Kris Verlaenen
            wmedvede@redhat.com Walter Medvedeo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: