From a78cac81787a90ee36eaae893172e1be302aa034 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 8 Jan 2024 12:29:24 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/impl/DocumentProcessorImpl.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java index 76fe5a54..59a7c291 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java +++ b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java @@ -31,6 +31,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{ private static final String DEFAULT_SAVE_DIR = "raw"; private DocumentDetail documentDetail; private XmlMetaModel xmlMetaModel; + private Path documentRootPath; // Injection private FileManagerFactory fileManagerFactory; @@ -50,13 +51,12 @@ public class DocumentProcessorImpl implements DocumentProcessor{ @Override public void init() { logger.debug("init", "called"); - Path path = documentDetail.getPath().getFullPath(); - logger.debug("init", "path: " + path.toString()); + // Init Variables + this.documentRootPath = documentDetail.getPath().getFullPath(); - FileManager fileManager = fileManagerFactory.create(path); //Initialize FileManager + FileManager fileManager = fileManagerFactory.create(this.documentRootPath); //Initialize FileManager - fileManager.changeDir(path); - fileManager.autoCreateToCurrentDir(); + fileManager.autoCreateDir(this.documentRootPath); // rawディレクトリInit fileManager.autoCreateDir(DEFAULT_SAVE_DIR); @@ -92,11 +92,10 @@ public class DocumentProcessorImpl implements DocumentProcessor{ @Override public void addNewPageToLast(Bitmap bitmap) { logger.debug("addNewPageToLast", "called"); - Path path = documentDetail.getPath().getFullPath(); String fileName = String.format(UUID.randomUUID().toString() + ".png"); // TODO-rca: 対応表をもたせる logger.debug("addNewPageToLast", "fileName: " + fileName); - FileManager fileManager = fileManagerFactory.create(path); - if(fileManager.getList().contains(path.resolve(DEFAULT_SAVE_DIR))) { + FileManager fileManager = fileManagerFactory.create(this.documentRootPath); + if(fileManager.getList().contains(this.documentRootPath.resolve(DEFAULT_SAVE_DIR))) { logger.debug("addNewPageToLast", "raw dir found"); fileManager.changeDir(DEFAULT_SAVE_DIR); } else {