mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 11:37:37 +00:00
Merge branch 'develop' into feature/home/add_document_history
# Conflicts: # data/src/main/java/one/nem/lacerta/data/Document.java # data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java
This commit is contained in:
commit
d07e63f534
144 files changed
+4276
-1110
No files matched your search
@@ -0,0 +1,51 @@
|
||||
package one.nem.lacerta.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LibraryItemPage {
|
||||
|
||||
String pageTitle;
|
||||
String pageId;
|
||||
ArrayList<ListItem> listItems;
|
||||
|
||||
// Constructor
|
||||
|
||||
public LibraryItemPage(String pageTitle, String pageId, ArrayList<ListItem> listItems) {
|
||||
this.pageTitle = pageTitle;
|
||||
this.pageId = pageId;
|
||||
this.listItems = listItems;
|
||||
}
|
||||
|
||||
public LibraryItemPage() {
|
||||
// Empty constructor
|
||||
}
|
||||
|
||||
// Getter
|
||||
|
||||
public String getPageTitle() {
|
||||
return pageTitle;
|
||||
}
|
||||
|
||||
public String getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public ArrayList<ListItem> getListItems() {
|
||||
return listItems;
|
||||
}
|
||||
|
||||
// Setter
|
||||
|
||||
public void setPageTitle(String pageTitle) {
|
||||
this.pageTitle = pageTitle;
|
||||
}
|
||||
|
||||
public void setPageId(String pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
|
||||
public void setListItems(ArrayList<ListItem> listItems) {
|
||||
this.listItems = listItems;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package one.nem.lacerta.model;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class ListItem {
|
||||
|
||||
// Properties
|
||||
|
||||
String title;
|
||||
String description;
|
||||
ListItemType itemType;
|
||||
String itemId;
|
||||
|
||||
// Constructor
|
||||
|
||||
public ListItem(String title, String description, ListItemType itemType, String itemId) {
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.itemType = itemType;
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public ListItem() {
|
||||
// Empty constructor
|
||||
}
|
||||
|
||||
// Getter
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public ListItemType getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
// Setter
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setItemType(ListItemType itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package one.nem.lacerta.model;
|
||||
|
||||
public enum ListItemType {
|
||||
|
||||
ITEM_TYPE_FOLDER(one.nem.lacerta.shared.ui.R.drawable.folder_24px),
|
||||
ITEM_TYPE_DOCUMENT(one.nem.lacerta.shared.ui.R.drawable.description_24px);
|
||||
|
||||
private int iconId;
|
||||
|
||||
ListItemType(int iconId) {
|
||||
this.iconId = iconId;
|
||||
}
|
||||
|
||||
public int getIconId() {
|
||||
return iconId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package one.nem.lacerta.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PublicPath {
|
||||
/*
|
||||
* ユーザーが扱うパス(内部パスの代替)
|
||||
* (時間がないのでInjectされることは考慮しない)
|
||||
*
|
||||
* TODO-rca:
|
||||
* - こわれたパスを検知する
|
||||
* - バリデーション
|
||||
*/
|
||||
|
||||
List<String> path = new ArrayList<String>();
|
||||
|
||||
public PublicPath() {
|
||||
}
|
||||
|
||||
public PublicPath(List<String> path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
private void add(String path) {
|
||||
this.path.add(path);
|
||||
}
|
||||
|
||||
private void resolveInternal(String path) {
|
||||
if (path.equals("..")) {
|
||||
this.path.remove(this.path.size() - 1);
|
||||
} else {
|
||||
add(path);
|
||||
}
|
||||
}
|
||||
|
||||
public PublicPath resolve(String path) {
|
||||
resolveInternal(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PublicPath resolve(List<String> path) {
|
||||
for (String p : path) {
|
||||
resolveInternal(p);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public PublicPath resolve(PublicPath path) {
|
||||
for (String p : path.getPath()) {
|
||||
resolveInternal(p);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public PublicPath parent() {
|
||||
this.path.remove(this.path.size() - 1);
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getStringPath() {
|
||||
return String.join("/", path);
|
||||
}
|
||||
|
||||
public PublicPath getRoot() {
|
||||
PublicPath root = new PublicPath();
|
||||
root.add("/");
|
||||
return root;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,14 @@ package one.nem.lacerta.model.document;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import one.nem.lacerta.model.document.path.DocumentPath;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
|
||||
import one.nem.lacerta.model.document.page.Page;
|
||||
|
||||
/**
|
||||
* ドキュメントの詳細データ
|
||||
*/
|
||||
@@ -19,31 +22,21 @@ public class DocumentDetail {
|
||||
DocumentMeta meta;
|
||||
|
||||
/**
|
||||
* ドキュメントのパス(DocumentPathインスタンス)
|
||||
* ドキュメントのページ(Pageインスタンスのリスト)
|
||||
*/
|
||||
DocumentPath path;
|
||||
|
||||
/**
|
||||
* ドキュメントの作者(String)
|
||||
*/
|
||||
String author;
|
||||
|
||||
/**
|
||||
* ドキュメントのデフォルトブランチ(String)
|
||||
*/
|
||||
String defaultBranch;
|
||||
|
||||
Repository repository;
|
||||
ArrayList<Page> pages;
|
||||
|
||||
// Constructor
|
||||
public DocumentDetail() {
|
||||
}
|
||||
|
||||
public DocumentDetail(DocumentMeta meta, DocumentPath path, String author, String defaultBranch) {
|
||||
public DocumentDetail(DocumentMeta meta) {
|
||||
this.meta = meta;
|
||||
this.path = path;
|
||||
this.author = author;
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
public DocumentDetail(DocumentMeta meta, ArrayList<Page> pages) {
|
||||
this.meta = meta;
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
// Getter
|
||||
@@ -56,34 +49,12 @@ public class DocumentDetail {
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのパス(DocumentPathインスタンス)を取得する
|
||||
* ドキュメントのページ(Pageインスタンスのリスト)を取得する
|
||||
*/
|
||||
public DocumentPath getPath() {
|
||||
return path;
|
||||
public ArrayList<Page> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントの作者(String)を取得する
|
||||
*/
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのデフォルトブランチ(String)を取得する
|
||||
*/
|
||||
public String getDefaultBranch() {
|
||||
return defaultBranch;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのリポジトリを取得する
|
||||
*/
|
||||
public Repository getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
// Setter
|
||||
|
||||
/**
|
||||
@@ -95,34 +66,11 @@ public class DocumentDetail {
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのパス(DocumentPathインスタンス)を設定する
|
||||
* @param path DocumentPathインスタンス
|
||||
* ドキュメントのページ(Pageインスタンスのリスト)を設定する
|
||||
* @param pages Pageインスタンスのリスト
|
||||
*/
|
||||
public void setPath(DocumentPath path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントの作者(String)を設定する
|
||||
* @param author ドキュメントの作者
|
||||
*/
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのデフォルトブランチ(String)を設定する
|
||||
* @param defaultBranch ドキュメントのデフォルトブランチ
|
||||
*/
|
||||
public void setDefaultBranch(String defaultBranch) {
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのリポジトリを設定する
|
||||
*/
|
||||
public void setRepository(Repository repository) {
|
||||
this.repository = repository;
|
||||
public void setPages(ArrayList<Page> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package one.nem.lacerta.model.document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import one.nem.lacerta.model.PublicPath;
|
||||
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -9,7 +11,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* ドキュメントのメタデータ
|
||||
*/
|
||||
public class DocumentMeta {
|
||||
public class DocumentMeta { // TODO-rca: JavaDoc対応
|
||||
/**
|
||||
* ドキュメントのID(String)
|
||||
*/
|
||||
@@ -35,42 +37,52 @@ public class DocumentMeta {
|
||||
*/
|
||||
List<DocumentTag> tags;
|
||||
|
||||
PublicPath path;
|
||||
|
||||
String author;
|
||||
|
||||
String defaultBranch;
|
||||
|
||||
// Constructor
|
||||
|
||||
public DocumentMeta() {
|
||||
}
|
||||
|
||||
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, List<DocumentTag> tags) { // With all
|
||||
public DocumentMeta(String title, List<DocumentTag> tags, String author, String defaultBranch) {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
this.title = title;
|
||||
this.tags = tags;
|
||||
this.author = author;
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
public DocumentMeta(String id, String title, List<DocumentTag> tags, String author, String defaultBranch) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.tags = tags;
|
||||
this.author = author;
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, List<DocumentTag> tags, String author, String defaultBranch) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.updatedAt = updatedAt;
|
||||
this.createdAt = createdAt;
|
||||
this.tags = tags;
|
||||
this.author = author;
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt) { // Without tags
|
||||
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, List<DocumentTag> tags, PublicPath path, String author, String defaultBranch) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.updatedAt = updatedAt;
|
||||
this.createdAt = createdAt;
|
||||
this.tags = new ArrayList<>();
|
||||
}
|
||||
|
||||
public DocumentMeta(String id, String title) { // Without tags, updatedAt, createdAt
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
// 現在時刻を設定
|
||||
this.updatedAt = new Date();
|
||||
this.createdAt = new Date();
|
||||
this.tags = new ArrayList<>();
|
||||
}
|
||||
|
||||
public DocumentMeta(String title) { // title only
|
||||
this.id = UUID.randomUUID().toString(); // 新規作成時想定なのでコンストラクタで生成してしまう(使う人が楽なので)
|
||||
this.title = title;
|
||||
// 現在時刻を設定
|
||||
this.updatedAt = new Date();
|
||||
this.createdAt = new Date();
|
||||
this.tags = new ArrayList<>();
|
||||
this.tags = tags;
|
||||
this.path = path;
|
||||
this.author = author;
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
// Getter
|
||||
@@ -121,6 +133,27 @@ public class DocumentMeta {
|
||||
return tagIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* PublicPathを取得する
|
||||
*/
|
||||
public PublicPath getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントの作者(String)を取得する
|
||||
*/
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのデフォルトブランチ(String)を取得する
|
||||
*/
|
||||
public String getDefaultBranch() {
|
||||
return defaultBranch;
|
||||
}
|
||||
|
||||
// Setter
|
||||
|
||||
/**
|
||||
@@ -163,6 +196,30 @@ public class DocumentMeta {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* PublicPathを設定する
|
||||
* @param path PublicPath
|
||||
*/
|
||||
public void setPath(PublicPath path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントの作者(String)を設定する
|
||||
* @param author ドキュメントの作者
|
||||
*/
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
/**
|
||||
* ドキュメントのデフォルトブランチ(String)を設定する
|
||||
* @param defaultBranch ドキュメントのデフォルトブランチ
|
||||
*/
|
||||
public void setDefaultBranch(String defaultBranch) {
|
||||
this.defaultBranch = defaultBranch;
|
||||
}
|
||||
|
||||
/**
|
||||
* updatedAtを現在時刻に設定する
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package one.nem.lacerta.model.document.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class XmlMetaModel {
|
||||
|
||||
String revisionId;
|
||||
|
||||
ArrayList<XmlMetaPageModel> pages;
|
||||
|
||||
// Constructor
|
||||
|
||||
public XmlMetaModel() {
|
||||
}
|
||||
|
||||
public XmlMetaModel(String revisionId, ArrayList<XmlMetaPageModel> pages) {
|
||||
this.revisionId = revisionId;
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
// Getter
|
||||
|
||||
public String getRevisionId() {
|
||||
return revisionId;
|
||||
}
|
||||
|
||||
public ArrayList<XmlMetaPageModel> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
// Setter
|
||||
|
||||
public void setRevisionId(String revisionId) {
|
||||
this.revisionId = revisionId;
|
||||
}
|
||||
|
||||
public void setPages(ArrayList<XmlMetaPageModel> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package one.nem.lacerta.model.document.internal;
|
||||
|
||||
public class XmlMetaPageModel {
|
||||
|
||||
String filename;
|
||||
|
||||
// Constructor
|
||||
|
||||
public XmlMetaPageModel() {
|
||||
}
|
||||
|
||||
public XmlMetaPageModel(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
// Getter
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
// Setter
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package one.nem.lacerta.model.document.page;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class Page {
|
||||
|
||||
String fileName;
|
||||
Bitmap bitmap;
|
||||
|
||||
// Constructor
|
||||
|
||||
public Page() {
|
||||
}
|
||||
|
||||
public Page(String fileName, Bitmap bitmap) {
|
||||
this.fileName = fileName;
|
||||
this.bitmap = bitmap;
|
||||
}
|
||||
|
||||
// Getter
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public Bitmap getBitmap() {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
// Setter
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public void setBitmap(Bitmap bitmap) {
|
||||
this.bitmap = bitmap;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user