mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
保存ロジック修正
This commit is contained in:
parent
5bb2f0d387
commit
f7b8006fa4
|
@ -8,6 +8,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import dagger.assisted.Assisted;
|
import dagger.assisted.Assisted;
|
||||||
import dagger.assisted.AssistedInject;
|
import dagger.assisted.AssistedInject;
|
||||||
|
import one.nem.lacerta.model.document.internal.XmlMetaPageModel;
|
||||||
import one.nem.lacerta.processor.DocumentProcessor;
|
import one.nem.lacerta.processor.DocumentProcessor;
|
||||||
|
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
|
@ -96,18 +97,19 @@ public class DocumentProcessorImpl implements DocumentProcessor{
|
||||||
@Override
|
@Override
|
||||||
public void addNewPageToLast(Bitmap bitmap) {
|
public void addNewPageToLast(Bitmap bitmap) {
|
||||||
logger.debug("addNewPageToLast", "called");
|
logger.debug("addNewPageToLast", "called");
|
||||||
String fileName = String.format(UUID.randomUUID().toString() + ".png"); // TODO-rca: 対応表をもたせる
|
String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする
|
||||||
logger.debug("addNewPageToLast", "fileName: " + fileName);
|
|
||||||
FileManager fileManager = fileManagerFactory.create(this.documentRootPath);
|
// FileManager
|
||||||
if(fileManager.getList().contains(this.documentRootPath.resolve(DEFAULT_SAVE_DIR))) {
|
this.fileManager.autoCreateDir(DEFAULT_SAVE_DIR);
|
||||||
logger.debug("addNewPageToLast", "raw dir found");
|
|
||||||
fileManager.changeDir(DEFAULT_SAVE_DIR);
|
// Save file
|
||||||
} else {
|
this.fileManager.saveBitmapAtCurrent(bitmap, filename);
|
||||||
logger.debug("addNewPageToLast", "raw dir not found");
|
|
||||||
fileManager.createDir(DEFAULT_SAVE_DIR);
|
// Update meta
|
||||||
fileManager.changeDir(DEFAULT_SAVE_DIR);
|
XmlMetaPageModel page = new XmlMetaPageModel();
|
||||||
}
|
page.setIndex(xmlMetaModel.getPages().size());
|
||||||
fileManager.saveBitmapAtCurrent(bitmap, fileName);
|
page.setFilename(filename);
|
||||||
|
xmlMetaModel.addPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user