Skip to content
Snippets Groups Projects
Commit 2d2485be authored by Martin Staehr's avatar Martin Staehr
Browse files

#143 #138 adding reflexion question catalog and learning goal catalog

to database initialization process
parent 712668b6
No related branches found
No related tags found
No related merge requests found
Showing
with 355 additions and 14 deletions
package unipotsdam.gf.modules.reflection.model;
public class LearningGoalStoreItem {
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
package unipotsdam.gf.modules.reflection.model;
public class ReflectionQuestionsStoreItem {
private String question;
private String learningGoal;
public String getId() {
return question + learningGoal;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getLearningGoal() {
return learningGoal;
}
public void setLearningGoal(String learningGoal) {
this.learningGoal = learningGoal;
}
}
package unipotsdam.gf.modules.reflection.service;
import unipotsdam.gf.modules.reflection.model.LearningGoalStoreItem;
import unipotsdam.gf.mysql.MysqlConnect;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
@ManagedBean
public class LearningGoalStoreDAO {
private MysqlConnect connection;
@Inject
public LearningGoalStoreDAO(MysqlConnect connection) {
this.connection = connection;
}
public void persist(LearningGoalStoreItem learningGoal) {
connection.connect();
String query = "INSERT INTO learninggoalstore(text) VALUES (?)";
connection.issueInsertOrDeleteStatement(query, learningGoal.getText());
connection.close();
}
}
package unipotsdam.gf.modules.reflection.service;
import unipotsdam.gf.modules.reflection.model.ReflectionQuestionsStoreItem;
import unipotsdam.gf.mysql.MysqlConnect;
import javax.inject.Inject;
public class ReflectionQuestionsStoreDAO {
private MysqlConnect connection;
@Inject
public ReflectionQuestionsStoreDAO(MysqlConnect connection) {
this.connection = connection;
}
public void persist(ReflectionQuestionsStoreItem item) {
connection.connect();
String query = "INSERT INTO reflectionquestionsstore(id,question,learningGoal) VALUES (?,?,?)";
connection.issueInsertOrDeleteStatement(query, item.getId(), item.getQuestion(), item.getLearningGoal());
connection.close();
}
}
package unipotsdam.gf.core.database;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import unipotsdam.gf.modules.reflection.model.LearningGoalStoreItem;
import unipotsdam.gf.modules.reflection.model.ReflectionQuestionsStoreItem;
import unipotsdam.gf.modules.reflection.service.LearningGoalStoreDAO;
import unipotsdam.gf.modules.reflection.service.ReflectionQuestionsStoreDAO;
import unipotsdam.gf.mysql.MysqlConnect;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class PredefinedDataInsertionHelper {
private MysqlConnect connection;
public PredefinedDataInsertionHelper(MysqlConnect connection) {
this.connection = connection;
}
public void saveLearningGoals(String fileName) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
InputStream inputStream = new FileInputStream(fileName);
List<LearningGoalStoreItem> learningGoalStoreItems = objectMapper.readValue(inputStream, new TypeReference<List<LearningGoalStoreItem>>() {
});
LearningGoalStoreDAO learningGoalStoreDAO = new LearningGoalStoreDAO(connection);
learningGoalStoreItems.forEach(learningGoalStoreDAO::persist);
}
public void saveReflecionQuestions(String fileName) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
InputStream inputStream = new FileInputStream(fileName);
List<ReflectionQuestionsStoreItem> items = objectMapper.readValue(inputStream, new TypeReference<List<ReflectionQuestionsStoreItem>>() {
});
ReflectionQuestionsStoreDAO storeDAO = new ReflectionQuestionsStoreDAO(connection);
items.forEach(storeDAO::persist);
}
}
...@@ -4,8 +4,16 @@ import ch.vorburger.exec.ManagedProcessException; ...@@ -4,8 +4,16 @@ import ch.vorburger.exec.ManagedProcessException;
import unipotsdam.gf.mysql.MysqlConnect; import unipotsdam.gf.mysql.MysqlConnect;
import unipotsdam.gf.mysql.MysqlConnectImpl; import unipotsdam.gf.mysql.MysqlConnectImpl;
import java.io.*; import java.io.FileReader;
import java.sql.*; import java.io.IOException;
import java.io.LineNumberReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
public class UpdateDB { public class UpdateDB {
...@@ -32,6 +40,10 @@ public class UpdateDB { ...@@ -32,6 +40,10 @@ public class UpdateDB {
System.out.println(new java.io.File( "." ).getCanonicalPath()); System.out.println(new java.io.File( "." ).getCanonicalPath());
updateDB.runScript(new FileReader("src/test/resources/database/db.sql")); updateDB.runScript(new FileReader("src/test/resources/database/db.sql"));
updateDB.runScript(new FileReader("src/test/resources/database/fltrail.sql")); updateDB.runScript(new FileReader("src/test/resources/database/fltrail.sql"));
MysqlConnectImpl mysqlConnectImpl = new MysqlConnectImpl();
PredefinedDataInsertionHelper dataInsertionHelper = new PredefinedDataInsertionHelper(mysqlConnectImpl);
dataInsertionHelper.saveLearningGoals("src/test/resources/reflectionQuestions/learningGoalsStore.json");
dataInsertionHelper.saveReflecionQuestions("src/test/resources/reflectionQuestions/reflectionQuestionsStore.json");
//updateDB.runScript(new FileReader("src/test/resources/database/testuser.sql")); //updateDB.runScript(new FileReader("src/test/resources/database/testuser.sql"));
} }
......
...@@ -91,13 +91,13 @@ CREATE TABLE `categoriesselected` ...@@ -91,13 +91,13 @@ CREATE TABLE `categoriesselected`
CREATE TABLE `contributionfeedback` CREATE TABLE `contributionfeedback`
( (
`id` varchar(120) CHARACTER SET utf8 NOT NULL, `id` varchar(120) NOT NULL,
`fullsubmissionId` varchar(120) CHARACTER SET utf8 DEFAULT NULL, `fullsubmissionId` varchar(120) DEFAULT NULL,
`fullSubmissionPartCategory` varchar(120) CHARACTER SET utf8 DEFAULT NULL, `fullSubmissionPartCategory` varchar(120) DEFAULT NULL,
`text` mediumtext CHARACTER SET utf8, `text` mediumtext,
`groupId` int(11) NOT NULL `groupId` int(11) NOT NULL
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = uft8 COMMENT ='This table saves feedback for contributions'; DEFAULT CHARSET = utf8 COMMENT ='This table saves feedback for contributions';
-- -------------------------------------------------------- -- --------------------------------------------------------
...@@ -232,6 +232,18 @@ CREATE TABLE `largefilestorage` ...@@ -232,6 +232,18 @@ CREATE TABLE `largefilestorage`
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `learninggoalstore`
--
CREATE TABLE `learninggoalstore`
(
`text` varchar(400) NOT NULL
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='saves predefined learning goals';
-- --------------------------------------------------------
-- --
-- Tabellenstruktur für Tabelle `mappedtasks` -- Tabellenstruktur für Tabelle `mappedtasks`
-- --
...@@ -445,17 +457,31 @@ CREATE TABLE `quiz` ...@@ -445,17 +457,31 @@ CREATE TABLE `quiz`
CREATE TABLE `reflectionquestions` CREATE TABLE `reflectionquestions`
( (
`id` varchar(400) CHARACTER SET utf8 NOT NULL, `id` varchar(400) NOT NULL,
`learningGoalId` varchar(400) CHARACTER SET utf8 NOT NULL, `learningGoalId` varchar(400) NOT NULL,
`question` varchar(400) CHARACTER SET utf8 NOT NULL, `question` varchar(400) NOT NULL,
`userEmail` varchar(255) CHARACTER SET utf8 NOT NULL, `userEmail` varchar(255) NOT NULL,
`fullSubmissionId` varchar(120) CHARACTER SET utf8 DEFAULT NULL, `fullSubmissionId` varchar(120) DEFAULT NULL,
`projectName` varchar(100) CHARACTER SET utf8 NOT NULL `projectName` varchar(100) NOT NULL
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='holds all reflection questions students have to answer or had answered'; DEFAULT CHARSET = utf8 COMMENT ='holds all reflection questions students have to answer or had answered';
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `reflectionquestionsstore`
--
CREATE TABLE `reflectionquestionsstore`
(
`id` varchar(400) NOT NULL,
`question` varchar(400) NOT NULL,
`learningGoal` varchar(400) NOT NULL
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='holds all predefined reflection questions.';
-- --------------------------------------------------------
-- --
-- Tabellenstruktur für Tabelle `submissionpartbodyelements` -- Tabellenstruktur für Tabelle `submissionpartbodyelements`
-- --
...@@ -663,6 +689,13 @@ ALTER TABLE `largefilestorage` ...@@ -663,6 +689,13 @@ ALTER TABLE `largefilestorage`
ADD KEY `largefilestorage_projects_name_fk` (`projectName`), ADD KEY `largefilestorage_projects_name_fk` (`projectName`),
ADD KEY `largefilestorage_users_email_fk` (`userEmail`); ADD KEY `largefilestorage_users_email_fk` (`userEmail`);
--
-- Indizes für die Tabelle `learninggoalstore`
--
ALTER TABLE `learninggoalstore`
ADD PRIMARY KEY (`text`),
ADD UNIQUE KEY `learningGoalStore_text_uindex` (`text`);
-- --
-- Indizes für die Tabelle `mappedtasks` -- Indizes für die Tabelle `mappedtasks`
-- --
...@@ -738,6 +771,13 @@ ALTER TABLE `reflectionquestions` ...@@ -738,6 +771,13 @@ ALTER TABLE `reflectionquestions`
ADD KEY `reflexionquestions_users_email_fk` (`userEmail`), ADD KEY `reflexionquestions_users_email_fk` (`userEmail`),
ADD KEY `reflexionquestions_projects_name_fk` (`projectName`); ADD KEY `reflexionquestions_projects_name_fk` (`projectName`);
--
-- Indizes für die Tabelle `reflectionquestionsstore`
--
ALTER TABLE `reflectionquestionsstore`
ADD PRIMARY KEY (`id`),
ADD KEY `reflectionquestionsstore_learninggoalstore_text_fk` (`learningGoal`);
-- --
-- Indizes für die Tabelle `submissionpartbodyelements` -- Indizes für die Tabelle `submissionpartbodyelements`
-- --
...@@ -956,6 +996,12 @@ ALTER TABLE `reflectionquestions` ...@@ -956,6 +996,12 @@ ALTER TABLE `reflectionquestions`
ADD CONSTRAINT `reflexionquestions_projects_name_fk` FOREIGN KEY (`projectName`) REFERENCES `projects` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `reflexionquestions_projects_name_fk` FOREIGN KEY (`projectName`) REFERENCES `projects` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `reflexionquestions_users_email_fk` FOREIGN KEY (`userEmail`) REFERENCES `users` (`email`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `reflexionquestions_users_email_fk` FOREIGN KEY (`userEmail`) REFERENCES `users` (`email`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints der Tabelle `reflectionquestionsstore`
--
ALTER TABLE `reflectionquestionsstore`
ADD CONSTRAINT `reflectionquestionsstore_learninggoalstore_text_fk` FOREIGN KEY (`learningGoal`) REFERENCES `learninggoalstore` (`text`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `surveyitemsselected` -- Constraints der Tabelle `surveyitemsselected`
-- --
......
[
{
"text": "S. können das Anwendungspotential reflektieren"
},
{
"text": "S. können methodische Grenzen reflektieren"
},
{
"text": "S. können den wissenschaftlichen Ertrag reflektieren"
},
{
"text": "S. können Forschungsergebnisse darstellen"
},
{
"text": "S. wählen eine passende Forschungsmethode"
},
{
"text": "S. erstellen wissenschaftliche Fragestellungen"
},
{
"text": "S. können Aufgaben untereinander aufteilen"
},
{
"text": "S. sich in einer Gruppe absprechen"
},
{
"text": "S. können recherchierte Literatur beurteilen"
},
{
"text": "S. können mit fachspezifischen Datenbanken umgehen"
},
{
"text": "S. können Mindmaps erstellen"
},
{
"text": "S. können ihre Ideen niederschreiben"
},
{
"text": "S. können ihre Gedanken sortieren"
}
]
\ No newline at end of file
[
{
"question": "Wie lassen sich die Ergebnisse auf andere Bereiche übertragen?",
"learningGoal": "S. können das Anwendungspotential reflektieren"
},
{
"question": "Welche Schwierigkeiten ergaben sich beim Forschungsprozess?",
"learningGoal": "S. können methodische Grenzen reflektieren"
},
{
"question": "Was bringen uns die Ergebnisse?",
"learningGoal": "S. können den wissenschaftlichen Ertrag reflektieren"
},
{
"question": "Entspricht der Bericht wissenschaftlichen Formalia?",
"learningGoal": "S. können Forschungsergebnisse darstellen"
},
{
"question": "Ist die Präsentation gut aufgebaut?",
"learningGoal": "S. können Forschungsergebnisse darstellen"
},
{
"question": "Ist ein roter Faden erkennbar?",
"learningGoal": "S. können Forschungsergebnisse darstellen"
},
{
"question": "Welche Themen konnte ich aufgreifen/Welche Aspekte bleiben offen?",
"learningGoal": "S. können Forschungsergebnisse darstellen"
},
{
"question": "Ist die Darstellung übersichtlich und verständlich?",
"learningGoal": "S. können Forschungsergebnisse darstellen"
},
{
"question": "Inwiefern lässt sich anhand der Ergebnisse die Forschungsfrage beantworten?",
"learningGoal": "S. können Forschungsergebnisse darstellen"
},
{
"question": "Ist diese Methode mit den verfügbaren Mitteln zu realiseren?",
"learningGoal": "S. wählen eine passende Forschungsmethode"
},
{
"question": "Sind die Methoden dazu adäquat?",
"learningGoal": "S. wählen eine passende Forschungsmethode"
},
{
"question": "Kann ich diese Frage mit den mir verfügbaren Mitteln beantworten?",
"learningGoal": "S. wählen eine passende Forschungsmethode"
},
{
"question": "Ist die Fragestellung für das Thema relevant?",
"learningGoal": "S. erstellen wissenschaftliche Fragestellungen"
},
{
"question": "Kann ich diese Frage mit den mir verfügbaren Mitteln beantworten?",
"learningGoal": "S. erstellen wissenschaftliche Fragestellungen"
},
{
"question": "Eine letzte Frage?",
"learningGoal": "S. können Aufgaben untereinander aufteilen"
},
{
"question": "Können Abgabefristen eingehalten werden?",
"learningGoal": "S. können Aufgaben untereinander aufteilen"
},
{
"question": "Ist ein roter Faden erkennbar?",
"learningGoal": "S. können Aufgaben untereinander aufteilen"
},
{
"question": "Ist die Verteilung der Aufgaben gerecht?",
"learningGoal": "S. können Aufgaben untereinander aufteilen"
},
{
"question": "Sind die Interessen aller Gruppenmitglieder mehr oder minder berücksichtigt?",
"learningGoal": "S. sich in einer Gruppe absprechen"
},
{
"question": "Sind Widersprüche zu erkennen?",
"learningGoal": "S. können recherchierte Literatur beurteilen"
},
{
"question": "Sind meine Ressourcen inhaltlich relevant?",
"learningGoal": "S. können recherchierte Literatur beurteilen"
},
{
"question": "Verwende ich seriöse, zitierfähige Quellen?",
"learningGoal": "S. können recherchierte Literatur beurteilen"
},
{
"question": "Welche Datenbank ist für meine Forschungszwecke geeignet?",
"learningGoal": "S. können mit fachspezifischen Datenbanken umgehen"
},
{
"question": "Die Mindmap ist für mich und andere verständlich?",
"learningGoal": "S. können Mindmaps erstellen"
},
{
"question": "Sind meine Ideen für andere nachvollziehbar?",
"learningGoal": "S. können ihre Ideen niederschreiben"
},
{
"question": "Sind meine Vorstellungen realisierbar?",
"learningGoal": "S. können ihre Gedanken sortieren"
},
{
"question": "Passt das zum Kursthema?",
"learningGoal": "S. können ihre Gedanken sortieren"
}
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment