Skip to content

Commit

Permalink
Review Findings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jörg Heffner authored and gitgoodjhe committed Aug 7, 2024
1 parent 8b9ca25 commit 46ab785
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -153,16 +152,19 @@ public void create(ClassificationHistoryEvent event) {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ public HistoryCleanupJob(
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ void should_CreateClassificationDeletedHistoryEvent_When_ClassificationIsDeleted

final String classificationId = "CLI:200000000000000000000000000000000015";

taskService.createTaskQuery().list();
historyService.deleteHistoryEventsByTaskIds(List.of("test12"));

List<ClassificationHistoryEvent> events =
historyService
.createClassificationHistoryQuery()
Expand Down

0 comments on commit 46ab785

Please sign in to comment.