summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
diff options
context:
space:
mode:
authorSimon Rettberg2016-07-26 17:21:26 +0200
committerSimon Rettberg2016-07-26 17:21:26 +0200
commit36e9590bbbe6507bd994cbcb337da1f8bae3a6aa (patch)
treeac1e3c87e7e46a8d82ef1bdee7277fcc0764cc73 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
parent[server] Register NetRule thrift class with Json helper (diff)
downloadtutor-module-36e9590bbbe6507bd994cbcb337da1f8bae3a6aa.tar.gz
tutor-module-36e9590bbbe6507bd994cbcb337da1f8bae3a6aa.tar.xz
tutor-module-36e9590bbbe6507bd994cbcb337da1f8bae3a6aa.zip
[server] Supply netrules and runscript via webrpc
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.java11
1 files changed, 7 insertions, 4 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 76eaac2d..d9135bb1 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
@@ -36,7 +36,7 @@ import com.google.gson.JsonParseException;
public class DbLecture {
private static final Logger LOGGER = Logger.getLogger(DbLecture.class);
-
+
static {
Json.registerThriftClass(NetRule.class);
}
@@ -276,7 +276,7 @@ public class DbLecture {
+ " LEFT JOIN imageversion i USING (imageversionid)"
+ " LEFT JOIN lecturepermission p ON (l.lectureid = p.lectureid AND p.userid = :userid)"
+ " WHERE l.lectureid = :lectureid LIMIT 1");
- stmt.setString("userid", user.userId);
+ stmt.setString("userid", user == null ? "" : user.userId);
stmt.setString("lectureid", lectureId);
ResultSet rs = stmt.executeQuery();
if (!rs.next())
@@ -441,7 +441,8 @@ public class DbLecture {
}
}
- public static VmChooserListXml getUsableListXml(boolean exams, String locationsString) throws SQLException {
+ public static VmChooserListXml getUsableListXml(boolean exams, String locationsString)
+ throws SQLException {
// Sanitize and clean locations string
// Input is in the form of "1 2 3 4" or "1" or " 1 4 5"
// We want "1,2,3,4" or "1" or "1,4,5"
@@ -481,7 +482,9 @@ public class DbLecture {
+ " INNER JOIN virtualizer v USING (virtid)"
+ " LEFT JOIN os_x_virt ov USING (osid, virtid)"
+ " LEFT JOIN ("
- + " SELECT DISTINCT lectureid FROM lecture_x_location WHERE locationid IN (" + cleanLocations + ")"
+ + " SELECT DISTINCT lectureid FROM lecture_x_location WHERE locationid IN ("
+ + cleanLocations
+ + ")"
+ " ) loc USING (lectureid)"
+ " WHERE l.isenabled = 1 AND l.isprivate = 0 AND l.isexam = :isexam"
+ " AND l.starttime < UNIX_TIMESTAMP() AND l.endtime > UNIX_TIMESTAMP() AND i.isvalid = 1");