diff options
author | desperateCoder <echotodevnull@gmail.com> | 2020-07-21 11:14:36 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2020-07-21 11:14:36 +0300 |
commit | 8dbe61e6bebcb3adea9073297edbbe1b7580e13f (patch) | |
tree | 7f60c4909733ef29920c949c75f1a21b530e9e00 /app/src/main/java/it/niedermann/nextcloud/deck/model | |
parent | 71067d3b765a7f6941a1254071208e2d3a044bea (diff) |
#573 Projects: read projects from DB properly
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/model')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/model/full/FullCard.java | 7 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/model/ocs/projects/full/OcsProjectWithResources.java | 49 |
2 files changed, 53 insertions, 3 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/model/full/FullCard.java b/app/src/main/java/it/niedermann/nextcloud/deck/model/full/FullCard.java index 905a8d5b8..1847c50b6 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/model/full/FullCard.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/model/full/FullCard.java @@ -21,6 +21,7 @@ import it.niedermann.nextcloud.deck.model.interfaces.IRemoteEntity; import it.niedermann.nextcloud.deck.model.ocs.comment.DeckComment; import it.niedermann.nextcloud.deck.model.ocs.projects.JoinCardWithProject; import it.niedermann.nextcloud.deck.model.ocs.projects.OcsProject; +import it.niedermann.nextcloud.deck.model.ocs.projects.full.OcsProjectWithResources; public class FullCard implements IRemoteEntity, DragAndDropModel { @@ -52,7 +53,7 @@ public class FullCard implements IRemoteEntity, DragAndDropModel { @Relation(entity = OcsProject.class, parentColumn = "localId", entityColumn = "localId", associateBy = @Junction(value = JoinCardWithProject.class, parentColumn = "cardId", entityColumn = "projectId")) - private List<OcsProject> projects = new ArrayList<>(); + private List<OcsProjectWithResources> projects = new ArrayList<>(); public FullCard() { super(); @@ -131,11 +132,11 @@ public class FullCard implements IRemoteEntity, DragAndDropModel { } @NonNull - public List<OcsProject> getProjects() { + public List<OcsProjectWithResources> getProjects() { return projects; } - public void setProjects(@NonNull List<OcsProject> projects) { + public void setProjects(@NonNull List<OcsProjectWithResources> projects) { this.projects.clear(); this.projects.addAll(projects); } diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/model/ocs/projects/full/OcsProjectWithResources.java b/app/src/main/java/it/niedermann/nextcloud/deck/model/ocs/projects/full/OcsProjectWithResources.java new file mode 100644 index 000000000..68cb8a2f1 --- /dev/null +++ b/app/src/main/java/it/niedermann/nextcloud/deck/model/ocs/projects/full/OcsProjectWithResources.java @@ -0,0 +1,49 @@ +package it.niedermann.nextcloud.deck.model.ocs.projects.full; + +import androidx.room.Embedded; +import androidx.room.Relation; + +import java.util.List; + +import it.niedermann.nextcloud.deck.model.interfaces.IRemoteEntity; +import it.niedermann.nextcloud.deck.model.ocs.projects.OcsProject; +import it.niedermann.nextcloud.deck.model.ocs.projects.OcsProjectResource; + +public class OcsProjectWithResources implements IRemoteEntity { + @Embedded + public OcsProject project; + + + @Relation(entity = OcsProjectResource.class, parentColumn = "localId", entityColumn = "projectId") + public List<OcsProjectResource> resources; + + public OcsProject getProject() { + return project; + } + + public void setProject(OcsProject project) { + this.project = project; + } + + @androidx.annotation.NonNull + public List<OcsProjectResource> getResources() { + return resources; + } + + public void setResources(List<OcsProjectResource> resources) { + this.resources = resources; + } + + public String getName() { + return project.getName(); + } + + public void setName(String name) { + project.setName(name); + } + + @Override + public IRemoteEntity getEntity() { + return project; + } +} |