From 571d493bbdc0cf3dfe2771d5f3eb3e07c7526ef4 Mon Sep 17 00:00:00 2001 From: Henning Gerhardt Date: Sat, 24 Feb 2024 16:47:01 +0100 Subject: [PATCH] Add missing hashCode methods --- .../main/java/org/kitodo/api/Metadata.java | 11 +++++ .../database/beans/ImportConfiguration.java | 48 +++++++++++++++++++ .../data/database/beans/MappingFile.java | 19 ++++++++ .../production/filters/ParsedFilter.java | 11 +++++ 4 files changed, 89 insertions(+) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/Metadata.java b/Kitodo-API/src/main/java/org/kitodo/api/Metadata.java index cd20fe0a2f1..04b6ddf28b2 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/Metadata.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/Metadata.java @@ -74,4 +74,15 @@ public boolean equals(Object o) { return domain == metadata.domain && Objects.equals(key, metadata.key); } + + /** + * hashCode method of current class. + * + * @see java.lang.Object#hashCode() + * @return int + */ + @Override + public int hashCode() { + return Objects.hash(domain, key); + } } diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/ImportConfiguration.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/ImportConfiguration.java index a064974fd29..11746750e4b 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/ImportConfiguration.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/ImportConfiguration.java @@ -853,4 +853,52 @@ public boolean equals(Object object) { } return false; } + + /** + * hashCode method of current class. + * + * @see java.lang.Object#hashCode() + * @return int + */ + @Override + public int hashCode() { + return Objects.hash( + title, + description, + configurationType, + prestructuredImport, + interfaceType, + returnFormat, + metadataFormat, + defaultImportDepth, + parentElementTrimMode, + host, + scheme, + path, + port, + anonymousAccess, + username, + password, + queryDelimiter, + itemFieldXpath, + itemFieldOwnerSubPath, + itemFieldOwnerMetadata, + itemFieldSignatureSubPath, + itemFieldSignatureMetadata, + idPrefix, + searchFields, + urlParameters, + defaultSearchField, + idSearchField, + parentSearchField, + defaultTemplateProcess, + mappingFiles, + parentMappingFile, + sruVersion, + sruRecordSchema, + oaiMetadataPrefix, + metadataRecordIdXPath, + metadataRecordTitleXPath + ); + } } diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/MappingFile.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/MappingFile.java index 6ff0338b41c..8df6390f0ab 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/MappingFile.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/MappingFile.java @@ -12,6 +12,7 @@ package org.kitodo.data.database.beans; import java.util.List; +import java.util.Objects; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -161,4 +162,22 @@ public boolean equals(Object object) { } return false; } + + /** + * hashCode method of current class. + * + * @see java.lang.Object#hashCode() + * @return int + */ + @Override + public int hashCode() { + return Objects.hash( + title, + file, + inputMetadataFormat, + outputMetadataFormat, + prestructuredImport, + importConfigurations + ); + } } diff --git a/Kitodo/src/main/java/org/kitodo/production/filters/ParsedFilter.java b/Kitodo/src/main/java/org/kitodo/production/filters/ParsedFilter.java index 065ca27cb3c..da1f4145898 100644 --- a/Kitodo/src/main/java/org/kitodo/production/filters/ParsedFilter.java +++ b/Kitodo/src/main/java/org/kitodo/production/filters/ParsedFilter.java @@ -83,4 +83,15 @@ public boolean equals(Object o) { } return plainFilter.equals(((ParsedFilter) o).getPlainFilter()); } + + /** + * hashCode method of current class. + * + * @see java.lang.Object#hashCode() + * @return int + */ + @Override + public int hashCode() { + return Objects.hash(plainFilter); + } }