From 1accf47b14d1dcbc9728d7b10d7fceeaaa9aa0ce Mon Sep 17 00:00:00 2001 From: Thomas Schnaak <schnaak@uni-potsdam.de> Date: Wed, 30 May 2018 17:54:02 +0200 Subject: [PATCH] feat: added Interface and Model prototyp for learning Journal entry --- .../unipotsdam/gf/interfaces/IJournal.java | 63 +++++++++++++ .../gf/modules/journal/JournalEntry.java | 89 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java create mode 100644 gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/JournalEntry.java diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java new file mode 100644 index 00000000..af88032c --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java @@ -0,0 +1,63 @@ +package unipotsdam.gf.interfaces; + +import unipotsdam.gf.modules.journal.JournalEntry; + +/** + * Interface for learning journal entry + */ +public interface IJournal { + + /** + * Enum for visibility + */ + enum Visibility{ALL, STUDENT, DOZENT, NONE} + + + /** + * Add a new journal entry + * + * @param text text of the entry + * @param visibility visibility of the entry + */ + void addJournal(String text, Visibility visibility); + + /** + * Change an existing journal entry + * + * @param newText the new text + */ + void editJournal(String newText); + + /** + * Delete a journal entry + * + * @param journaId id of the entry + */ + void deleteJournal(long journaId); + + /** + * change visibility of an entry + * @param journaId id of the entry + * @param visibility new visibility + */ + void setVisibility(long journaId, Visibility visibility); + + /** + + * Get specific journal entry + * + * @param journaId id of the entry + * @return JournalEntry from database + */ + JournalEntry getJournal(long journaId); + + /** + * Get all JournalEntry for a project + * + * @param projectId id of project + * @return all JournalEnrys for that project + */ + JournalEntry getAllJournalEntrysProject(long projectId); + + +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/JournalEntry.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/JournalEntry.java new file mode 100644 index 00000000..496f0418 --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/JournalEntry.java @@ -0,0 +1,89 @@ +package unipotsdam.gf.modules.journal; + +import unipotsdam.gf.interfaces.IJournal; + +/** + * Prototype of JournalEntry Class + */ +public class JournalEntry { + + long id; + long owner; + long project; + long timestamp; + IJournal.Visibility visibility; + String text; + + + public JournalEntry() { + } + + public JournalEntry(long id, long owner, long project, long timestamp, IJournal.Visibility visibility, String text) { + this.id = id; + this.owner = owner; + this.project = project; + this.timestamp = timestamp; + this.visibility = visibility; + this.text = text; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getOwner() { + return owner; + } + + public void setOwner(long owner) { + this.owner = owner; + } + + public long getProject() { + return project; + } + + public void setProject(long project) { + this.project = project; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + public IJournal.Visibility getVisibility() { + return visibility; + } + + public void setVisibility(IJournal.Visibility visibility) { + this.visibility = visibility; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + @Override + public String toString() { + return "JournalEntry{" + + "id=" + id + + ", owner=" + owner + + ", project=" + project + + ", timestamp=" + timestamp + + ", visibility=" + visibility + + ", text='" + text + '\'' + + '}'; + } +} -- GitLab