From 9a94bd5c9864c36da3639372ed1805fbda6bc6bc Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Tue, 17 Dec 2024 14:32:05 +0100 Subject: [PATCH] Remove unused parameters --- .../java/org/kitodo/export/ExportDms.java | 2 +- .../kitodo/production/forms/ProcessForm.java | 2 +- .../production/forms/TemplateBaseForm.java | 4 +-- .../kitodo/production/forms/TemplateForm.java | 3 +- .../migration/NewspaperProcessesMigrator.java | 11 ++----- .../services/command/KitodoScriptService.java | 6 ++-- .../validation/MetadataValidationService.java | 6 ++-- .../production/workflow/model/ReaderIT.java | 30 +++++++++---------- 8 files changed, 26 insertions(+), 38 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/export/ExportDms.java b/Kitodo/src/main/java/org/kitodo/export/ExportDms.java index c8f3d865c71..ca6d454dadf 100644 --- a/Kitodo/src/main/java/org/kitodo/export/ExportDms.java +++ b/Kitodo/src/main/java/org/kitodo/export/ExportDms.java @@ -197,7 +197,7 @@ private boolean startExport(Process process, LegacyMetsModsDigitalDocumentHelper // validate metadata if (ConfigCore.getBooleanParameterOrDefaultValue(ParameterCore.USE_META_DATA_VALIDATION) - && !ServiceManager.getMetadataValidationService().validate(gdzfile, this.myPrefs, process)) { + && !ServiceManager.getMetadataValidationService().validate(gdzfile, this.myPrefs)) { if (Objects.nonNull(exportDmsTask)) { exportDmsTask.setException(new MetadataException("metadata validation failed", null)); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java index 04dd0885cdb..9e6b4ef6584 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java @@ -360,7 +360,7 @@ public void saveWorkpieceProperty() { * @return url to processEdit view */ public String saveTaskAndRedirect() { - saveTask(this.task, this.process, ObjectType.PROCESS.getTranslationSingular(), ServiceManager.getTaskService()); + saveTask(this.task); return processEditPath + "&id=" + (Objects.isNull(this.process.getId()) ? 0 : this.process.getId()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/TemplateBaseForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/TemplateBaseForm.java index cb6d0190c0e..8ea4f8503bb 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/TemplateBaseForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/TemplateBaseForm.java @@ -13,19 +13,17 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.kitodo.data.database.beans.BaseBean; import org.kitodo.data.database.beans.Task; import org.kitodo.data.exceptions.DataException; import org.kitodo.production.enums.ObjectType; import org.kitodo.production.helper.Helper; import org.kitodo.production.services.ServiceManager; -import org.kitodo.production.services.data.base.SearchDatabaseService; class TemplateBaseForm extends ProcessListBaseView { private static final Logger logger = LogManager.getLogger(TemplateBaseForm.class); - void saveTask(Task task, BaseBean baseBean, String message, SearchDatabaseService searchDatabaseService) { + void saveTask(Task task) { try { ServiceManager.getTaskService().save(task, true); ServiceManager.getTaskService().evict(task); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java index e852d31f89b..b50112d1bbe 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java @@ -222,8 +222,7 @@ public void delete() { * @return url to templateEdit view */ public String saveTaskAndRedirect() { - saveTask(this.task, this.template, ObjectType.TEMPLATE.getTranslationSingular(), - ServiceManager.getTemplateService()); + saveTask(this.task); return templateEditPath + "&id=" + (Objects.isNull(this.template.getId()) ? 0 : this.template.getId()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java b/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java index 9df3d199a44..381a7e4fde2 100644 --- a/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java +++ b/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java @@ -51,7 +51,6 @@ import org.kitodo.data.database.beans.Process; import org.kitodo.data.database.enums.BatchType; import org.kitodo.data.database.exceptions.DAOException; -import org.kitodo.data.exceptions.DataException; import org.kitodo.exceptions.CommandException; import org.kitodo.exceptions.ProcessGenerationException; import org.kitodo.production.enums.ProcessState; @@ -505,15 +504,11 @@ private void createLinkStructureAndCopyDays(Process process, LogicalDivision processDayLogicalDivision = computeIfAbsent( processMonthLogicalDivision, daySimpleMetadataView, day, dayType); MetadataEditor.writeMetadataEntry(metaFileDayLogicalDivision, daySimpleMetadataView, day); - createLinkStructureOfIssues(process, yearFileDayLogicalDivision, - processDayLogicalDivision); + createLinkStructureOfIssues(process, processDayLogicalDivision); } } - private void createLinkStructureOfIssues(Process process, - LogicalDivision yearFileDayLogicalDivision, - LogicalDivision processDayLogicalDivision) { - + private void createLinkStructureOfIssues(Process process, LogicalDivision processDayLogicalDivision) { MetadataEditor.addLink(processDayLogicalDivision, process.getId()); } @@ -618,8 +613,6 @@ public void createOverallProcess() throws ProcessGenerationException, IOExceptio * if the process cannot be generated * @throws IOException * if an I/O error occurs when accessing the file system - * @throws DataException - * if there is an error saving the process * @throws DAOException * if a process cannot be load from the database */ diff --git a/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java b/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java index 007b9acb6f5..7382572e74a 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java @@ -205,13 +205,13 @@ private boolean executeOtherScript(List processes, String script) copyDataToChildren(processes, script); break; default: - return executeRemainingScript(processes, script); + return executeRemainingScript(processes); } return true; } - private boolean executeRemainingScript(List processes, String script) - throws DataException, IOException, InvalidImagesException, MediaNotFoundException { + private boolean executeRemainingScript(List processes) + throws IOException, InvalidImagesException, MediaNotFoundException { // call the correct method via the parameter switch (this.parameters.get("action")) { case "generateImages": diff --git a/Kitodo/src/main/java/org/kitodo/production/services/validation/MetadataValidationService.java b/Kitodo/src/main/java/org/kitodo/production/services/validation/MetadataValidationService.java index a2952083cbc..4dc202b55cd 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/validation/MetadataValidationService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/validation/MetadataValidationService.java @@ -132,7 +132,7 @@ public boolean validate(Process process) { Helper.setErrorMessage("metadataReadError", new Object[] {process.getTitle() }, logger, e); return false; } - return validate(gdzfile, prefs, process); + return validate(gdzfile, prefs); } /** @@ -142,14 +142,12 @@ public boolean validate(Process process) { * Fileformat object * @param prefs * Prefs object - * @param process - * object * @return boolean * @deprecated This validation is a work-around to keep legacy code * functional. It should not be used anymore. */ @Deprecated - public boolean validate(LegacyMetsModsDigitalDocumentHelper gdzfile, LegacyPrefsHelper prefs, Process process) { + public boolean validate(LegacyMetsModsDigitalDocumentHelper gdzfile, LegacyPrefsHelper prefs) { try { return !State.ERROR.equals(validate(gdzfile.getWorkpiece(), prefs.getRuleset()).getState()); } catch (DAOException e) { diff --git a/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java b/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java index 454943326c5..db4172d899e 100644 --- a/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java @@ -71,11 +71,11 @@ public void shouldReadWorkflow() throws Exception { Task task = entry[0].getKey(); TaskInfo taskInfo = entry[0].getValue(); - assertCorrectTask(task, taskInfo, "Say hello", 1, ""); + assertCorrectTask(task, taskInfo, "Say hello", 1); task = entry[1].getKey(); taskInfo = entry[1].getValue(); - assertCorrectTask(task, taskInfo, "Execute script", 2, ""); + assertCorrectTask(task, taskInfo, "Execute script", 2); } @Test @@ -92,20 +92,20 @@ public void shouldReadConditionalWorkflow() throws Exception { String title = task.getName(); switch (title) { case "Task1": - assertCorrectTask(task, taskInfo, "Task1", 1, ""); + assertCorrectTask(task, taskInfo, "Task1", 1); assertFalse(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!"); break; case "ScriptTask": - assertCorrectTask(task, taskInfo, "ScriptTask", 2, "${type==1}"); + assertCorrectTask(task, taskInfo, "ScriptTask", 2); break; case "Task3": - assertCorrectTask(task, taskInfo, "Task3", 2, "${type==2}"); + assertCorrectTask(task, taskInfo, "Task3", 2); break; case "Task4": - assertCorrectTask(task, taskInfo, "Task4", 2, "default"); + assertCorrectTask(task, taskInfo, "Task4", 2); break; case "Task5": - assertCorrectTask(task, taskInfo, "Task5", 3, ""); + assertCorrectTask(task, taskInfo, "Task5", 3); assertTrue(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!"); break; default: @@ -137,28 +137,28 @@ public void shouldReadConditionalWorkflowWithTwoEnds() throws Exception { String title = task.getName(); switch (title) { case "Task1": - assertCorrectTask(task, taskInfo, "Task1", 1, ""); + assertCorrectTask(task, taskInfo, "Task1", 1); assertFalse(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!"); break; case "Task2": - assertCorrectTask(task, taskInfo, "Task2", 2, ""); + assertCorrectTask(task, taskInfo, "Task2", 2); break; case "Task3": - assertCorrectTask(task, taskInfo, "Task3", 3, "type=2"); + assertCorrectTask(task, taskInfo, "Task3", 3); assertFalse(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!"); break; case "Task4": - assertCorrectTask(task, taskInfo, "Task4", 4, "type=2"); + assertCorrectTask(task, taskInfo, "Task4", 4); break; case "Task5": - assertCorrectTask(task, taskInfo, "Task5", 4, "type=2"); + assertCorrectTask(task, taskInfo, "Task5", 4); break; case "Task6": - assertCorrectTask(task, taskInfo, "Task6", 5, "type=2"); + assertCorrectTask(task, taskInfo, "Task6", 5); assertTrue(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!"); break; case "Task7": - assertCorrectTask(task, taskInfo, "Task7", 3, "type=1"); + assertCorrectTask(task, taskInfo, "Task7", 3); assertTrue(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!"); break; default: @@ -176,7 +176,7 @@ public void shouldNotReadWorkflowWithLoop() throws Exception { assertEquals(Helper.getTranslation("workflowExceptionLoop", "Task1"), exception.getMessage()); } - private void assertCorrectTask(Task task, TaskInfo taskInfo, String title, int ordering, String condition) { + private void assertCorrectTask(Task task, TaskInfo taskInfo, String title, int ordering) { assertEquals(title, task.getName(), "Process definition - workflow's task title was read incorrectly!"); assertEquals(ordering, taskInfo.getOrdering(), "Process definition - workflow's task ordering was determined incorrectly!"); }