AnsweredAssumed Answered

Assign two resources with the same task ID

Question asked by marwahussein on Oct 4, 2015
Latest reply on Oct 5, 2015 by jbarrez
i am trying to map some events using esper and Activiti, my main goal at this time is to assign two resources to the same task
I created a class containingg all neccesary Information I need and I throw it to esper stream and from the main function I created a hash map and populate it with information to be sent to the stream. when I am trying to assign a resource it didn't respond until I add it to the hash map
this is the example I wrote

Map<String, Object> processVariables = new HashMap<String, Object>();
      processVariables.put("loanAmount", 10);
                processVariables.put("resource", "John");

      ProcessInstance pi = runtimeService.startProcessInstanceByKey("loanrequest_withespertest", processVariables);
      System.out.println("Process isntance id is "+pi.getId());

      // Evaluate first loan request
      processVariables.put("requestApproved", true);
                taskService.createTaskQuery().taskAssignee("John");//.singleResult(); // create and assign command
                taskService.setAssignee("11", "Atef");
      taskService.complete(taskService.createTaskQuery().singleResult().getId(), processVariables);

and here is the result:

>>> Throwing event: task  create  successfully: LoanRequestReceivedEvent{taskInstanceId= 11,receiveTime= 1443939476670,requestedAmount= 10,eventtype= create,resource= John}
event mapped successfully:  {receiveTime=1443939476670, requestedAmount=10, taskInstanceId=11, eventType=created}
Process isntance id is 4
>>> Throwing event: task  assignment  successfully: LoanRequestReceivedEvent{taskInstanceId= 11,receiveTime= 1443939477756,requestedAmount= 10,eventtype= assignment,resource= John}
event mapped successfully:  {receiveTime=1443939477756, requestedAmount=10, taskInstanceId=11, eventType=allocated}
>>> Throwing event: task  complete  successfully: LoanRequestReceivedEvent{taskInstanceId= 11,receiveTime= 1443939477896,requestedAmount= 10,eventtype= complete,resource= John}
event mapped successfully:  {receiveTime=1443939477896, requestedAmount=10, taskInstanceId=11, eventType=completed}

I need to know the difference between setAssignee and task assignee and how to detect that two resources are assigned to the same task