Java Code Examples for org.camunda.bpm.engine.TaskService#setAssignee()

The following examples show how to use org.camunda.bpm.engine.TaskService#setAssignee() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetAssigneeProcessInstanceTaskScenario.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@DescribesScenario("createUserOperationLogEntries")
public static ScenarioSetup createUserOperationLogEntries() {
  return new ScenarioSetup() {
    public void execute(ProcessEngine engine, String scenarioName) {
      IdentityService identityService = engine.getIdentityService();
      String processInstanceBusinessKey = "SetAssigneeProcessInstanceTaskScenario";
      engine.getRuntimeService().startProcessInstanceByKey("oneTaskProcess_userOpLog", processInstanceBusinessKey);

      identityService.setAuthentication("mary02", null);

      TaskService taskService = engine.getTaskService();
      List<Task> list = taskService.createTaskQuery().processInstanceBusinessKey(processInstanceBusinessKey).list();
      Task task = list.get(0);
      taskService.setAssignee(task.getId(), "john");

      identityService.clearAuthentication();
    }
  };
}
 
Example 2
Source File: HistoricInstancePermissionsWithoutProcDefKeyScenario.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@DescribesScenario("createProcInstancesAndOpLogs")
public static ScenarioSetup createProcInstancesAndOpLogs() {
  return (engine, scenarioName) -> {
    IdentityService identityService = engine.getIdentityService();
    for (int i = 0; i < 5; i++) {
      String processInstanceId = engine.getRuntimeService()
          .startProcessInstanceByKey("oneTaskProcess",
              "HistPermsWithoutProcDefKeyScenarioBusinessKey" + i)
          .getId();

      identityService.setAuthentication("mary02", null);

      TaskService taskService = engine.getTaskService();

      String taskId = taskService.createTaskQuery()
          .processInstanceId(processInstanceId)
          .singleResult()
          .getId();

      taskService.setAssignee(taskId, "john");

      identityService.clearAuthentication();
    }
  };
}
 
Example 3
Source File: TaskResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setAssignee(UserIdDto dto) {
  TaskService taskService = engine.getTaskService();
  taskService.setAssignee(taskId, dto.getUserId());
}