mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
ファイル名の一覧からPageリストを作成するメソッド実装
This commit is contained in:
parent
8d4d9cab9a
commit
aa2ebce32c
|
@ -6,6 +6,7 @@ import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import one.nem.lacerta.model.document.DocumentMeta;
|
import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
|
import one.nem.lacerta.model.document.page.Page;
|
||||||
import one.nem.lacerta.model.document.path.DocumentPath;
|
import one.nem.lacerta.model.document.path.DocumentPath;
|
||||||
import one.nem.lacerta.model.document.tag.DocumentTag;
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
|
|
||||||
|
@ -25,4 +26,6 @@ public interface Document {
|
||||||
CompletableFuture<Void> updateDocument(DocumentDetail detail);
|
CompletableFuture<Void> updateDocument(DocumentDetail detail);
|
||||||
|
|
||||||
CompletableFuture<DocumentDetail> getDocument(String documentId);
|
CompletableFuture<DocumentDetail> getDocument(String documentId);
|
||||||
|
|
||||||
|
CompletableFuture<ArrayList<Page>> getDocumentPageListByFileNameList(String documentId, ArrayList<String> fileNameList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,34 @@ public class DocumentImpl implements Document {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<ArrayList<Page>> getDocumentPageListByFileNameList(String documentId, ArrayList<String> fileNameList) {
|
||||||
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
ArrayList<Page> pages = new ArrayList<>();
|
||||||
|
FileManager fileManager;
|
||||||
|
try {
|
||||||
|
fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory()).resolve(documentId).resolve("raw");
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(TAG, "FileManager resolve error");
|
||||||
|
logger.trace(TAG, e.getMessage());
|
||||||
|
logger.e_code("1210ae5b-dd2f-42ef-bc15-40b9a9bbdb16");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
fileNameList.forEach(fileName -> {
|
||||||
|
try {
|
||||||
|
pages.add(new Page(fileName, fileManager.loadBitmap(fileName)));
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(TAG, "Bitmap decode error");
|
||||||
|
logger.trace(TAG, e.getMessage());
|
||||||
|
logger.e_code("6f9ba0dc-ac63-401c-8f50-a2bd9ff5cb91");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return pages;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private CompletableFuture<ArrayList<XmlMetaPageModel>> getPagesByXmlMeta(String documentId) {
|
private CompletableFuture<ArrayList<XmlMetaPageModel>> getPagesByXmlMeta(String documentId) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());
|
FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user