From 5259175befe7fd42cc21a30f6bab09244b3e4096 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 30 Jul 2024 22:58:33 +0200 Subject: [PATCH 1/4] Fix javadoc errors and warnings for Kitodo-API Signed-off-by: Stefan Weil --- .../org/kitodo/api/dataeditor/DataEditorInterface.java | 1 + .../MetadataViewWithValuesInterface.java | 2 +- .../main/java/org/kitodo/api/dataformat/MediaPartial.java | 6 +++--- .../api/filemanagement/FileManagementInterface.java | 8 ++++++++ .../src/main/java/org/kitodo/config/OPACConfig.java | 5 +++++ .../java/org/kitodo/config/enums/KitodoConfigFile.java | 1 + .../kitodo/exceptions/UnknownTreeNodeDataException.java | 1 + 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/DataEditorInterface.java b/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/DataEditorInterface.java index a6e9d24ba48..b9d17c9bf21 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/DataEditorInterface.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/DataEditorInterface.java @@ -26,6 +26,7 @@ public interface DataEditorInterface { * The URI to the xml file to read. * @param xsltFileUri * The URI to the xsl file for transformation of old format goobi metadata files. + * @throws IOException if reading fails. */ void readData(URI xmlFileUri, URI xsltFileUri) throws IOException; diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/MetadataViewWithValuesInterface.java b/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/MetadataViewWithValuesInterface.java index ef1d5c7e99a..ac2e65558ff 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/MetadataViewWithValuesInterface.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/MetadataViewWithValuesInterface.java @@ -24,7 +24,7 @@ * for this key. If the key is a multiple choice, the values are grouped, hence * the list, otherwise the length of the list is always only one. Effectively, * the return type of - * {@link ComplexMetadataViewInterface#getSortedVisibleMetadatas(Collection, Collection)} + * {@link ComplexMetadataViewInterface#getSortedVisibleMetadata(Collection, Collection)} * is {@code List>>}. Since the key * must be repeatable if there is more than one value but the key is not a * multiple choice, a map would be an inappropriate choice at this point. diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java index a6d825956c4..60897970039 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java @@ -29,7 +29,7 @@ public class MediaPartial { * * @param begin * The begin as formatted time in form of - * {@link org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} + * ([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3} */ public MediaPartial(String begin) { this.begin = begin; @@ -40,10 +40,10 @@ public MediaPartial(String begin) { * * @param begin * The begin as formatted time in form of - * {@link org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} + * ([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3} * @param extent * The extent as formatted time in form of - * {@link org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} + * ([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3} */ public MediaPartial(String begin, String extent) { this(begin); diff --git a/Kitodo-API/src/main/java/org/kitodo/api/filemanagement/FileManagementInterface.java b/Kitodo-API/src/main/java/org/kitodo/api/filemanagement/FileManagementInterface.java index 509d1ccd691..13ec50fa649 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/filemanagement/FileManagementInterface.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/filemanagement/FileManagementInterface.java @@ -35,6 +35,7 @@ public interface FileManagementInterface { * @param file * if true it creates the file, if false it created directory * @return the URI of the new resource + * @throws IOException if file/folder could not be created */ URI create(URI parentFolderUri, String name, boolean file) throws IOException; @@ -44,6 +45,7 @@ public interface FileManagementInterface { * @param uri * the uri to write to * @return an writable OutputStream + * @throws IOException if uri could not be written */ OutputStream write(URI uri) throws IOException; @@ -53,6 +55,7 @@ public interface FileManagementInterface { * @param uri * the uri to write from * @return a readable InputStream + * @throws IOException if uri could not be read */ InputStream read(URI uri) throws IOException; @@ -63,6 +66,7 @@ public interface FileManagementInterface { * source file as uri * @param targetResource * destination file as uri + * @throws IOException if source could not be read or destination could not be written */ void copy(URI sourceResource, URI targetResource) throws IOException; @@ -72,6 +76,7 @@ public interface FileManagementInterface { * @param uri * the URI to delete * @return true if successful, false otherwise + * @throws IOException if uri could not be deleted */ boolean delete(URI uri) throws IOException; @@ -95,6 +100,7 @@ public interface FileManagementInterface { * @param newName * the new name of the resource * @return URI of renamed resource + * @throws IOException if uri could not be renamed */ URI rename(URI uri, String newName) throws IOException; @@ -114,6 +120,7 @@ public interface FileManagementInterface { * @param directory * URI to get size * @return size of directory as Long + * @throws IOException if getting the size of URI failed */ Long getSizeOfDirectory(URI directory) throws IOException; @@ -179,6 +186,7 @@ public interface FileManagementInterface { * @param processId * the id of the process * @return the URI to the process Location + * @throws IOException if the folder structure could not be created */ URI createProcessLocation(String processId) throws IOException; diff --git a/Kitodo-API/src/main/java/org/kitodo/config/OPACConfig.java b/Kitodo-API/src/main/java/org/kitodo/config/OPACConfig.java index 9510e1ca537..493d8e825b3 100644 --- a/Kitodo-API/src/main/java/org/kitodo/config/OPACConfig.java +++ b/Kitodo-API/src/main/java/org/kitodo/config/OPACConfig.java @@ -71,6 +71,7 @@ private OPACConfig() { * @param catalogName String identifying the catalog by title * @param parameter String identifying the parameter by name * @return value of parameter + * @throws ParameterNotFoundException if parameter was not found */ public static String getConfigValue(String catalogName, String parameter) throws ParameterNotFoundException { HierarchicalConfiguration opacConfiguration = getCatalog(catalogName); @@ -151,6 +152,7 @@ private static String getUrlConfigPart(String catalogName, String parameter) * Get host parameter of catalog configuration with name 'catalogName'. * @param catalogName name of catalog configuration * @return host value as String + * @throws MandatoryParameterMissingException if required parameter is missing */ public static String getHost(String catalogName) throws MandatoryParameterMissingException { return getUrlConfigPart(catalogName, HOST); @@ -160,6 +162,7 @@ public static String getHost(String catalogName) throws MandatoryParameterMissin * Get scheme parameter of catalog configuration with name 'catalogName'. * @param catalogName name of catalog configuration * @return scheme value as String + * @throws MandatoryParameterMissingException if required parameter is missing */ public static String getScheme(String catalogName) throws MandatoryParameterMissingException { return getUrlConfigPart(catalogName, SCHEME); @@ -169,6 +172,7 @@ public static String getScheme(String catalogName) throws MandatoryParameterMiss * Get path parameter of catalog configuration with name 'catalogName'. * @param catalogName name of catalog configuration * @return path value as String + * @throws MandatoryParameterMissingException if required parameter is missing */ public static String getPath(String catalogName) throws MandatoryParameterMissingException { return getUrlConfigPart(catalogName, PATH); @@ -178,6 +182,7 @@ public static String getPath(String catalogName) throws MandatoryParameterMissin * Get port parameter of catalog configuration with name 'catalogName'. * @param catalogName name of catalog configuration * @return port value as String + * @throws MandatoryParameterMissingException if required parameter is missing */ public static String getPort(String catalogName) throws MandatoryParameterMissingException { return getUrlConfigPart(catalogName, PORT); diff --git a/Kitodo-API/src/main/java/org/kitodo/config/enums/KitodoConfigFile.java b/Kitodo-API/src/main/java/org/kitodo/config/enums/KitodoConfigFile.java index ee200cd9903..d6beb5e9488 100644 --- a/Kitodo-API/src/main/java/org/kitodo/config/enums/KitodoConfigFile.java +++ b/Kitodo-API/src/main/java/org/kitodo/config/enums/KitodoConfigFile.java @@ -85,6 +85,7 @@ public String getAbsolutePath() { * @param name * of configuration file * @return File + * @throws FileNotFoundException if the configuration file is not found */ public static KitodoConfigFile getByName(String name) throws FileNotFoundException { for (KitodoConfigFile file : KitodoConfigFile.values()) { diff --git a/Kitodo-API/src/main/java/org/kitodo/exceptions/UnknownTreeNodeDataException.java b/Kitodo-API/src/main/java/org/kitodo/exceptions/UnknownTreeNodeDataException.java index f0093ae4611..868e0c62dc5 100644 --- a/Kitodo-API/src/main/java/org/kitodo/exceptions/UnknownTreeNodeDataException.java +++ b/Kitodo-API/src/main/java/org/kitodo/exceptions/UnknownTreeNodeDataException.java @@ -15,6 +15,7 @@ public class UnknownTreeNodeDataException extends RuntimeException { /** * Constructor with given parameter name for exception message. + * @param type String which describes the unexpected type */ public UnknownTreeNodeDataException(String type) { super("TreeNode contains data of unexpected type '" + type + "!"); From 32a63cb2d2bde15cc37a2a6ac6ca79eaf8891476 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 31 Jul 2024 11:40:20 +0200 Subject: [PATCH 2/4] Use a more documentation friendly format for the expected time string Signed-off-by: Stefan Weil --- .../main/java/org/kitodo/api/dataformat/MediaPartial.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java index 60897970039..9d4d0d175fe 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java @@ -29,7 +29,7 @@ public class MediaPartial { * * @param begin * The begin as formatted time in form of - * ([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3} + * HH:MM:SS.mmm (hour, minutes, seconds, milliseconds) */ public MediaPartial(String begin) { this.begin = begin; @@ -40,10 +40,10 @@ public MediaPartial(String begin) { * * @param begin * The begin as formatted time in form of - * ([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3} + * HH:MM:SS.mmm (hour, minutes, seconds, milliseconds) * @param extent * The extent as formatted time in form of - * ([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3} + * HH:MM:SS.mmm (hour, minutes, seconds, milliseconds) */ public MediaPartial(String begin, String extent) { this(begin); From f767543dd321458555a1b03df933470f63649791 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 2 Sep 2024 11:59:45 +0200 Subject: [PATCH 3/4] Apply suggestions from code review and replace @link by @see Suggested-by: Henning Gerhardt Signed-off-by: Stefan Weil --- .../main/java/org/kitodo/api/dataformat/MediaPartial.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java index 9d4d0d175fe..38f637c8e4b 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java @@ -29,7 +29,7 @@ public class MediaPartial { * * @param begin * The begin as formatted time in form of - * HH:MM:SS.mmm (hour, minutes, seconds, milliseconds) + * {@see org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} */ public MediaPartial(String begin) { this.begin = begin; @@ -40,10 +40,10 @@ public MediaPartial(String begin) { * * @param begin * The begin as formatted time in form of - * HH:MM:SS.mmm (hour, minutes, seconds, milliseconds) + * {@see org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} * @param extent * The extent as formatted time in form of - * HH:MM:SS.mmm (hour, minutes, seconds, milliseconds) + * {@see org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} */ public MediaPartial(String begin, String extent) { this(begin); From d09efbe286d0a2cd8100506801482e3b6279eec7 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 2 Sep 2024 12:27:34 +0200 Subject: [PATCH 4/4] Remove cross links to time format Signed-off-by: Stefan Weil --- .../java/org/kitodo/api/dataformat/MediaPartial.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java index 38f637c8e4b..ccf472dc0e7 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaPartial.java @@ -28,8 +28,7 @@ public class MediaPartial { * Constructs a media partial object. * * @param begin - * The begin as formatted time in form of - * {@see org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} + * The begin as formatted time. */ public MediaPartial(String begin) { this.begin = begin; @@ -39,11 +38,9 @@ public MediaPartial(String begin) { * Constructs a media partial object. * * @param begin - * The begin as formatted time in form of - * {@see org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} + * The begin as formatted time. * @param extent - * The extent as formatted time in form of - * {@see org.kitodo.production.helper.metadata.MediaPartialHelper#FORMATTED_TIME_PATTERN} + * The extent as formatted time. */ public MediaPartial(String begin, String extent) { this(begin);