diff --git a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java index 117e0c88..74bd1f1b 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java @@ -8,10 +8,6 @@ import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentDetail; -import one.nem.lacerta.model.document.path.DocumentPath; -import one.nem.lacerta.model.document.tag.DocumentTag; - -import one.nem.lacerta.source.database.entity.Document; import one.nem.lacerta.source.database.LacertaDatabase; diff --git a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java index 4909c922..68aea700 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java +++ b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java @@ -4,16 +4,16 @@ import androidx.room.Database; import androidx.room.RoomDatabase; // Entities -import one.nem.lacerta.source.database.entity.Tag; -import one.nem.lacerta.source.database.entity.Document; -import one.nem.lacerta.source.database.entity.Library; +import one.nem.lacerta.source.database.entity.TagEntity; +import one.nem.lacerta.source.database.entity.DocumentEntity; +import one.nem.lacerta.source.database.entity.LibraryEntity; // Daos import one.nem.lacerta.source.database.dao.TagDao; import one.nem.lacerta.source.database.dao.DocumentDao; import one.nem.lacerta.source.database.dao.LibraryDao; -@Database(entities = {Tag.class, Document.class, Library.class}, version = 1) +@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class}, version = 1) public abstract class LacertaDatabase extends RoomDatabase { public abstract TagDao tagDao(); public abstract DocumentDao documentDao(); diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java index f744f160..6503d67e 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java @@ -8,7 +8,7 @@ import androidx.room.Update; import java.util.List; -import one.nem.lacerta.source.database.entity.Document; +import one.nem.lacerta.source.database.entity.DocumentEntity; @Dao @@ -16,46 +16,46 @@ public interface DocumentDao { // Select - @Query("SELECT * FROM document WHERE id = :id") - Document findById(String id); + @Query("SELECT * FROM DocumentEntity WHERE id = :id") + DocumentEntity findById(String id); - @Query("SELECT * FROM document") - List findAll(); + @Query("SELECT * FROM DocumentEntity") + List findAll(); - @Query("SELECT * FROM document WHERE id IN (:ids)") - List findByIds(List ids); + @Query("SELECT * FROM DocumentEntity WHERE id IN (:ids)") + List findByIds(List ids); // Insert @Insert - void insert(Document document); + void insert(DocumentEntity document); @Insert - void insertAll(Document... documents); + void insertAll(DocumentEntity... documents); @Insert - void insertAll(List documents); + void insertAll(List documents); // Update @Update - void update(Document document); + void update(DocumentEntity document); @Update - void updateAll(Document... documents); + void updateAll(DocumentEntity... documents); @Update - void updateAll(List documents); + void updateAll(List documents); // Delete @Delete - void delete(Document document); + void delete(DocumentEntity document); @Delete - void deleteAll(Document... documents); + void deleteAll(DocumentEntity... documents); @Delete - void deleteAll(List documents); + void deleteAll(List documents); - @Query("DELETE FROM document WHERE id = :id") + @Query("DELETE FROM DocumentEntity WHERE id = :id") void deleteById(String id); } diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/LibraryDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/LibraryDao.java index 87a05162..ddb74188 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/LibraryDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/LibraryDao.java @@ -5,19 +5,19 @@ import androidx.room.Query; import java.util.List; -import one.nem.lacerta.source.database.entity.Library; +import one.nem.lacerta.source.database.entity.LibraryEntity; @Dao public interface LibraryDao { - @Query("SELECT * FROM library WHERE id = :id") - Library findById(String id); + @Query("SELECT * FROM LibraryEntity WHERE id = :id") + LibraryEntity findById(String id); - @Query("SELECT * FROM library") - List findAll(); + @Query("SELECT * FROM LibraryEntity") + List findAll(); - @Query("SELECT * FROM library WHERE id IN (:ids)") - List findByIds(List ids); + @Query("SELECT * FROM LibraryEntity WHERE id IN (:ids)") + List findByIds(List ids); // WIP // TODO-rca: Insert, Update, Delete diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java index 125bc4f3..850d22ec 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java @@ -8,52 +8,52 @@ import androidx.room.Update; import java.util.List; -import one.nem.lacerta.source.database.entity.Tag; +import one.nem.lacerta.source.database.entity.TagEntity; @Dao public interface TagDao { // Select - @Query("SELECT * FROM tag WHERE id = :id") - Tag findById(String id); + @Query("SELECT * FROM TagEntity WHERE id = :id") + TagEntity findById(String id); - @Query("SELECT * FROM tag") - List findAll(); + @Query("SELECT * FROM TagEntity") + List findAll(); - @Query("SELECT * FROM tag WHERE id IN (:ids)") - List findByIds(List ids); + @Query("SELECT * FROM TagEntity WHERE id IN (:ids)") + List findByIds(List ids); // Insert @Insert - void insert(Tag tag); + void insert(TagEntity tag); @Insert - void insertAll(Tag... tags); + void insertAll(TagEntity... tags); @Insert - void insertAll(List tags); + void insertAll(List tags); // Update @Update - void update(Tag tag); + void update(TagEntity tag); @Update - void updateAll(Tag... tags); + void updateAll(TagEntity... tags); @Update - void updateAll(List tags); + void updateAll(List tags); // Delete @Delete - void delete(Tag tag); + void delete(TagEntity tag); @Delete - void deleteAll(Tag... tags); + void deleteAll(TagEntity... tags); @Delete - void deleteAll(List tags); + void deleteAll(List tags); - @Query("DELETE FROM tag WHERE id = :id") + @Query("DELETE FROM TagEntity WHERE id = :id") void deleteById(String id); } diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/Document.java b/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java similarity index 96% rename from source/src/main/java/one/nem/lacerta/source/database/entity/Document.java rename to source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java index 528070ab..60a4a162 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/Document.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java @@ -12,7 +12,7 @@ import java.util.Date; @Entity(tableName = "document") @TypeConverters(DateTypeConverter.class) -public class Document { +public class DocumentEntity { @PrimaryKey @ColumnInfo(name = "id") @NonNull diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/Library.java b/source/src/main/java/one/nem/lacerta/source/database/entity/LibraryEntity.java similarity index 94% rename from source/src/main/java/one/nem/lacerta/source/database/entity/Library.java rename to source/src/main/java/one/nem/lacerta/source/database/entity/LibraryEntity.java index 34cb7e1c..2fff1b57 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/Library.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/LibraryEntity.java @@ -6,7 +6,7 @@ import androidx.room.Entity; import androidx.room.PrimaryKey; @Entity(tableName = "library") -public class Library { +public class LibraryEntity { @PrimaryKey @ColumnInfo(name = "id") diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/Tag.java b/source/src/main/java/one/nem/lacerta/source/database/entity/TagEntity.java similarity index 94% rename from source/src/main/java/one/nem/lacerta/source/database/entity/Tag.java rename to source/src/main/java/one/nem/lacerta/source/database/entity/TagEntity.java index c34be882..ff7e9a82 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/Tag.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/TagEntity.java @@ -6,7 +6,7 @@ import androidx.room.Entity; import androidx.room.PrimaryKey; @Entity(tableName = "tag") -public class Tag { +public class TagEntity { @PrimaryKey @ColumnInfo(name = "id")