mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 11:37:37 +00:00
パッケージ構成変更
This commit is contained in:
16 files changed
+40
-264
No files matched your search
@@ -1,15 +0,0 @@
|
||||
package one.nem.lacerta.source.db;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import one.nem.lacerta.source.db.dao.DocumentsDao;
|
||||
import one.nem.lacerta.source.db.dao.RepositoriesDao;
|
||||
import one.nem.lacerta.source.db.entity.Documents;
|
||||
import one.nem.lacerta.source.db.entity.Repositories;
|
||||
|
||||
@Database(entities = {Documents.class, Repositories.class}, version = 1)
|
||||
public abstract class LacertaDatabase extends RoomDatabase {
|
||||
public abstract DocumentsDao documentsDao();
|
||||
public abstract RepositoriesDao repositoriesDao();
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package one.nem.lacerta.source.db;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext;
|
||||
|
||||
public class RoomUtils {
|
||||
// Internal Utils
|
||||
|
||||
|
||||
|
||||
@Inject // TODO-rca: 実装を切り離す?
|
||||
RoomUtils(@ApplicationContext Context context) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package one.nem.lacerta.source.db;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.hilt.InstallIn;
|
||||
import dagger.hilt.components.SingletonComponent;
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent.class)
|
||||
abstract public class RoomUtilsModule {
|
||||
|
||||
@Binds
|
||||
public abstract RoomUtils bindRoomUtils(Context context);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package one.nem.lacerta.source.db.dao;
|
||||
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import one.nem.lacerta.source.db.entity.Documents;
|
||||
|
||||
@Dao
|
||||
public interface DocumentsDao {
|
||||
|
||||
@Query("SELECT * FROM documents")
|
||||
List<Documents> getAll();
|
||||
|
||||
@Query("SELECT * FROM documents WHERE id IN (:ids)")
|
||||
List<Documents> loadAllByIds(int[] ids);
|
||||
|
||||
@Query("SELECT * FROM documents WHERE title LIKE :title LIMIT 1")
|
||||
Documents findByTitle(String title);
|
||||
|
||||
@Query("SELECT * FROM documents WHERE id LIKE :id LIMIT 1")
|
||||
Documents findById(String id);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package one.nem.lacerta.source.db.dao;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import one.nem.lacerta.source.db.entity.Repositories;
|
||||
|
||||
@Dao
|
||||
public interface RepositoriesDao {
|
||||
|
||||
@Query("SELECT * FROM repositories")
|
||||
List<Repositories> getAll();
|
||||
|
||||
@Query("SELECT * FROM repositories WHERE id IN (:ids)")
|
||||
List<Repositories> loadAllByIds(int[] ids);
|
||||
|
||||
@Query("SELECT * FROM repositories WHERE relative_path LIKE :relativePath LIMIT 1")
|
||||
Repositories findByRelativePath(String relativePath);
|
||||
|
||||
@Query("SELECT * FROM repositories WHERE id LIKE :id LIMIT 1")
|
||||
Repositories findById(String id);
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,35 +0,0 @@
|
||||
package one.nem.lacerta.source.db.entity;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import one.nem.lacerta.data.model.documents.enums.DocumentType;
|
||||
|
||||
@Entity
|
||||
public class Documents {
|
||||
@PrimaryKey
|
||||
private String id;
|
||||
|
||||
@ColumnInfo(name = "title")
|
||||
private String title; // Titleに変更する?
|
||||
|
||||
@ColumnInfo(name = "type")
|
||||
private DocumentType type; // DocumentTypeに変更する?
|
||||
|
||||
@ColumnInfo(name = "created")
|
||||
private Date created;
|
||||
|
||||
@ColumnInfo(name = "updated")
|
||||
private Date updated;
|
||||
|
||||
@ColumnInfo(name = "tags")
|
||||
private String[] tags;
|
||||
|
||||
@ColumnInfo(name = "categories")
|
||||
private String[] categories;
|
||||
|
||||
// WIP
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package one.nem.lacerta.source.db.entity;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity
|
||||
public class Repositories {
|
||||
|
||||
@PrimaryKey
|
||||
private String id;
|
||||
|
||||
@ColumnInfo(name = "relative_path")
|
||||
private String relativePath;
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,52 +0,0 @@
|
||||
package one.nem.lacerta.source.jgit;
|
||||
|
||||
import org.eclipse.jgit.internal.storage.file.FileRepository;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import one.nem.lacerta.utils.repository.FileUtils;
|
||||
|
||||
public class RepoUtils {
|
||||
// Internal Utils
|
||||
|
||||
@Inject // TODO-rca: 実装を切り離す?
|
||||
RepoUtils() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
FileUtils fileUtils;
|
||||
|
||||
|
||||
public Repository createRepo(String id) {
|
||||
Path rootPath = fileUtils.getExternalFilesDirPath();
|
||||
|
||||
try {
|
||||
Repository repo = new FileRepositoryBuilder().setGitDir(rootPath.resolve(id).resolve(".git").toFile()).build();
|
||||
repo.create();
|
||||
return repo;
|
||||
} catch (Exception e) {
|
||||
// TODO-rca: handle exception
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public Repository getRepo(String id) {
|
||||
Path rootPath = fileUtils.getExternalFilesDirPath();
|
||||
try {
|
||||
Repository repo = new FileRepositoryBuilder().setGitDir(rootPath.resolve(id).resolve(".git").toFile()).build();
|
||||
return repo;
|
||||
} catch (Exception e) {
|
||||
// TODO-rca: handle exception
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public String getRepoName(Repository repo) {
|
||||
return repo.getDirectory().getParentFile().getName();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Whitespace-only changes.
Reference in new issue
Block a user