From 647bec472d2a87005b5bd9280adf524b68f07884 Mon Sep 17 00:00:00 2001 From: Kathrin Huber Date: Tue, 18 May 2021 21:31:47 +0200 Subject: [PATCH 1/2] speed up migrationPage --- .../kitodo/production/migration/NewspaperProcessesMigrator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b91db33ff8a..b0e9a35fe99 100644 --- a/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java +++ b/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java @@ -237,7 +237,7 @@ private static boolean isNewspaperBatch(Batch batch) throws IOException { logger.trace("Examining batch {}...", batch.getTitle()); boolean newspaperBatch = true; for (Process process : batch.getProcesses()) { - if (!fileService.processOwnsYearXML(process)) { + if (!fileService.processOwnsYearXML(process, true)) { newspaperBatch = false; break; } From 2d885006cc7357d80989b775d47e88bd49096a4a Mon Sep 17 00:00:00 2001 From: Kathrin Huber Date: Wed, 19 May 2021 08:46:08 +0200 Subject: [PATCH 2/2] add review --- .../helper/tasks/HierarchyMigrationTask.java | 2 +- .../migration/NewspaperProcessesMigrator.java | 2 +- .../production/services/file/FileService.java | 26 ++----------------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/tasks/HierarchyMigrationTask.java b/Kitodo/src/main/java/org/kitodo/production/helper/tasks/HierarchyMigrationTask.java index 948520c92b9..d6db504c263 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/tasks/HierarchyMigrationTask.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/tasks/HierarchyMigrationTask.java @@ -146,7 +146,7 @@ public void run() { } while (progress < processesList.size()) { Process process = processService.getById(processesList.get(progress)); - if (fileService.processOwnsAnchorXML(process, true) && !fileService.processOwnsYearXML(process, true)) { + if (fileService.processOwnsAnchorXML(process) && !fileService.processOwnsYearXML(process)) { setWorkDetail(process.getTitle()); migrate(process); } 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 b0e9a35fe99..b91db33ff8a 100644 --- a/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java +++ b/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java @@ -237,7 +237,7 @@ private static boolean isNewspaperBatch(Batch batch) throws IOException { logger.trace("Examining batch {}...", batch.getTitle()); boolean newspaperBatch = true; for (Process process : batch.getProcesses()) { - if (!fileService.processOwnsYearXML(process, true)) { + if (!fileService.processOwnsYearXML(process)) { newspaperBatch = false; break; } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java b/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java index 899e0ea0035..da748098086 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java @@ -562,18 +562,7 @@ public void moveFile(URI sourceUri, URI targetUri) throws IOException { * if Io failed */ public boolean processOwnsAnchorXML(Process process) throws IOException { - return processOwnsAnchorXML(process, false); - } - - /** - * Process owns anchor XML. - * - * @param process whose metadata path to use - * @param forIndexingAll if method is triggerd from system/indexing page - * @return true if anchor file was found - */ - public boolean processOwnsAnchorXML(Process process, boolean forIndexingAll) throws IOException { - URI yearFile = createAnchorFile(getMetadataFilePath(process, false, forIndexingAll)); + URI yearFile = createAnchorFile(getMetadataFilePath(process, false, true)); return fileExist(yearFile); } @@ -587,18 +576,7 @@ public boolean processOwnsAnchorXML(Process process, boolean forIndexingAll) thr * if Io failed */ public boolean processOwnsYearXML(Process process) throws IOException { - return processOwnsYearXML(process, false); - } - - /** - * Process owns year XML. - * - * @param process whose metadata path to use - * @param forIndexingAll if method is triggerd from system/indexing page - * @return true if year file was found - */ - public boolean processOwnsYearXML(Process process, boolean forIndexingAll) throws IOException { - URI yearFile = createYearFile(getMetadataFilePath(process, false, forIndexingAll)); + URI yearFile = createYearFile(getMetadataFilePath(process, false, true)); return fileExist(yearFile); }