From 2500e63ba79953418e02819938cf7d9b78cd731b Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 19 Jul 2024 08:07:06 +0200 Subject: [PATCH] Fix issues reported by CodeQL (Missing Override annotation) 'Missing Override annotation' was reported 21 times. This commit adds the missing annotations. Signed-off-by: Stefan Weil --- .../src/main/java/org/kitodo/utils/JAXBContextCache.java | 2 ++ .../java/org/kitodo/dataeditor/MetsKitodoObjectFactory.java | 1 + .../src/main/java/org/kitodo/data/database/beans/Property.java | 1 + .../java/org/kitodo/data/elasticsearch/KitodoRestClient.java | 1 + .../main/java/org/kitodo/filemanagement/FileManagement.java | 1 + .../java/org/kitodo/production/forms/ProcessListBaseView.java | 1 + .../production/forms/createprocess/CreateProcessForm.java | 3 +++ .../production/forms/createprocess/ProcessFieldedMetadata.java | 1 + .../production/forms/createprocess/ProcessSimpleMetadata.java | 1 + .../production/forms/createprocess/ProcessTextMetadata.java | 1 + .../org/kitodo/production/forms/dataeditor/DataEditorForm.java | 3 +++ .../org/kitodo/production/services/command/AddDataScript.java | 1 + .../kitodo/production/services/command/DeleteDataScript.java | 1 + .../org/kitodo/production/services/index/IndexingService.java | 1 + .../org/kitodo/selenium/testframework/pages/ProjectsPage.java | 1 + .../org/kitodo/selenium/testframework/pages/UsersPage.java | 1 + 16 files changed, 21 insertions(+) diff --git a/Kitodo-API/src/main/java/org/kitodo/utils/JAXBContextCache.java b/Kitodo-API/src/main/java/org/kitodo/utils/JAXBContextCache.java index de0838438e2..3a959586315 100644 --- a/Kitodo-API/src/main/java/org/kitodo/utils/JAXBContextCache.java +++ b/Kitodo-API/src/main/java/org/kitodo/utils/JAXBContextCache.java @@ -118,6 +118,7 @@ private static class ContextDescriptor { private final String fileName; + @Override public boolean equals(Object potentialContextDescriptor) { if (potentialContextDescriptor instanceof ContextDescriptor) { final ContextDescriptor contextDescriptor = ((ContextDescriptor) potentialContextDescriptor); @@ -127,6 +128,7 @@ public boolean equals(Object potentialContextDescriptor) { return false; } + @Override public int hashCode() { return (clazz + fileName).hashCode(); } diff --git a/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/MetsKitodoObjectFactory.java b/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/MetsKitodoObjectFactory.java index 868df2b57fd..edf09bd00f9 100644 --- a/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/MetsKitodoObjectFactory.java +++ b/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/MetsKitodoObjectFactory.java @@ -39,6 +39,7 @@ public class MetsKitodoObjectFactory extends ObjectFactory { * * @return The KitodoType object. */ + @Override public KitodoType createKitodoType() { KitodoType kitodoType = super.createKitodoType(); kitodoType.setVersion(VersionProvider.getDataFormatVersion()); diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Property.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Property.java index 2863bd452d7..764adbe07c4 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Property.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Property.java @@ -264,6 +264,7 @@ public void setWorkpieces(List workpieces) { * object * @return int */ + @Override public int compareTo(Property property) { int titleMatch = this.getTitle().toLowerCase().compareTo(property.getTitle().toLowerCase()); int valueMatch = this.getValue().toLowerCase().compareTo(property.getValue().toLowerCase()); diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java index e0c82af9f20..85f16896dd2 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java @@ -131,6 +131,7 @@ private void initiateClientWithAuth(String host, Integer port, String protocol, * * @return information about the server */ + @Override public String getServerInformation() throws IOException { Request request = new Request(HttpMethod.GET, "/"); request.addParameter("pretty", "true"); diff --git a/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileManagement.java b/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileManagement.java index 0b9e154ee3d..04f5c5e15d4 100644 --- a/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileManagement.java +++ b/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileManagement.java @@ -563,6 +563,7 @@ private String getDecodedPath(URI uri) { return decodedPath; } + @Override public File getFile(URI uri) { uri = fileMapper.mapUriToKitodoDataDirectoryUri(uri); return new File(uri); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java index 581e07eead6..1888c58ade0 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java @@ -613,6 +613,7 @@ public void setSelectedProcessesOrProcessDTOs(List selectedPro * Update selection and first row to show in datatable on PageEvent. * @param pageEvent PageEvent triggered by data tables paginator */ + @Override public void onPageChange(PageEvent pageEvent) { this.setFirstRow(((DataTable) pageEvent.getSource()).getFirst()); if (allSelected) { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java index 4637d61748c..c9be296e60d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java @@ -713,6 +713,7 @@ public String getReferringView() { * @param treeNode treeNode to be added * @return whether the given ProcessDetail can be added or not */ + @Override public boolean canBeAdded(TreeNode treeNode) throws InvalidMetadataValueException { if (Objects.isNull(treeNode.getParent().getParent())) { if (Objects.nonNull(currentProcess.getProcessMetadata().getSelectedMetadataTreeNode()) @@ -746,6 +747,7 @@ public boolean canBeDeleted(ProcessDetail processDetail) { * @param metadataNode TreeNode for which the check is performed * @return whether given TreeNode contains ProcessFieldedMetadata and if any further metadata can be added to it */ + @Override public boolean metadataAddableToGroup(TreeNode metadataNode) { if (metadataNode.getData() instanceof ProcessFieldedMetadata) { return !(DataEditorService.getAddableMetadataForGroup(getMainProcess().getRuleset(), metadataNode).isEmpty()); @@ -757,6 +759,7 @@ public boolean metadataAddableToGroup(TreeNode metadataNode) { * Prepare addable metadata for metadata group. * @param treeNode metadataGroup treeNode */ + @Override public void prepareAddableMetadataForGroup(TreeNode treeNode) { addMetadataDialog.prepareAddableMetadataForGroup(getMainProcess().getRuleset(), treeNode); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java index 0dabe513dc3..4007c9b379f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java @@ -668,6 +668,7 @@ void markLeadingMetadataFields(List> leadingMetadata * there is no setter corresponding to the name configured in * the rule set */ + @Override public void preserve() throws InvalidMetadataValueException, NoSuchMetadataFieldException { try { if (Objects.nonNull(division)) { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java index e5afcc3c0ae..1ed5997920f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java @@ -87,6 +87,7 @@ public boolean isUndefined() { return Objects.isNull(settings) || settings.isUndefined(); } + @Override public boolean isRequired() { ComplexMetadataViewInterface containerSettings = container.getMetadataView(); if (!(containerSettings instanceof StructuralElementViewInterface) && container.getChildMetadata().isEmpty() diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessTextMetadata.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessTextMetadata.java index 549c36ae4c5..cafa033051f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessTextMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessTextMetadata.java @@ -84,6 +84,7 @@ public String getInput() { * @param skipEmpty boolean * @return the metadata from this row */ + @Override public Collection getMetadata(boolean skipEmpty) { value = value.trim(); if (skipEmpty && value.isEmpty()) { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java index f4425d7034b..66e27669f08 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java @@ -973,6 +973,7 @@ public String getReferringView() { * @param treeNode treeNode to be added * @return whether the given ProcessDetail can be added or not */ + @Override public boolean canBeAdded(TreeNode treeNode) { if (Objects.isNull(treeNode.getParent().getParent())) { if (Objects.nonNull(metadataPanel.getSelectedMetadataTreeNode()) || Objects.isNull(addMetadataDialog.getAddableMetadata())) { @@ -1116,6 +1117,7 @@ public void preserveMetadataPanel() { * * @return whether given TreeNode contains ProcessFieldedMetadata and if any further metadata can be added to it */ + @Override public boolean metadataAddableToGroup(TreeNode metadataNode) { return metadataPanel.metadataAddableToGroup(metadataNode); } @@ -1123,6 +1125,7 @@ public boolean metadataAddableToGroup(TreeNode metadataNode) { /** * Prepare addable metadata for metadata group. */ + @Override public void prepareAddableMetadataForGroup(TreeNode treeNode) { addMetadataDialog.prepareAddableMetadataForGroup(treeNode); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/command/AddDataScript.java b/Kitodo/src/main/java/org/kitodo/production/services/command/AddDataScript.java index 476c2287af4..5e16baddfe4 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/command/AddDataScript.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/command/AddDataScript.java @@ -29,6 +29,7 @@ public class AddDataScript extends EditDataScript { * @param process the related process * @param metadataScript the script to execute */ + @Override public void executeScript(LegacyMetsModsDigitalDocumentHelper metadataFile, Process process, MetadataScript metadataScript) throws KitodoScriptExecutionException { Workpiece workpiece = metadataFile.getWorkpiece(); diff --git a/Kitodo/src/main/java/org/kitodo/production/services/command/DeleteDataScript.java b/Kitodo/src/main/java/org/kitodo/production/services/command/DeleteDataScript.java index 3da7dabe935..6a020c031b1 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/command/DeleteDataScript.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/command/DeleteDataScript.java @@ -30,6 +30,7 @@ public class DeleteDataScript extends EditDataScript { * @param process the related process * @param metadataScript the script to execute */ + @Override public void executeScript(LegacyMetsModsDigitalDocumentHelper metadataFile, Process process, MetadataScript metadataScript) throws KitodoScriptExecutionException { Workpiece workpiece = metadataFile.getWorkpiece(); diff --git a/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java b/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java index 547614e0f51..515edee9f78 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java @@ -283,6 +283,7 @@ private int getNumberOfDatabaseObjects(ObjectType objectType) throws DAOExceptio private ExecutorService createDeamonizedExecutorService(int threads) { return Executors.newFixedThreadPool(threads, new ThreadFactory() { + @Override public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java index f13552386c5..936441ae9c3 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java @@ -195,6 +195,7 @@ public ProjectsPage() { * * @return The projects page. */ + @Override public ProjectsPage goTo() throws Exception { Pages.getTopNavigation().gotoProjects(); await("Wait for execution of link click").pollDelay(Browser.getDelayMinAfterLinkClick(), TimeUnit.MILLISECONDS) diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/UsersPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/UsersPage.java index 4b8d4319324..6e4735b8fea 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/UsersPage.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/UsersPage.java @@ -117,6 +117,7 @@ public UsersPage() { * * @return The users page. */ + @Override public UsersPage goTo() throws Exception { Pages.getTopNavigation().gotoUsers(); await("Wait for execution of link click").pollDelay(Browser.getDelayMinAfterLinkClick(), TimeUnit.MILLISECONDS)