summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-08-04 15:48:29 +0200
committerSimon Rettberg2015-08-04 15:48:29 +0200
commit472777409247056a2ae789825a538d8452e38189 (patch)
tree850cad918ec8d815e01d694ef3e718aa5a9f4c6d /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
parent[client] getPageSize() -> getConfiguration() (diff)
downloadtutor-module-472777409247056a2ae789825a538d8452e38189.tar.gz
tutor-module-472777409247056a2ae789825a538d8452e38189.tar.xz
tutor-module-472777409247056a2ae789825a538d8452e38189.zip
[server] Fix getLectureDetails() query and netrule parsing
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
index e2c3f5e3..5af96eae 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
@@ -20,6 +20,8 @@ import org.openslx.bwlp.thrift.iface.NetRule;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import com.google.gson.JsonParseException;
+
public class DbLecture {
private static final Logger LOGGER = Logger.getLogger(DbLecture.class);
@@ -192,7 +194,7 @@ public class DbLecture {
TNotFoundException {
try (MysqlConnection connection = Database.getConnection()) {
MysqlStatement stmt = connection.prepareStatement("SELECT"
- + " l.lectureid, l.displayname AS l.lecturename, l.description, l.imageversionid, l.autoupdate,"
+ + " l.lectureid, l.displayname AS lecturename, l.description, l.imageversionid, l.autoupdate,"
+ " l.isenabled, l.starttime, l.endtime, l.lastused, l.usecount, l.createtime, l.updatetime,"
+ " l.ownerid, l.updaterid, l.runscript, l.nics, l.netrules, l.isexam, l.hasinternetaccess,"
+ " l.caneditdefault, l.canadmindefault, p.canedit, p.canadmin"
@@ -219,8 +221,15 @@ public class DbLecture {
lecture.setOwnerId(rs.getString("ownerid"));
lecture.setUpdaterId(rs.getString("updaterid"));
lecture.setRunscript(rs.getString("runscript"));
- lecture.setNetworkExceptions(Arrays.asList(Json.deserializeThrift(rs.getString("netrules"),
- NetRule[].class)));
+ String netrules = rs.getString("netrules");
+ if (netrules != null) {
+ try {
+ lecture.setNetworkExceptions(Arrays.asList(Json.deserializeThrift(netrules,
+ NetRule[].class)));
+ } catch (JsonParseException e) {
+ LOGGER.warn("Could not deserialize netrules for lecture " + lectureId, e);
+ }
+ }
lecture.setImage(DbImage.getImageSummary(connection, user,
DbImage.getBaseIdForVersionId(connection, rs.getString("imageversionid"))));
lecture.setAllowedUsers(getAllowedUsers(connection, lectureId));