本文整理了Java中org.camunda.bpm.engine.TaskService.saveTask()
方法的一些代码示例,展示了TaskService.saveTask()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TaskService.saveTask()
方法的具体详情如下:
包路径:org.camunda.bpm.engine.TaskService
类名称:TaskService
方法名:saveTask
[英]Saves the given task to the persistent data store. If the task is already present in the persistent store, it is updated. After a new task has been saved, the task instance passed into this method is updated with the id of the newly created task.
[中]将给定任务保存到持久数据存储。如果任务已存在于持久存储中,则会对其进行更新。保存新任务后,传递到此方法的任务实例将用新创建的任务的id更新。
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public void execute(ProcessEngine processEngine, String s) {
TaskEntity task = TaskEntity.create();
task.setName(TASK_NAME);
task.setCreateTime(TIMESTAMP);
processEngine.getTaskService().saveTask(task);
}
};
代码示例来源:origin: camunda/camunda-bpm-platform
public void updateTask(TaskDto taskDto) {
TaskService taskService = engine.getTaskService();
Task task = getTaskById(taskId);
if (task == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "No matching task with id " + taskId);
}
taskDto.updateTask(task);
taskService.saveTask(task);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public void setUp() throws Exception {
task = taskService.newTask();
taskService.saveTask(task);
super.setUp();
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testCreateTask() {
// when
Task task = taskService.newTask("a-task-id");
taskService.saveTask(task);
// then
verifyNoUserOperationLogged();
taskService.deleteTask("a-task-id", true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected void createTask(String groupId, String tenantId) {
Task task = taskService.newTask();
task.setTenantId(tenantId);
taskService.saveTask(task);
if (groupId != null) {
taskService.addCandidateGroup(task.getId(), groupId);
}
tasks.add(task.getId());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testSaveTaskInsertWithoutAuthorization() {
// given
TaskEntity task = TaskEntity.create();
try {
// when
taskService.saveTask(task);
fail("Exception expected: It should not be possible to save a task.");
} catch (AuthorizationException e) {
// then
assertTextPresent("The user with id 'test' does not have 'CREATE' permission on resource 'Task'", e.getMessage());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void setUp() {
task = (TaskEntity) taskService.newTask();
taskService.saveTask(task);
expressionManager = processEngineConfiguration
.getExpressionManager();
taskDefinition = new TaskDefinition(null);
taskDecorator = new TaskDecorator(taskDefinition, expressionManager);
}
代码示例来源: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 testSaveTaskWithGenericResourceId() {
Task task = taskService.newTask("*");
try {
taskService.saveTask(task);
fail("it should not be possible to save a task with the generic resource id *");
} catch (ProcessEngineException e) {
assertTextPresent("Entity Task[*] has an invalid id: id cannot be *. * is a reserved identifier", e.getMessage());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testSaveTaskWithNonExistingParentTask() {
// given
Task task = taskService.newTask();
// when
task.setParentTaskId("non-existing");
// then
try {
taskService.saveTask(task);
fail("It should not be possible to save a task with a non existing parent task.");
} catch (NotValidException e) {}
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testSaveTaskNullTask() {
try {
taskService.saveTask(null);
fail("ProcessEngineException expected");
} catch (ProcessEngineException ae) {
testRule.assertTextPresent("task is null", ae.getMessage());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testUserTaskOptimisticLocking() {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
thrown.expect(OptimisticLockingException.class);
Task task1 = taskService.createTaskQuery().singleResult();
Task task2 = taskService.createTaskQuery().singleResult();
task1.setDescription("test description one");
taskService.saveTask(task1);
task2.setDescription("test description two");
taskService.saveTask(task2);
}
代码示例来源: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 saveTaskWithAuthenticatedTenant() {
task = taskService.newTask("newTask");
task.setTenantId(TENANT_ONE);
identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
taskService.saveTask(task);
// then
assertThat(taskService.createTaskQuery().taskId(task.getId()).count(), is(1L));
taskService.deleteTask(task.getId(), true);
}
代码示例来源: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
@Deployment(resources = PROCESS_PATH)
public void testUpdateTask() {
// given
runtimeService.startProcessInstanceByKey(PROCESS_KEY);
Task task = taskService.createTaskQuery().singleResult();
task.setCaseInstanceId("a-case-instance-id");
// when
taskService.saveTask(task);
// then
verifyNoUserOperationLogged();
}
代码示例来源: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 testStandaloneTaskVariables() {
Task task = taskService.newTask();
task.setName("gonzoTask");
taskService.saveTask(task);
String taskId = task.getId();
taskService.setVariable(taskId, "instrument", "trumpet");
assertEquals("trumpet", taskService.getVariable(taskId, "instrument"));
taskService.deleteTask(taskId, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void saveTaskWithDisabledTenantCheck() {
task = taskService.newTask("newTask");
task.setTenantId(TENANT_ONE);
identityService.setAuthentication("aUserId", null);
engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
taskService.saveTask(task);
// then
assertThat(taskService.createTaskQuery().taskId(task.getId()).count(), is(1L));
taskService.deleteTask(task.getId(), true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testErrorMessage() {
Task newTask = taskService.newTask();
taskService.saveTask(newTask);
String variableName = "failingSerializable";
taskService.setVariable(newTask.getId(), variableName, new FailingSerializable());
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery()
.variableName(variableName)
.singleResult();
assertNull(variableInstance.getValue());
assertNotNull(variableInstance.getErrorMessage());
taskService.deleteTask(newTask.getId(), true);
}
内容来源于网络,如有侵权,请联系作者删除!