Review Findings

This commit is contained in:
Jörg Heffner 2024-08-02 09:54:22 +02:00 committed by Jörg Heffner
parent 8b9ca2550e
commit 46ab7853fc
3 changed files with 8 additions and 11 deletions

View File

@ -42,7 +42,6 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
private InternalTaskanaEngine internalTaskanaEngine;
public void initialize(TaskanaEngine taskanaEngine) {
LOGGER.info(
"Simple history service implementation initialized with schemaName: {} ",
taskanaEngine.getConfiguration().getSchemaName());
@ -153,16 +152,19 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
public void deleteHistoryEventsByTaskIds(List<String> taskIds)
throws InvalidArgumentException, NotAuthorizedException {
internalTaskanaEngine.openConnection();
internalTaskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN);
if (taskIds == null) {
throw new InvalidArgumentException("List of taskIds must not be null.");
}
taskHistoryEventMapper.deleteMultipleByTaskIds(taskIds);
try {
internalTaskanaEngine.openConnection();
taskHistoryEventMapper.deleteMultipleByTaskIds(taskIds);
} finally {
internalTaskanaEngine.returnConnection();
internalTaskanaEngine.returnConnection();
}
}
public TaskHistoryEvent getTaskHistoryEvent(String historyEventId)

View File

@ -46,10 +46,8 @@ public class HistoryCleanupJob extends AbstractTaskanaJob {
TaskanaTransactionProvider txProvider,
ScheduledJob scheduledJob) {
super(taskanaEngine, txProvider, scheduledJob, true);
if (simpleHistoryService == null) {
simpleHistoryService = new SimpleHistoryServiceImpl();
simpleHistoryService.initialize(taskanaEngine);
}
simpleHistoryService = new SimpleHistoryServiceImpl();
simpleHistoryService.initialize(taskanaEngine);
}
public static Duration getLockExpirationPeriod(TaskanaConfiguration taskanaConfiguration) {

View File

@ -30,9 +30,6 @@ class CreateHistoryEventOnClassificationDeletionAccTest extends AbstractAccTest
final String classificationId = "CLI:200000000000000000000000000000000015";
taskService.createTaskQuery().list();
historyService.deleteHistoryEventsByTaskIds(List.of("test12"));
List<ClassificationHistoryEvent> events =
historyService
.createClassificationHistoryQuery()