mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
PublicPathを生成するメソッド作成
This commit is contained in:
parent
f7d07b0ec3
commit
da8d4fb4fc
|
@ -7,6 +7,7 @@ import one.nem.lacerta.model.ListItem;
|
||||||
import one.nem.lacerta.model.ListItemType;
|
import one.nem.lacerta.model.ListItemType;
|
||||||
|
|
||||||
import one.nem.lacerta.model.LibraryItemPage;
|
import one.nem.lacerta.model.LibraryItemPage;
|
||||||
|
import one.nem.lacerta.model.PublicPath;
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
|
|
||||||
public interface LacertaLibrary {
|
public interface LacertaLibrary {
|
||||||
|
@ -22,4 +23,7 @@ public interface LacertaLibrary {
|
||||||
// Create Folder
|
// Create Folder
|
||||||
CompletableFuture<String> createFolder(String path, String name);
|
CompletableFuture<String> createFolder(String path, String name);
|
||||||
|
|
||||||
|
// Get Public Path
|
||||||
|
CompletableFuture<PublicPath> getPublicPath(String itemId, ListItemType itemType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,16 +148,20 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
||||||
if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) {
|
if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) {
|
||||||
DocumentEntity documentEntity = database.documentDao().findById(itemId);
|
DocumentEntity documentEntity = database.documentDao().findById(itemId);
|
||||||
if (documentEntity == null) {
|
if (documentEntity == null) {
|
||||||
|
logger.warn("LacertaLibraryImpl", itemId + " is not found.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new PublicPath().resolve(documentEntity.publicPath);
|
PublicPath publicPath = recursiveResolve(documentEntity.parentId);
|
||||||
|
publicPath.resolve(documentEntity.title);
|
||||||
|
return publicPath;
|
||||||
} else if (itemType == ListItemType.ITEM_TYPE_FOLDER) {
|
} else if (itemType == ListItemType.ITEM_TYPE_FOLDER) {
|
||||||
FolderEntity folderEntity = database.folderDao().findById(itemId);
|
FolderEntity folderEntity = database.folderDao().findById(itemId);
|
||||||
if (folderEntity == null) {
|
if (folderEntity == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new PublicPath().resolve(folderEntity.publicPath);
|
return recursiveResolve(folderEntity.id);
|
||||||
} else {
|
} else {
|
||||||
|
logger.warn("LacertaLibraryImpl", "Unknown ListItemType: " + itemType);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user