Skip to content

Commit

Permalink
Add tasks to processes to enable sorting by sortHelperStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Sep 12, 2024
1 parent 86429ec commit 945cc24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1047,4 +1047,9 @@ public void setHasComments(boolean hasComments) {
throw new UnsupportedOperationException("cannot insert comments");
}
}

@Override
public String toString() {
return title + " [" + id + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,10 @@ private void processAutomaticTask(Task task) {
public static void updateProcessSortHelperStatus(Process process) {
if (!process.getTasks().isEmpty()) {
String value = ProcessConverter.getCombinedProgressAsString(process, false);
logger.trace("Setting sortHelperStatus for process {} to '{}'", process, value);
process.setSortHelperStatus(value);
} else {
logger.trace("Cannot set sortHelperStatus for process {}: process has no tasks", process);
}
}

Expand Down
4 changes: 4 additions & 0 deletions Kitodo/src/test/java/org/kitodo/MockDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ private static void insertTasks() throws Exception {
secondUser.getProcessingTasks().add(task);
}
ServiceManager.getTaskService().save(task);
firstProcess.getTasks().add(task);
}

ServiceManager.getUserService().save(firstUser);
Expand All @@ -1227,6 +1228,7 @@ private static void insertTasks() throws Exception {
role.getTasks().add(eleventhTask);
ServiceManager.getTaskService().save(eleventhTask);
firstUser.getProcessingTasks().add(eleventhTask);
secondProcess.getTasks().add(eleventhTask);

Task twelfthTask = new Task();
twelfthTask.setTitle("Processed and Some");
Expand All @@ -1242,6 +1244,7 @@ private static void insertTasks() throws Exception {
ServiceManager.getTaskService().save(twelfthTask);
firstUser.getProcessingTasks().add(twelfthTask);
ServiceManager.getUserService().save(firstUser);
secondProcess.getTasks().add(twelfthTask);

Task thirteenTask = new Task();
thirteenTask.setTitle("Next Open");
Expand All @@ -1254,6 +1257,7 @@ private static void insertTasks() throws Exception {
thirteenTask.getRoles().add(role);
role.getTasks().add(thirteenTask);
ServiceManager.getTaskService().save(thirteenTask);
secondProcess.getTasks().add(thirteenTask);

ServiceManager.getRoleService().save(role);

Expand Down

0 comments on commit 945cc24

Please sign in to comment.