Skip to content
Snippets Groups Projects
Commit 746b1745 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Bugfixes in Project Json Reader and Sql Writer

parent baed6361
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,7 @@ object PlayPadServer extends App { ...@@ -91,6 +91,7 @@ object PlayPadServer extends App {
Runtime.getRuntime.addShutdownHook(new Thread(() => { Runtime.getRuntime.addShutdownHook(new Thread(() => {
databaseConnection.close() databaseConnection.close()
connectionSource.close()
stop() stop()
})) }))
} }
...@@ -3,8 +3,8 @@ package de.tobias.playpad.server.project.loader.json ...@@ -3,8 +3,8 @@ package de.tobias.playpad.server.project.loader.json
import java.util.UUID import java.util.UUID
import com.google.gson.JsonObject import com.google.gson.JsonObject
import de.tobias.playpad.server.project.{Design, Pad}
import de.tobias.playpad.server.project.utils.JsonDef import de.tobias.playpad.server.project.utils.JsonDef
import de.tobias.playpad.server.project.{Design, Pad}
/** /**
* Created by tobias on 23.02.17. * Created by tobias on 23.02.17.
......
...@@ -19,9 +19,11 @@ class PadLoader { ...@@ -19,9 +19,11 @@ class PadLoader {
val pad = new Pad() val pad = new Pad()
pad.id = UUID.fromString(json.get(PAD_ID).getAsString) pad.id = UUID.fromString(json.get(PAD_ID).getAsString)
if (json.get(PAD_NAME) != null)
pad.name = json.get(PAD_NAME).getAsString pad.name = json.get(PAD_NAME).getAsString
pad.position = json.get(PAD_POSITION).getAsInt pad.position = json.get(PAD_POSITION).getAsInt
pad.name = json.get(PAD_CONTENT_TYPE).getAsString if (json.get(PAD_CONTENT_TYPE) != null)
pad.contentType = json.get(PAD_CONTENT_TYPE).getAsString
pad.page = page pad.page = page
val pathLoader = new PathLoader val pathLoader = new PathLoader
...@@ -30,6 +32,7 @@ class PadLoader { ...@@ -30,6 +32,7 @@ class PadLoader {
val designLoader = new DesignLoader val designLoader = new DesignLoader
val designJson = json.getAsJsonObject(PAD_DESIGN) val designJson = json.getAsJsonObject(PAD_DESIGN)
if (designJson != null)
pad.design = designLoader.load(designJson, pad) pad.design = designLoader.load(designJson, pad)
pad pad
......
...@@ -11,8 +11,8 @@ import de.tobias.playpad.server.server.SqlHelper ...@@ -11,8 +11,8 @@ import de.tobias.playpad.server.server.SqlHelper
*/ */
class PathSaver(val connection: Connection) { class PathSaver(val connection: Connection) {
def save(path: Path): Unit = { def save(path: Path): Unit = {
SqlHelper.insertOrUpdate(connection, PATH, path.id, PAD_NAME, path.path) SqlHelper.insertOrUpdate(connection, PATH, path.id, PATH_PAD_REF, path.pad.id)
SqlHelper.insertOrUpdate(connection, PATH, path.id, PAD_POSITION, path.pad.id) SqlHelper.insertOrUpdate(connection, PATH, path.id, PATH_NAME, path.path)
} }
} }
...@@ -24,7 +24,7 @@ class PadAddListener extends Listener { ...@@ -24,7 +24,7 @@ class PadAddListener extends Listener {
SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_POSITION, padPosition) SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_POSITION, padPosition)
if (!json.get("contentType").isJsonNull) { if (!json.get("contentType").isJsonNull) {
val contentType = json.get("contentType").getAsString; val contentType = json.get("contentType").getAsString
SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_CONTENT_TYPE, contentType) SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_CONTENT_TYPE, contentType)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment