Compare commits

...
Author SHA1 Message Date
r-ca c49062618e DocumentPathを廃止 2024-01-14 15:52:41 +09:00
r-ca 000a26645e DocumentDetailのDocumentPathを廃止してPublicPathに置き換え 2024-01-14 15:48:33 +09:00
ろむねこ 5837a1a2d3 Merge pull request #63 from lacerta-doc/feature/add_vcs
VCS追加(WIP)
2024-01-14 15:39:10 +09:00
r-ca 176d8da59d Revert "Log一覧フラグメント実装WIP"
This reverts commit dc516bc083.
2024-01-14 15:19:36 +09:00
r-ca dc516bc083 Log一覧フラグメント実装WIP 2024-01-14 15:19:33 +09:00
r-ca 5c83c8fe13 リネーム 2024-01-14 15:18:08 +09:00
r-ca 200af1955b コミット漏れ 2024-01-14 15:10:07 +09:00
r-ca 951ee15235 コミット漏れ 2024-01-14 15:10:04 +09:00
r-ca 9a35c218b3 仮の実装を追加 2024-01-14 15:09:56 +09:00
r-ca 52894cf19c デバッグのためにデータベースの破壊を許可 2024-01-14 15:09:44 +09:00
r-ca 656d3a5964 DBバージョンのインクリメント 2024-01-14 15:09:31 +09:00
r-ca f95a2d64c3 アイテム追加 2024-01-14 14:57:27 +09:00
r-ca 92f9cfe4aa ビルドエラー回避のために一旦rootPathを戻した 2024-01-14 14:56:30 +09:00
r-ca 162f0a7bdb ビルドエラー修正 2024-01-14 14:54:12 +09:00
r-ca ba119fdb3d 壊れたインポートを削除 2024-01-14 14:53:47 +09:00
r-ca c711ad304b アノテーション修正 2024-01-14 14:53:35 +09:00
r-ca b2a619629f リネーム 2024-01-14 14:51:24 +09:00
r-ca a3426b6620 デバッグロジック実装 WIP 2024-01-14 14:01:43 +09:00
r-ca a9fb6283e7 依存関係追加 2024-01-14 13:59:53 +09:00
r-ca 6153e944eb レイアウト作成 WIP 2024-01-14 13:59:14 +09:00
r-ca a0baaf02cb WIP 2024-01-14 13:59:06 +09:00
r-ca 623be098d1 レイアウト変更 2024-01-14 13:56:30 +09:00
r-ca 999de728f0 メニューにアイテム追加 2024-01-14 13:55:40 +09:00
r-ca a032b9c1b1 ナビゲーショングラフ追加 2024-01-14 13:53:32 +09:00
r-ca 34de82cec3 引数削除など 2024-01-14 13:52:31 +09:00
r-ca fb4ba28391 引数削除など 2024-01-14 13:49:30 +09:00
r-ca 44baef8199 デバッグ用フラグメント作成 2024-01-14 13:48:52 +09:00
r-ca 60f86cd9a2 デバッグ用フラグメント作成 2024-01-14 13:48:22 +09:00
r-ca add140ad39 ナビゲーショングラフに追加 2024-01-14 13:46:22 +09:00
r-ca 4c40f9926e フラグメント作成, 引数関係を削除 2024-01-14 13:45:43 +09:00
r-ca f119264599 WIP 画面推移実装 2024-01-14 13:44:04 +09:00
r-ca 7f7e7d4af3 レイアウト修正 2024-01-14 13:43:09 +09:00
r-ca b99277082d 引数関係を削除 2024-01-14 13:40:25 +09:00
r-ca a6167b98af ナビゲーショングラフに追加 2024-01-14 13:34:30 +09:00
r-ca f75594233f デバッグ用フラグメント実装 WIP 2024-01-14 13:32:33 +09:00
r-ca 32ee755d08 Factory実装 WIP 2024-01-14 13:29:47 +09:00
r-ca 0758b697a2 Impl実装 WIP 2024-01-14 13:28:02 +09:00
r-ca 1abfcc1e62 依存関係にRoomを追加 2024-01-14 13:26:59 +09:00
r-ca a1b6ed81df VcsLogDao実装 2024-01-14 13:25:29 +09:00
r-ca 00a141a101 VcsRevDao実装 2024-01-14 13:23:48 +09:00
r-ca 6845e552ef Entity微修正 2024-01-14 13:22:28 +09:00
r-ca f98614c5f2 Implクラスコンストラクタ実装 WIP 2024-01-14 13:00:29 +09:00
r-ca b040e2572c Implクラス作成, Impl生成 2024-01-14 12:55:09 +09:00
r-ca 3eb94cade0 インタフェース実装 WIP 2024-01-14 12:54:29 +09:00
r-ca e9b7ad4d92 fromJson実装 WIP 2024-01-14 12:50:56 +09:00
r-ca e07cbda769 toJson実装 2024-01-14 12:48:54 +09:00
r-ca 80aeb8811b Action系のModelはActionBaseを継承するように 2024-01-14 12:40:46 +09:00
r-ca 2d7dfe1b5b ActionBaseを作成 2024-01-14 12:39:45 +09:00
r-ca 362eda782d 実装を後回しにする部分にコメントを追加 2024-01-14 12:30:44 +09:00
r-ca b51eeb50ac 一旦後回しにするので削除 2024-01-14 12:28:56 +09:00
r-ca 2673fb6bce 実装を後回しにする部分にコメントを追加 2024-01-14 12:28:02 +09:00
r-ca bb5c38cbca パッケージを間違えてたので修正 2024-01-14 12:27:28 +09:00
r-ca 3f4614cf6b CreateBranchモデル作成, コンストラクタ, Getter作成 2024-01-14 12:27:10 +09:00
r-ca dc65cdbac8 DeletePageモデル作成, コンストラクタ, Getter作成 2024-01-14 12:25:16 +09:00
r-ca dbbdda79f4 UpdatePageモデル作成, コンストラクタ, Getter作成 2024-01-14 12:24:46 +09:00
r-ca 20c0dbd371 InsertPageモデル作成, コンストラクタ, Getter作成 2024-01-14 12:23:23 +09:00
r-ca ccaed8387a パッケージ構成変更 2024-01-14 12:17:05 +09:00
r-ca bfb6bee14a modelを定義するパッケージ作成, placeholder 2024-01-14 12:15:48 +09:00
r-ca 3b283c1b05 依存関係にJacksonを追加 2024-01-14 12:08:46 +09:00
r-ca e718e13ed9 表記ゆれ修正 2024-01-14 12:05:53 +09:00
r-ca 8277258760 ActionTypes定義 WIP 2024-01-14 11:56:44 +09:00
r-ca 062e8c8bf9 Dao作成 WIP 2024-01-14 11:31:33 +09:00
r-ca 0439370bd0 Dao作成 WIP 2024-01-14 11:30:56 +09:00
r-ca 541b748501 Dao作成 WIP 2024-01-14 11:30:43 +09:00
r-ca 88546fe89a Databaseに追加 WIP 2024-01-14 11:29:58 +09:00
r-ca 53b3ebebef Rev実装 2024-01-14 11:28:51 +09:00
r-ca a7195c4079 Converter追加 2024-01-13 15:51:35 +09:00
r-ca e848f40b8b エンティティ実装 WIP 2024-01-13 15:51:09 +09:00
r-ca 578f1ef8a8 変更履歴を管理するEntity追加 2024-01-13 15:47:29 +09:00
r-ca fca44e1753 リビジョンを管理するエンティティ作成 2024-01-13 15:46:42 +09:00
r-ca da1dba5fda DBにパブリックパスを追加 2024-01-13 15:43:38 +09:00
r-ca c614230744 WIP 2024-01-13 15:42:51 +09:00
r-ca e5c3b3aa92 依存関係追加 2024-01-13 15:37:08 +09:00
r-ca 442ac4866a インタフェース作成 2024-01-13 15:36:42 +09:00
r-ca 8d00386f20 依存関係追加 2024-01-13 15:34:43 +09:00
r-ca 9a14b1db23 VCSモジュール作成 2024-01-13 15:33:54 +09:00
ろむねこ 385f2f327d Merge pull request #60 from lacerta-doc/model/public_path
PublicPathの追加
2024-01-13 15:20:45 +09:00
ろむねこ f09d35b8c0 Merge pull request #59 from lacerta-doc/data/add_search_stub
JavaDoc対応
2024-01-13 15:18:32 +09:00
r-ca 955e9fa6c8 JavaDoc対応 2024-01-13 14:59:54 +09:00
45 changed files with 966 additions and 20 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,6 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" /> <option name="gradleJvm" value="jbr-17" />
<option name="modules"> <option name="modules">
@@ -30,6 +29,7 @@
<option value="$PROJECT_DIR$/shared/ui" /> <option value="$PROJECT_DIR$/shared/ui" />
<option value="$PROJECT_DIR$/source" /> <option value="$PROJECT_DIR$/source" />
<option value="$PROJECT_DIR$/utils" /> <option value="$PROJECT_DIR$/utils" />
<option value="$PROJECT_DIR$/vcs" />
</set> </set>
</option> </option>
<option name="resolveExternalAnnotations" value="false" /> <option name="resolveExternalAnnotations" value="false" />
+2 -1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
@@ -116,7 +116,6 @@ public class DocumentImpl implements Document{
documentDetail.setMeta(documentMeta); documentDetail.setMeta(documentMeta);
documentDetail.setAuthor(documentEntity.author); documentDetail.setAuthor(documentEntity.author);
documentDetail.setPath(documentPath);
documentDetail.setDefaultBranch(documentEntity.defaultBranch); documentDetail.setDefaultBranch(documentEntity.defaultBranch);
return documentDetail; return documentDetail;
@@ -133,7 +132,6 @@ public class DocumentImpl implements Document{
documentDetail.setMeta(meta); documentDetail.setMeta(meta);
documentDetail.setAuthor("author"); // TODO-rca: SharedPrefを扱う機能を作ってそこから取得するようにする or Gitの設定を参照するようにする documentDetail.setAuthor("author"); // TODO-rca: SharedPrefを扱う機能を作ってそこから取得するようにする or Gitの設定を参照するようにする
documentDetail.setPath(new DocumentPath(deviceInfoUtils.getExternalStorageDirectoryString(), meta.getId()));
documentDetail.setDefaultBranch("master"); // TODO-rca: SharedPrefを扱う機能を作ってそこから取得するようにする? documentDetail.setDefaultBranch("master"); // TODO-rca: SharedPrefを扱う機能を作ってそこから取得するようにする?
return documentDetail; return documentDetail;
@@ -22,6 +22,12 @@ public class LacertaSearchStubImpl implements LacertaSearch {
this.logger = logger; this.logger = logger;
} }
/**
* 検索
* @param query 検索クエリ
* @param limit 最大取得件数
* @return 検索結果
*/
@Override @Override
public ArrayList<ListItem> autoSearch(String query, int limit) { public ArrayList<ListItem> autoSearch(String query, int limit) {
logger.debug("SearchStub", "autoSearch"); logger.debug("SearchStub", "autoSearch");
@@ -29,6 +35,13 @@ public class LacertaSearchStubImpl implements LacertaSearch {
return library.getLibraryPage(limit).getListItems(); return library.getLibraryPage(limit).getListItems();
} }
/**
* 検索
* @param query 検索クエリ
* @param limit 最大取得件数
* @param offset オフセット
* @return 検索結果
*/
@Override @Override
public ArrayList<ListItem> autoSearch(String query, int limit, int offset) { public ArrayList<ListItem> autoSearch(String query, int limit, int offset) {
logger.debug("SearchStub", "autoSearch"); logger.debug("SearchStub", "autoSearch");
+3
View File
@@ -68,4 +68,7 @@ dependencies {
// Processor // Processor
implementation project(':processor') implementation project(':processor')
// LacertaVcs
implementation project(':vcs')
} }
@@ -51,6 +51,7 @@ public class DebugMenuTopFragment extends Fragment {
debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true)); debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true)); debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Document List", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment, true)); debugMenuListItems.add(new DebugMenuListItem("Document List", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment, true));
debugMenuListItems.add(new DebugMenuListItem("VCS", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuVcsGeneralFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems); DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
@@ -0,0 +1,58 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsGeneralActionFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuVcsGeneralActionFragment extends Fragment {
@Inject
LacertaVcsFactory lacertaVcsFactory;
public DebugMenuVcsGeneralActionFragment() {
// Required empty public constructor
}
public static DebugMenuVcsGeneralActionFragment newInstance() {
DebugMenuVcsGeneralActionFragment fragment = new DebugMenuVcsGeneralActionFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_general_action, container, false);
view.findViewById(R.id.add_sample_log_rev_button).setOnClickListener(v -> {
LacertaVcs lacertaVcs = lacertaVcsFactory.create("example_id");
lacertaVcs.insertPage(1, "example_id");
});
return view;
}
}
@@ -0,0 +1,59 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsGeneralFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuVcsGeneralFragment extends Fragment {
public DebugMenuVcsGeneralFragment() {
// Required empty public constructor
}
public static DebugMenuVcsGeneralFragment newInstance() {
DebugMenuVcsGeneralFragment fragment = new DebugMenuVcsGeneralFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_general, container, false);
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
List<DebugMenuListItem> debugMenuListItems = new ArrayList<>();
debugMenuListItems.add(new DebugMenuListItem("General Action", "placeholder", R.id.action_debugMenuVcsGeneralFragment_to_debugMenuVcsGeneralActionFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Log Record", "placeholder", R.id.action_debugMenuVcsGeneralFragment_to_debugMenuVcsLogRecordFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Rev Record", "placeholder", R.id.action_debugMenuVcsGeneralFragment_to_debugMenuVcsRevRecordFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems);
recyclerView.setAdapter(adapter);
return view;
}
}
@@ -0,0 +1,42 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsLogRecordFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuVcsLogRecordFragment extends Fragment {
public DebugMenuVcsLogRecordFragment() {
// Required empty public constructor
}
public static DebugMenuVcsLogRecordFragment newInstance() {
DebugMenuVcsLogRecordFragment fragment = new DebugMenuVcsLogRecordFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_log_record, container, false);
return view;
}
}
@@ -0,0 +1,41 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsRevRecordFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuVcsRevRecordFragment extends Fragment {
public DebugMenuVcsRevRecordFragment() {
// Required empty public constructor
}
public static DebugMenuVcsRevRecordFragment newInstance() {
DebugMenuVcsRevRecordFragment fragment = new DebugMenuVcsRevRecordFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_rev_record, container, false);
return view;
}
}
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralActionFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/add_sample_log_rev_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Sample log/Rev" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/log_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rev_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -19,6 +19,9 @@
<action <action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment" android:id="@+id/action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment"
app:destination="@id/debugMenuLibraryItemListPageFragment" /> app:destination="@id/debugMenuLibraryItemListPageFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuVcsGeneralFragment"
app:destination="@id/debugMenuVcsGeneralFragment" />
</fragment> </fragment>
<fragment <fragment
android:id="@+id/debugMenuDocumentTesterTopFragment" android:id="@+id/debugMenuDocumentTesterTopFragment"
@@ -51,4 +54,34 @@
android:name="one.nem.lacerta.feature.debug.DebugMenuLibraryItemListPageFragment" android:name="one.nem.lacerta.feature.debug.DebugMenuLibraryItemListPageFragment"
android:label="fragment_debug_menu_library_item_list_page" android:label="fragment_debug_menu_library_item_list_page"
tools:layout="@layout/fragment_debug_menu_library_item_list_page" /> tools:layout="@layout/fragment_debug_menu_library_item_list_page" />
<fragment
android:id="@+id/debugMenuVcsGeneralFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsGeneralFragment"
android:label="fragment_debug_menu_vcs_general"
tools:layout="@layout/fragment_debug_menu_vcs_general" >
<action
android:id="@+id/action_debugMenuVcsGeneralFragment_to_debugMenuVcsGeneralActionFragment"
app:destination="@id/debugMenuVcsGeneralActionFragment" />
<action
android:id="@+id/action_debugMenuVcsGeneralFragment_to_debugMenuVcsRevRecordFragment"
app:destination="@id/debugMenuVcsRevRecordFragment" />
<action
android:id="@+id/action_debugMenuVcsGeneralFragment_to_debugMenuVcsLogRecordFragment"
app:destination="@id/debugMenuVcsLogRecordFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuVcsGeneralActionFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsGeneralActionFragment"
android:label="fragment_debug_menu_vcs_general_action"
tools:layout="@layout/fragment_debug_menu_vcs_general_action" />
<fragment
android:id="@+id/debugMenuVcsLogRecordFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsLogRecordFragment"
android:label="fragment_debug_menu_vcs_log_record"
tools:layout="@layout/fragment_debug_menu_vcs_log_record" />
<fragment
android:id="@+id/debugMenuVcsRevRecordFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsRevRecordFragment"
android:label="fragment_debug_menu_vcs_rev_record"
tools:layout="@layout/fragment_debug_menu_vcs_rev_record" />
</navigation> </navigation>
@@ -6,6 +6,7 @@ import java.nio.file.Path;
import java.util.Date; import java.util.Date;
import one.nem.lacerta.model.document.path.DocumentPath; import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.PublicPath;
import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentMeta;
/** /**
@@ -19,9 +20,9 @@ public class DocumentDetail {
DocumentMeta meta; DocumentMeta meta;
/** /**
* ドキュメントのパス(DocumentPathインスタンス) * ユーザーが扱うパス
*/ */
DocumentPath path; PublicPath publicPath;
/** /**
* ドキュメントの作者(String) * ドキュメントの作者(String)
@@ -39,9 +40,9 @@ public class DocumentDetail {
public DocumentDetail() { public DocumentDetail() {
} }
public DocumentDetail(DocumentMeta meta, DocumentPath path, String author, String defaultBranch) { public DocumentDetail(DocumentMeta meta, PublicPath publicPath, String author, String defaultBranch) {
this.meta = meta; this.meta = meta;
this.path = path; this.publicPath = publicPath;
this.author = author; this.author = author;
this.defaultBranch = defaultBranch; this.defaultBranch = defaultBranch;
} }
@@ -56,10 +57,10 @@ public class DocumentDetail {
} }
/** /**
* ドキュメントのパス(DocumentPathインスタンス)を取得する * ユーザーが扱うパスを取得する
*/ */
public DocumentPath getPath() { public PublicPath getPublicPath() {
return path; return publicPath;
} }
/** /**
@@ -95,11 +96,11 @@ public class DocumentDetail {
} }
/** /**
* ドキュメントのパス(DocumentPathインスタンス)を設定する * ユーザーが扱うパスを設定する
* @param path DocumentPathインスタンス * @param publicPath ユーザーが扱うパス
*/ */
public void setPath(DocumentPath path) { public void setPublicPath(PublicPath publicPath) {
this.path = path; this.publicPath = publicPath;
} }
/** /**
+1
View File
@@ -31,3 +31,4 @@ include ':model'
include ':processor' include ':processor'
include ':shared:ui' include ':shared:ui'
include ':shared:icon' include ':shared:icon'
include ':vcs'
@@ -7,15 +7,21 @@ import androidx.room.RoomDatabase;
import one.nem.lacerta.source.database.entity.TagEntity; import one.nem.lacerta.source.database.entity.TagEntity;
import one.nem.lacerta.source.database.entity.DocumentEntity; import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.LibraryEntity; import one.nem.lacerta.source.database.entity.LibraryEntity;
import one.nem.lacerta.source.database.entity.VcsRevEntity;
import one.nem.lacerta.source.database.entity.VcsLogEntity;
// Daos // Daos
import one.nem.lacerta.source.database.dao.TagDao; import one.nem.lacerta.source.database.dao.TagDao;
import one.nem.lacerta.source.database.dao.DocumentDao; import one.nem.lacerta.source.database.dao.DocumentDao;
import one.nem.lacerta.source.database.dao.LibraryDao; import one.nem.lacerta.source.database.dao.LibraryDao;
import one.nem.lacerta.source.database.dao.VcsRevDao;
import one.nem.lacerta.source.database.dao.VcsLogDao;
@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class}, version = 1) @Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class}, version = 2)
public abstract class LacertaDatabase extends RoomDatabase { public abstract class LacertaDatabase extends RoomDatabase {
public abstract TagDao tagDao(); public abstract TagDao tagDao();
public abstract DocumentDao documentDao(); public abstract DocumentDao documentDao();
public abstract LibraryDao libraryDao(); public abstract LibraryDao libraryDao();
public abstract VcsRevDao vcsRevDao();
public abstract VcsLogDao vcsLogDao();
} }
@@ -20,6 +20,8 @@ public class LacertaDatabaseModule {
LacertaDatabase.class, LacertaDatabase.class,
"lacerta.db") "lacerta.db")
.allowMainThreadQueries() // Debug .allowMainThreadQueries() // Debug
.fallbackToDestructiveMigration() // Debug Only: マイグレーションがない場合などにデータベースを再生成する
.fallbackToDestructiveMigrationOnDowngrade() // Debug Only: マイグレーションがない場合などにデータベースを再生成する
.build(); .build();
} }
} }
@@ -5,7 +5,7 @@ import androidx.room.TypeConverter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class TagArrayListConverter { public class ArrayListConverter {
@TypeConverter @TypeConverter
public static ArrayList<String> fromString(String value) { public static ArrayList<String> fromString(String value) {
@@ -0,0 +1,39 @@
package one.nem.lacerta.source.database.dao;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import java.util.List;
import one.nem.lacerta.source.database.entity.VcsLogEntity;
@Dao
public interface VcsLogDao {
// Select
@Query("SELECT * FROM vcs_log WHERE id = :id")
VcsLogEntity findById(String id);
@Query("SELECT * FROM vcs_log")
List<VcsLogEntity> findAll();
@Query("SELECT * FROM vcs_log WHERE id IN (:ids)")
List<VcsLogEntity> findByIds(List<String> ids);
@Query("SELECT * FROM vcs_log WHERE document_id = :documentId")
List<VcsLogEntity> findByDocumentId(String documentId);
// Insert
@Insert
void insertAll(VcsLogEntity... vcsLogs);
@Insert
void insertAll(List<VcsLogEntity> vcsLogs);
@Insert
void insert(VcsLogEntity vcsLog);
// TODO-rca: Update, Deleteが必要か検討
}
@@ -0,0 +1,44 @@
package one.nem.lacerta.source.database.dao;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import java.util.List;
import one.nem.lacerta.source.database.entity.VcsRevEntity;
@Dao
public interface VcsRevDao {
// Select
@Query("SELECT * FROM vcs_rev WHERE id = :id")
VcsRevEntity findById(String id);
@Query("SELECT * FROM vcs_rev")
List<VcsRevEntity> findAll();
@Query("SELECT * FROM vcs_rev WHERE id IN (:ids)")
List<VcsRevEntity> findByIds(List<String> ids);
@Query("SELECT * FROM vcs_rev WHERE document_id = :documentId")
List<VcsRevEntity> findByDocumentId(String documentId);
@Query("SELECT * FROM vcs_rev WHERE document_id = :documentId ORDER BY created_at DESC LIMIT 1")
VcsRevEntity findLatestByDocumentId(String documentId);
@Query("SELECT * FROM vcs_rev WHERE document_id = :documentId AND branch_name = :branchName ORDER BY created_at DESC LIMIT 1")
VcsRevEntity findLatestByDocumentIdAndBranchName(String documentId, String branchName);
@Insert
void insertAll(VcsRevEntity... vcsRevs);
@Insert
void insertAll(List<VcsRevEntity> vcsRevs);
@Insert
void insert(VcsRevEntity vcsRev);
// TODO-rca: Update, Deleteが必要か検討
}
@@ -8,7 +8,6 @@ import androidx.room.TypeConverter;
import androidx.room.TypeConverters; import androidx.room.TypeConverters;
import one.nem.lacerta.source.database.common.DateTypeConverter; import one.nem.lacerta.source.database.common.DateTypeConverter;
import one.nem.lacerta.source.database.common.TagArrayListConverter;
import one.nem.lacerta.source.database.common.TagListConverter; import one.nem.lacerta.source.database.common.TagListConverter;
import java.util.ArrayList; import java.util.ArrayList;
@@ -40,4 +39,7 @@ public class DocumentEntity {
@ColumnInfo(name = "tag_ids") @ColumnInfo(name = "tag_ids")
public List<String> tagIds; // タグ public List<String> tagIds; // タグ
@ColumnInfo(name = "public_path")
public String publicPath; // 公開パス
} }
@@ -16,10 +16,12 @@ public class LibraryEntity {
@NonNull @NonNull
public String id; // ドキュメントID public String id; // ドキュメントID
@ColumnInfo(name = "root_path") // TODO-rca: 廃止?
public String rootPath; // rootのパス
@ColumnInfo(name = "path") @ColumnInfo(name = "path")
public String path; // パス public String path; // パス
@ColumnInfo(name = "root_path")
public String rootPath; // ルートパス
} }
@@ -0,0 +1,48 @@
package one.nem.lacerta.source.database.entity;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;
import java.util.Date;
import one.nem.lacerta.source.database.common.DateTypeConverter;
@Entity(tableName = "vcs_log")
@TypeConverters({DateTypeConverter.class})
public class VcsLogEntity {
/**
* イベントID
*/
@PrimaryKey
@ColumnInfo(name = "id")
@NonNull
public String id;
/**
* ドキュメントID
*/
@ColumnInfo(name = "document_id")
public String documentId;
/**
* ブランチ名
*/
@ColumnInfo(name = "branch_name")
public String branchName;
/**
* 発生日時
*/
@ColumnInfo(name = "created_at")
public Date createdAt;
/**
* 発生アクション
*/
@ColumnInfo(name = "action")
public String action;
}
@@ -0,0 +1,58 @@
package one.nem.lacerta.source.database.entity;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import one.nem.lacerta.source.database.common.ArrayListConverter;
import one.nem.lacerta.source.database.common.DateTypeConverter;
@Entity(tableName = "vcs_rev")
@TypeConverters({DateTypeConverter.class, ArrayListConverter.class})
public class VcsRevEntity {
/**
* リビジョンID
*/
@PrimaryKey
@ColumnInfo(name = "id")
@NonNull
public String id;
/**
* ドキュメントID
*/
@ColumnInfo(name = "document_id")
public String documentId;
/**
* ブランチ名
*/
@ColumnInfo(name = "branch_name")
public String branchName;
/**
* コミットメッセージ
*/
@ColumnInfo(name = "commit_message")
public String commitMessage;
/**
* コミット日時
*/
@ColumnInfo(name = "created_at")
public Date createdAt;
/**
* 含まれるLogのID
*/
@ColumnInfo(name = "log_ids")
public ArrayList<String> logIds;
}
+1
View File
@@ -0,0 +1 @@
/build
+59
View File
@@ -0,0 +1,59 @@
plugins {
alias(libs.plugins.com.android.library)
}
android {
namespace 'one.nem.lacerta.vcs'
compileSdk 34
defaultConfig {
minSdk 26
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
// Hilt (DI)
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
implementation project(':model')
implementation project(':source')
implementation project(':utils')
// Jackson
// TODO-rca: バージョンカタログにうつす
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation 'com.fasterxml.jackson.core:jackson-core:2.16.1'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation 'com.fasterxml.jackson.core:jackson-databind:2.16.1'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.16.1'
// Room
implementation libs.androidx.room.runtime
annotationProcessor libs.androidx.room.compiler
}
View File
Whitespace-only changes.
+21
View File
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,26 @@
package one.nem.lacerta.vcs;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("one.nem.lacerta.vcs.test", appContext.getPackageName());
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
@@ -0,0 +1,48 @@
package one.nem.lacerta.vcs;
public enum ActionType {
INSERT_PAGE("insert_page"),
UPDATE_PAGE("update_page"),
DELETE_PAGE("delete_page"),
// TODO-rca: 実装----------------------------------------
UPDATE_PAGE_ORDER("update_page_order"),
INSERT_PAGE_CONTENT("insert_page_content"),
UPDATE_PAGE_CONTENT("update_page_content"),
DELETE_PAGE_CONTENT("delete_page_content"),
CREATE_BRANCH("create_branch"),
DROP_BRANCH("drop_branch"),
REBASE_BRANCH("rebase_branch"),
// -----------------------------------------------------
CREATE_DOCUMENT("create_document"),
DROP_DOCUMENT("drop_document"),
// TODO-rca: 実装----------------------------------------
UPDATE_DOCUMENT_META("update_document_meta"),
// -----------------------------------------------------
OTHER("other");
private final String value;
ActionType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static ActionType fromValue(String value) {
for (ActionType actionType : ActionType.values()) {
if (actionType.getValue().equals(value)) {
return actionType;
}
}
return ActionType.OTHER;
}
}
@@ -0,0 +1,15 @@
package one.nem.lacerta.vcs;
public interface LacertaVcs {
// Actions
public void updatePage(int index, String fileName);
public void insertPage(int index, String fileName);
public void deletePage(int index);
// debug
public void printLog();
}
@@ -0,0 +1,10 @@
package one.nem.lacerta.vcs.factory;
import dagger.assisted.AssistedFactory;
import one.nem.lacerta.vcs.impl.LacertaVcsImpl;
@AssistedFactory
public interface LacertaVcsFactory {
LacertaVcsImpl create(String documentId);
}
@@ -0,0 +1,62 @@
package one.nem.lacerta.vcs.impl;
import java.util.UUID;
import javax.inject.Inject;
import dagger.assisted.Assisted;
import dagger.assisted.AssistedInject;
import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.entity.VcsLogEntity;
import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.vcs.LacertaVcs;
public class LacertaVcsImpl implements LacertaVcs {
// TAG
private static final String TAG = LacertaVcsImpl.class.getSimpleName();
String documentId;
LacertaDatabase database;
LacertaLogger logger;
@AssistedInject
public LacertaVcsImpl(LacertaLogger logger, LacertaDatabase database, @Assisted String documentId) {
this.logger = logger;
this.database = database;
this.documentId = documentId;
logger.debug(TAG, "LacertaVcsImpl constructor");
}
@Override
public void updatePage(int index, String fileName) {
}
@Override
public void insertPage(int index, String fileName) {
logger.debug(TAG, "insertPage");
VcsLogEntity vcsLogEntity = new VcsLogEntity();
vcsLogEntity.id = UUID.randomUUID().toString();
vcsLogEntity.documentId = documentId;
vcsLogEntity.branchName = "master";
vcsLogEntity.createdAt = new java.util.Date();
vcsLogEntity.action = "placeholder";
database.vcsLogDao().insert(vcsLogEntity);
}
@Override
public void deletePage(int index) {
}
@Override
public void printLog() {
logger.debug(TAG, "printLog");
database.vcsLogDao().findAll().forEach(vcsLog -> {
logger.debug(TAG, vcsLog.id);
});
}
}
@@ -0,0 +1,65 @@
package one.nem.lacerta.vcs.internal;
import android.provider.ContactsContract;
import one.nem.lacerta.vcs.ActionType;
import one.nem.lacerta.vcs.model.action.DeletePage;
import one.nem.lacerta.vcs.model.action.InsertPage;
import one.nem.lacerta.vcs.model.action.UpdatePage;
import one.nem.lacerta.vcs.model.action.common.ActionBase;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonUtils {
// TODO-rca: Injectionで実装しなおす
// Public methods
public static String toJson(Object object) {
ActionBase converted;
if (object == null) {
return null;
} else if (object instanceof ActionBase) {
ObjectMapper mapper = new ObjectMapper();
switch (((ActionBase) object).getActionType()) {
case INSERT_PAGE:
converted = (InsertPage) object;
break;
case UPDATE_PAGE:
converted = (UpdatePage) object;
break;
case DELETE_PAGE:
converted = (DeletePage) object;
break;
default:
throw new IllegalArgumentException("Unknown action type");
}
try {
return mapper.writeValueAsString(converted);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
throw new IllegalArgumentException("Unknown object type");
}
public static Object fromJson(String json, ActionType actionType) {
ObjectMapper mapper = new ObjectMapper();
try {
switch (actionType) {
case INSERT_PAGE:
return mapper.readValue(json, InsertPage.class);
case UPDATE_PAGE:
return mapper.readValue(json, UpdatePage.class);
case DELETE_PAGE:
return mapper.readValue(json, DeletePage.class);
default:
throw new IllegalArgumentException("Unknown action type");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,19 @@
package one.nem.lacerta.vcs.model.action;
import one.nem.lacerta.vcs.model.action.common.ActionBase;
public class DeletePage extends ActionBase {
private int index;
public DeletePage() {
}
public DeletePage(int index) {
this.index = index;
}
public int getIndex() {
return index;
}
}
@@ -0,0 +1,25 @@
package one.nem.lacerta.vcs.model.action;
import one.nem.lacerta.vcs.model.action.common.ActionBase;
public class InsertPage extends ActionBase {
private int index;
private String fileName;
public InsertPage() {
}
public InsertPage(int index, String fileName) {
this.index = index;
this.fileName = fileName;
}
public int getIndex() {
return index;
}
public String getFileName() {
return fileName;
}
}
@@ -0,0 +1,25 @@
package one.nem.lacerta.vcs.model.action;
import one.nem.lacerta.vcs.model.action.common.ActionBase;
public class UpdatePage extends ActionBase {
private int index;
private String fileName;
public UpdatePage() {
}
public UpdatePage(int index, String fileName) {
this.index = index;
this.fileName = fileName;
}
public int getIndex() {
return index;
}
public String getFileName() {
return fileName;
}
}
@@ -0,0 +1,22 @@
package one.nem.lacerta.vcs.model.action.common;
import one.nem.lacerta.vcs.ActionType;
public class ActionBase {
private ActionType actionType;
public ActionBase() {
}
public ActionBase(ActionType actionType) {
this.actionType = actionType;
}
public ActionType getActionType() {
return actionType;
}
public void setActionType(ActionType actionType) {
this.actionType = actionType;
}
}
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,17 @@
package one.nem.lacerta.vcs;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}