Java Code Examples for org.flowable.engine.HistoryService#createHistoricTaskLogEntryBuilder()
The following examples show how to use
org.flowable.engine.HistoryService#createHistoricTaskLogEntryBuilder() .
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: HistoryServiceTaskLogTest.java From flowable-engine with Apache License 2.0 | 6 votes |
@Test public void createCustomTaskEventLog_taskIdIsEnoughToCreateTaskLogEntry(TaskService taskService, HistoryService historyService, ProcessEngineConfiguration processEngineConfiguration) { task = taskService.createTaskBuilder().create(); HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(task); historicTaskLogEntryBuilder.create(); if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) { List<HistoricTaskLogEntry> logEntries = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list(); assertThat(logEntries).hasSize(2); HistoricTaskLogEntry historicTaskLogEntry = logEntries.get(1); assertThat(historicTaskLogEntry.getLogNumber()).isNotNull(); assertThat(historicTaskLogEntry.getUserId()).isNull(); assertThat(historicTaskLogEntry.getTaskId()).isEqualTo(task.getId()); assertThat(historicTaskLogEntry.getType()).isNull(); assertThat(historicTaskLogEntry.getTimeStamp()).isNotNull(); assertThat(historicTaskLogEntry.getData()).isNull(); } }
Example 2
Source File: HistoryServiceTaskLogTest.java From flowable-engine with Apache License 2.0 | 6 votes |
@Test public void createCustomTaskEventLog_withoutTimeStamp_addsDefault(TaskService taskService, HistoryService historyService, ProcessEngineConfiguration processEngineConfiguration) { task = taskService.createTaskBuilder().create(); HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(task); historicTaskLogEntryBuilder.userId("testUser"); historicTaskLogEntryBuilder.type("customType"); historicTaskLogEntryBuilder.data("testData"); historicTaskLogEntryBuilder.create(); if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) { List<HistoricTaskLogEntry> logEntries = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list(); assertThat(logEntries).hasSize(2); HistoricTaskLogEntry historicTaskLogEntry = logEntries.get(1); assertThat(historicTaskLogEntry.getLogNumber()).isNotNull(); assertThat(historicTaskLogEntry.getTimeStamp()).isNotNull(); } }
Example 3
Source File: HistoryServiceTaskLogTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void createCustomTaskEventLog(TaskService taskService, HistoryService historyService, ManagementService managementService, ProcessEngineConfiguration processEngineConfiguration) { task = taskService.createTaskBuilder().create(); Date todayDate = new Date(); HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(task); historicTaskLogEntryBuilder.timeStamp(todayDate); historicTaskLogEntryBuilder.userId("testUser"); historicTaskLogEntryBuilder.type("customType"); historicTaskLogEntryBuilder.data("testData"); historicTaskLogEntryBuilder.create(); if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) { List<HistoricTaskLogEntry> logEntries = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list(); assertThat(logEntries).hasSize(2); logEntries = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).type("customType").list(); assertThat(logEntries).hasSize(1); HistoricTaskLogEntry historicTaskLogEntry = logEntries.get(0); assertThat(historicTaskLogEntry.getLogNumber()).isNotNull(); assertThat(historicTaskLogEntry.getUserId()).isEqualTo("testUser"); assertThat(historicTaskLogEntry.getTaskId()).isEqualTo(task.getId()); assertThat(historicTaskLogEntry.getType()).isEqualTo("customType"); assertThat(simpleDateFormat.format(historicTaskLogEntry.getTimeStamp())).isEqualTo(simpleDateFormat.format(todayDate)); assertThat(historicTaskLogEntry.getData()).isEqualTo("testData"); historyService.deleteHistoricTaskLogEntry(historicTaskLogEntry.getLogNumber()); } }
Example 4
Source File: HistoryServiceTaskLogTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void queryForTaskLogEntriesByLogNumber(TaskService taskService, HistoryService historyService, ManagementService managementService, ProcessEngineConfiguration processEngineConfiguration) { task = taskService.createTaskBuilder(). assignee("testAssignee"). create(); Task anotherTask = taskService.createTaskBuilder().create(); try { if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) { HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(); historicTaskLogEntryBuilder.taskId(task.getId()).create(); historicTaskLogEntryBuilder.taskId(task.getId()).create(); historicTaskLogEntryBuilder.taskId(task.getId()).create(); HistoryTestHelper.waitForJobExecutorToProcessAllHistoryJobs(processEngineConfiguration, managementService, 10000, 200); List<HistoricTaskLogEntry> allLogEntries = historyService.createHistoricTaskLogEntryQuery().list(); HistoricTaskLogEntryQuery historicTaskLogEntryQuery = historyService.createHistoricTaskLogEntryQuery(). fromLogNumber(allLogEntries.get(1).getLogNumber()). toLogNumber(allLogEntries.get(allLogEntries.size() - 2).getLogNumber()); List<HistoricTaskLogEntry> logEntries = historicTaskLogEntryQuery. list(); assertThat(logEntries).hasSize(3); assertThat(logEntries).extracting(HistoricTaskLogEntry::getLogNumber).containsExactly( allLogEntries.get(1).getLogNumber(), allLogEntries.get(2).getLogNumber(), allLogEntries.get(3).getLogNumber() ); assertThat(historicTaskLogEntryQuery.count()).isEqualTo(3l); List<HistoricTaskLogEntry> pagedLogEntries = historicTaskLogEntryQuery.listPage(1, 1); assertThat(pagedLogEntries).hasSize(1); assertThat(pagedLogEntries.get(0).getLogNumber()).isEqualTo(logEntries.get(1).getLogNumber()); } } finally { deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, anotherTask.getId()); } }
Example 5
Source File: HistoryServiceTaskLogTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void queryForTaskLogEntriesByNativeQuery(TaskService taskService, HistoryService historyService, ManagementService managementService, ProcessEngineConfiguration processEngineConfiguration) { assertThat(managementService.getTableName(HistoricTaskLogEntryEntity.class, false)).isEqualTo("ACT_HI_TSK_LOG"); assertThat(managementService.getTableName(HistoricTaskLogEntry.class, false)).isEqualTo("ACT_HI_TSK_LOG"); HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(); historicTaskLogEntryBuilder.taskId("1").create(); historicTaskLogEntryBuilder.taskId("2").create(); historicTaskLogEntryBuilder.taskId("3").create(); if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) { try { assertThat(historyService.createNativeHistoricTaskLogEntryQuery() .sql("SELECT * FROM " + managementService.getTableName(HistoricTaskLogEntry.class)).list()).hasSize(3); assertThat(historyService.createNativeHistoricTaskLogEntryQuery() .sql("SELECT count(*) FROM " + managementService.getTableName(HistoricTaskLogEntry.class)).count()).isEqualTo(3); assertThat(historyService.createNativeHistoricTaskLogEntryQuery().parameter("taskId", "1"). sql("SELECT count(*) FROM " + managementService.getTableName(HistoricTaskLogEntry.class) + " WHERE TASK_ID_ = #{taskId}").list()) .hasSize(1); assertThat(historyService.createNativeHistoricTaskLogEntryQuery().parameter("taskId", "1"). sql("SELECT count(*) FROM " + managementService.getTableName(HistoricTaskLogEntry.class) + " WHERE TASK_ID_ = #{taskId}").count()) .isEqualTo(1); } finally { deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, "1"); deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, "2"); deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, "3"); } } }
Example 6
Source File: HistoryServiceTaskLogTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void queryForTaskLogOrderBy(TaskService taskService, HistoryService historyService, ManagementService managementService, ProcessEngineConfiguration processEngineConfiguration) { HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(); historicTaskLogEntryBuilder.taskId("1").timeStamp(getInsertDate()).create(); historicTaskLogEntryBuilder.taskId("2").timeStamp(getCompareAfterDate()).create(); historicTaskLogEntryBuilder.taskId("3").timeStamp(getCompareBeforeDate()).create(); try { if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) { List<HistoricTaskLogEntry> taskLogEntries = historyService.createHistoricTaskLogEntryQuery().list(); assertThat(taskLogEntries).extracting(taskLogEntry -> taskLogEntry.getTaskId()).containsExactly("1", "2", "3"); taskLogEntries = historyService.createHistoricTaskLogEntryQuery().orderByLogNumber().desc().list(); assertThat(taskLogEntries).extracting(taskLogEntry -> taskLogEntry.getTaskId()).containsExactly("3", "2", "1"); taskLogEntries = historyService.createHistoricTaskLogEntryQuery().orderByTimeStamp().desc().list(); assertThat(taskLogEntries).extracting(taskLogEntry -> taskLogEntry.getTaskId()).containsExactly("2", "1", "3"); } } finally { deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, "1"); deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, "2"); deleteTaskWithLogEntries(taskService, managementService, processEngineConfiguration, "3"); } }