org.camunda.bpm.engine.task.Task.setAssignee()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(258)

本文整理了Java中org.camunda.bpm.engine.task.Task.setAssignee()方法的一些代码示例,展示了Task.setAssignee()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.setAssignee()方法的具体详情如下:
包路径:org.camunda.bpm.engine.task.Task
类名称:Task
方法名:setAssignee

Task.setAssignee介绍

[英]The User#getId() of the person to which this task is TaskService#setAssignee(String,String) or TaskService#delegateTask(String,String).
[中]将此任务作为TaskService#SetAssignment(字符串,字符串)或TaskService#delegateTask(字符串,字符串)的用户#getId()。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

public void createTaskAndAssignUser(String taskId) {
 Task task = taskService.newTask(taskId);
 task.setAssignee("demo");
 taskService.saveTask(task);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void updateTaskWithAuthenticatedTenant() {
 
 identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
 task.setAssignee("aUser");
 taskService.saveTask(task);
 
 // then
 assertThat(taskService.createTaskQuery().taskAssignee("aUser").count(), is(1L));
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testStandaloneTaskSaveWithGenericResourceIdAssignee() {
 createGrantAuthorization(TASK, ANY, userId, CREATE);
 Task task = taskService.newTask();
 task.setAssignee("*");
 try {
  taskService.saveTask(task);
  fail("it should not be possible to save a task with the generic resource id *");
 } catch (ProcessEngineException e) {
  assertTextPresent("Cannot create default authorization for assignee *: "
    + "id cannot be *. * is a reserved identifier", e.getMessage());
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void updateTaskWithNoAuthenticatedTenant() {
 
 task.setAssignee("aUser");
 identityService.setAuthentication("aUserId", null);
 
 // then
 thrown.expect(ProcessEngineException.class);
 thrown.expectMessage("Cannot assign the task '"
  + task.getId() +"' because it belongs to no authenticated tenant.");
 taskService.saveTask(task);
 
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void updateTaskWithDisabledTenantCheck() {
 
 task.setAssignee("aUser");
 identityService.setAuthentication("aUserId", null);
 engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
 
 // then
 taskService.saveTask(task);
 assertThat(taskService.createTaskQuery().taskAssignee("aUser").count(), is(1L));
 
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testConcurrentTaskChange() {
 // create a task
 task = taskService.newTask();
 taskService.saveTask(task);
 // change the bean property
 task.setAssignee("icke");
 // use the service method to do an other assignment
 taskService.setAssignee(task.getId(), "er");
 try { // now try to save the task and overwrite the change
  taskService.saveTask(task);
 } catch (Exception e) {
  assertNotNull(e); // concurrent modification
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveCaseTaskUpdate() {
 // given
 createCaseInstanceByKey(CASE_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testAssigneeLink() {
 Task task = taskService.newTask("task");
 task.setAssignee("assignee");
 taskService.saveTask(task);
 List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.getId());
 assertNotNull(identityLinks);
 assertEquals(1, identityLinks.size());
 IdentityLink identityLink = identityLinks.get(0);
 assertEquals(IdentityLinkType.ASSIGNEE, identityLink.getType());
 assertEquals("assignee", identityLink.getUserId());
 assertEquals("task", identityLink.getTaskId());
 taskService.deleteTask(task.getId(), true);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testAssignSameAssigneeAndOwnerToTask() {
 // given
 createGrantAuthorization(Resources.TASK, Authorization.ANY, userId, Permissions.ALL);
 // when
 Task newTask = taskService.newTask();
 newTask.setAssignee("Horst");
 newTask.setOwner("Horst");
 // then
 try {
  taskService.saveTask(newTask);
 } catch (Exception e) {
  fail("Setting same assignee and owner to user should not fail!");
 }
 taskService.deleteTask(newTask.getId(), true);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveProcessTaskUpdateWithTaskAssignPermissionOnAnyTask() {
 // given
 startProcessInstanceByKey(PROCESS_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(TASK, ANY, userId, TASK_ASSIGN);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveProcessTaskUpdateWithUpdateTasksPermissionOnProcessDefinition() {
 // given
 startProcessInstanceByKey(PROCESS_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_TASK);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveProcessTaskUpdateWithTaskAssignPermissionOnProcessDefinition() {
 // given
 startProcessInstanceByKey(PROCESS_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, TASK_ASSIGN);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveProcessTaskUpdateWithUpdatePermissionOnAnyTask() {
 // given
 startProcessInstanceByKey(PROCESS_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(TASK, ANY, userId, UPDATE);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveProcessTaskUpdateWithUpdatePermissionOnTask() {
 // given
 startProcessInstanceByKey(PROCESS_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(TASK, task.getId(), userId, UPDATE);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveProcessTaskUpdateWithTaskAssignPermissionOnTask() {
 // given
 startProcessInstanceByKey(PROCESS_KEY);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(TASK, task.getId(), userId, TASK_ASSIGN);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testQueryForStandaloneTaskHistoricIdentityLinkWithoutAuthrorization() {
 // given
 disableAuthorization();
 Task taskAssignee = taskService.newTask("newTask");
 taskAssignee.setAssignee("aUserId");
 taskService.saveTask(taskAssignee);
 enableAuthorization();
 // when
 HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
 // then
 verifyQueryResults(query, 1);
 disableAuthorization();
 taskService.deleteTask("newTask", true);
 enableAuthorization();
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testTaskAssignee() {
 Task task = taskService.newTask();
 task.setAssignee("johndoe");
 taskService.saveTask(task);
 // Fetch the task again and update
 task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
 assertEquals("johndoe", task.getAssignee());
 task.setAssignee("joesmoe");
 taskService.saveTask(task);
 task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
 assertEquals("joesmoe", task.getAssignee());
 // Finally, delete task
 taskService.deleteTask(task.getId(), true);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testSaveStandaloneTaskUpdate() {
 // given
 String taskId = "myTask";
 createTask(taskId);
 Task task = selectSingleTask();
 task.setAssignee("demo");
 createGrantAuthorization(TASK, taskId, userId, UPDATE);
 // when
 taskService.saveTask(task);
 // then
 task = selectSingleTask();
 assertNotNull(task);
 assertEquals("demo", task.getAssignee());
 deleteTask(taskId, true);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testDeleteAssignee() {
 Task task = taskService.newTask();
 task.setAssignee("nonExistingUser");
 taskService.saveTask(task);
 taskService.deleteUserIdentityLink(task.getId(), "nonExistingUser", IdentityLinkType.ASSIGNEE);
 task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
 assertNull(task.getAssignee());
 assertEquals(0, taskService.getIdentityLinksForTask(task.getId()).size());
 // cleanup
 taskService.deleteTask(task.getId(), true);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceProperties.bpmn20.xml"})
public void testAssigneeSavedWhenTaskSaved() {
 // given
 HistoricActivityInstanceQuery query = historyService
   .createHistoricActivityInstanceQuery()
   .activityId("theTask");
 runtimeService.startProcessInstanceByKey("taskAssigneeProcess");
 HistoricActivityInstance historicActivityInstance = query.singleResult();
 Task task = taskService.createTaskQuery().singleResult();
 // assume
 assertEquals("kermit", historicActivityInstance.getAssignee());
 // when
 task.setAssignee("gonzo");
 taskService.saveTask(task);
 // then
 historicActivityInstance = query.singleResult();
 assertEquals("gonzo", historicActivityInstance.getAssignee());
}

相关文章