Skip to content

Commit 1e89ee5

Browse files
committed
Implement review comments
1 parent f4fe565 commit 1e89ee5

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

Kitodo-DataManagement/src/main/java/org/kitodo/data/database/persistence/TaskDAO.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
package org.kitodo.data.database.persistence;
1313

14-
import java.util.ArrayList;
1514
import java.util.EnumMap;
1615
import java.util.HashMap;
1716
import java.util.List;
@@ -211,7 +210,7 @@ public Map<TaskStatus, Integer> countTaskStatusForProcessAndItsAncestors(Process
211210
public Map<Integer, EnumMap<TaskStatus, Integer>> loadTaskStatusCountsForProcesses(
212211
List<Integer> processIds) throws DAOException {
213212
Map<Integer, EnumMap<TaskStatus, Integer>> result = new HashMap<>();
214-
if (processIds == null || processIds.isEmpty()) {
213+
if (Objects.isNull(processIds) || processIds.isEmpty()) {
215214
return result;
216215
}
217216
Stopwatch stopwatch = new Stopwatch(this,"loadTaskStatusCountsForProcesses",
@@ -247,7 +246,7 @@ public Map<Integer, EnumMap<TaskStatus, Integer>> loadTaskStatusCountsForProcess
247246

248247
EnumMap<TaskStatus, Integer> map =
249248
result.computeIfAbsent(rootId, id -> createEmptyStatusMap());
250-
if (statusValue != null) {
249+
if (Objects.nonNull(statusValue)) {
251250
map.put(TaskStatus.getStatusFromValue(statusValue), count);
252251
}
253252
}

Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ public class ProcessListBaseView extends ValidatableForm {
6868
DeleteProcessDialog deleteProcessDialog = new DeleteProcessDialog();
6969

7070
private final HashMap<Integer, Boolean> exportable = new HashMap<>();
71-
private static final String NL = "\n";
7271

7372
boolean allSelected = false;
7473
HashSet<Integer> excludedProcessIds = new HashSet<>();
7574

76-
7775
/**
7876
* Constructor.
7977
*/
@@ -233,15 +231,16 @@ private void appendTitles(StringBuilder sb,
233231
TaskStatus status,
234232
Map<TaskStatus, List<String>> titles) {
235233
List<String> list = titles.get(status);
234+
String newLine = "\n";
236235
if (Objects.isNull(list) || list.isEmpty()) {
237236
return;
238237
}
239238
if (!sb.isEmpty()) {
240-
sb.append(NL);
239+
sb.append(newLine);
241240
}
242241
sb.append(Helper.getTranslation(status.getTitle())).append(":");
243242
for (String t : list) {
244-
sb.append(NL).append(" - ").append(Helper.getTranslation(t));
243+
sb.append(newLine).append(" - ").append(Helper.getTranslation(t));
245244
}
246245
}
247246

Kitodo/src/main/java/org/kitodo/production/model/LazyProcessModel.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class LazyProcessModel extends LazyBeanModel {
5959
private boolean showInactiveProjects = false;
6060

6161
private Map<Integer, EnumMap<TaskStatus, Integer>> taskStatusCache = new HashMap<>();
62-
public Map<Integer, Map<TaskStatus, List<String>>> taskTitleCache = new HashMap<>();
62+
private Map<Integer, Map<TaskStatus, List<String>>> taskTitleCache = new HashMap<>();
6363
private Set<Integer> processesWithChildren = new HashSet<>();
6464

6565
/**
@@ -187,14 +187,30 @@ public Object getRowData() {
187187
}
188188
}
189189

190+
/**
191+
* Returns the cached task titles grouped by process ID and task status.
192+
*
193+
* @return map of process ID to task titles grouped by Taskstatus
194+
*/
190195
public Map<Integer, Map<TaskStatus, List<String>>> getTaskTitleCache() {
191196
return taskTitleCache;
192197
}
193198

199+
/**
200+
* Returns the cached task status counts for the given process.
201+
*
202+
* @param process the process whose task status counts are requested
203+
* @return map of TaskStatus to count
204+
*/
194205
public EnumMap<TaskStatus, Integer> getTaskStatusCounts(Process process) {
195206
return taskStatusCache.get(process.getId());
196207
}
197208

209+
/**
210+
* Returns the IDs of processes that have at least one child process.
211+
*
212+
* @return set of process IDs with children
213+
*/
198214
public Set<Integer> getProcessesWithChildren() {
199215
return processesWithChildren;
200216
}

Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ public List<Task> getCurrentTasksForUser(Process process, User user) {
23812381
* @return IDs of processes that have children
23822382
*/
23832383
public Set<Integer> findProcessIdsWithChildren(Collection<Integer> processIds) throws DAOException {
2384-
if (processIds == null || processIds.isEmpty()) {
2384+
if (Objects.isNull(processIds) || processIds.isEmpty()) {
23852385
return Collections.emptySet();
23862386
}
23872387
String hql = "SELECT DISTINCT p.parent "

Kitodo/src/main/webapp/WEB-INF/templates/includes/processes/progressColumn.xhtml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
xmlns:h="http://xmlns.jcp.org/jsf/html"
1717
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
1818
<!--@elvariable id="process" type="org.kitodo.production.dto.ProcessDTO"-->
19-
2019
<h:panelGroup
2120
class="process-progress"
2221
title="#{ProcessForm.getCurrentTaskTitles(process)}"
@@ -42,6 +41,4 @@
4241
+ ProcessForm.progressInProcessing(process)
4342
+ ProcessForm.progressClosed(process)}%);"
4443
/>
45-
46-
4744
</ui:composition>

0 commit comments

Comments
 (0)