Skip to content

Commit

Permalink
Merge pull request kitodo#6352 from effective-webwork/unused-parameter
Browse files Browse the repository at this point in the history
Remove unused parameters
  • Loading branch information
solth authored Jan 10, 2025
2 parents d6ef0f0 + 9a94bd5 commit 80a7a29
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Kitodo/src/main/java/org/kitodo/export/ExportDms.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ private boolean executeOtherScript(List<Process> processes, String script)
copyDataToChildren(processes, script);
break;
default:
return executeRemainingScript(processes, script);
return executeRemainingScript(processes);
}
return true;
}

private boolean executeRemainingScript(List<Process> processes, String script)
throws DataException, IOException, InvalidImagesException, MediaNotFoundException {
private boolean executeRemainingScript(List<Process> processes)
throws IOException, InvalidImagesException, MediaNotFoundException {
// call the correct method via the parameter
switch (this.parameters.get("action")) {
case "generateImages":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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!");
}
Expand Down

0 comments on commit 80a7a29

Please sign in to comment.