From 0c59c85b28fdc614cbff2ed81e189dcce2fed351 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 9 Jan 2024 17:12:13 +0900 Subject: [PATCH] =?UTF-8?q?addNewPageBeforeIndex=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/impl/DocumentProcessorImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 23efa144..1eada540 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 @@ -143,12 +143,20 @@ public class DocumentProcessorImpl implements DocumentProcessor{ xmlMetaPageModel.setIndex(index + 1); xmlMetaModel.getPages().add(index, xmlMetaPageModel); xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages())); - } @Override - public void addNewPageBeforeIndex(Bitmap bitmap, int index) { + public void addNewPageBeforeIndex(Bitmap bitmap, int index) throws Exception { + logger.debug("addNewPageBeforeIndex", "called"); + String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする + this.fileManager.getNewInstance().createDirectoryIfNotExist(DEFAULT_SAVE_DIR).resolve(DEFAULT_SAVE_DIR).saveBitmap(bitmap, filename); + + XmlMetaPageModel xmlMetaPageModel = new XmlMetaPageModel(); + xmlMetaPageModel.setFilename(filename); + xmlMetaPageModel.setIndex(index); + xmlMetaModel.getPages().add(index - 1, xmlMetaPageModel); + xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages())); } @Override