summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
diff options
context:
space:
mode:
authorJonathan Bauer2017-09-06 13:48:33 +0200
committerJonathan Bauer2017-09-06 13:48:33 +0200
commite310fa0738149f20b9de6b173d3d175857b0c748 (patch)
tree5857811d25cc53c51590cc0158ec84e049a3ed88 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
parent[client] Update apache httpclient, pass custom client to ecp-client-lean (diff)
downloadtutor-module-e310fa0738149f20b9de6b173d3d175857b0c748.tar.gz
tutor-module-e310fa0738149f20b9de6b173d3d175857b0c748.tar.xz
tutor-module-e310fa0738149f20b9de6b173d3d175857b0c748.zip
[client/server] network share feature [WIP]
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.java8
1 files changed, 7 insertions, 1 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 ff160917..58c7bdb2 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
@@ -24,6 +24,7 @@ import org.openslx.bwlp.thrift.iface.LectureRead;
import org.openslx.bwlp.thrift.iface.LectureSummary;
import org.openslx.bwlp.thrift.iface.LectureWrite;
import org.openslx.bwlp.thrift.iface.NetRule;
+import org.openslx.bwlp.thrift.iface.NetShare;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.util.Json;
@@ -39,6 +40,7 @@ public class DbLecture {
static {
Json.registerThriftClass(NetRule.class);
+ Json.registerThriftClass(NetShare.class);
}
private static void setWriteFields(MysqlStatement stmt, String lectureId, LectureWrite lecture,
@@ -117,6 +119,7 @@ public class DbLecture {
stmt.setString("ownerid", user.userId);
stmt.executeUpdate();
writeLocations(connection, lectureId, lecture.locationIds);
+ DbNetshare.writeNetworkShares(connection, lectureId, lecture.networkShares);
connection.commit();
return lectureId;
} catch (SQLException e) {
@@ -138,6 +141,7 @@ public class DbLecture {
+ " WHERE lectureid = :lectureid");
setWriteFields(stmt, lectureId, lecture, user);
writeLocations(connection, lectureId, lecture.locationIds);
+ DbNetshare.writeNetworkShares(connection, lectureId, lecture.networkShares);
stmt.executeUpdate();
}
@@ -274,10 +278,11 @@ public class DbLecture {
+ " 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.isprivate, l.islocationprivate, l.hasinternetaccess, l.hasusbaccess,"
- + " l.caneditdefault, l.canadmindefault, p.canedit, p.canadmin"
+ + " l.caneditdefault, l.canadmindefault, p.canedit, p.canadmin, n.sharedata"
+ " FROM lecture l "
+ " LEFT JOIN imageversion i USING (imageversionid)"
+ " LEFT JOIN lecturepermission p ON (l.lectureid = p.lectureid AND p.userid = :userid)"
+ + " LEFT JOIN networkshare n ON (l.lectureid = n.lectureid)"
+ " WHERE l.lectureid = :lectureid LIMIT 1");
stmt.setString("userid", user == null ? "" : user.userId);
stmt.setString("lectureid", lectureId);
@@ -323,6 +328,7 @@ public class DbLecture {
lecture.setUserPermissions(DbLecturePermissions.fromResultSetUser(rs));
User.setCombinedUserPermissions(lecture, user);
lecture.setLocationIds(DbLocation.getLectureLocations(connection, lectureId));
+ lecture.setNetworkShares(DbNetshare.getLectureNetshares(connection, lectureId));
return lecture;
} catch (SQLException e) {
LOGGER.error("Query failed in DbLecture.getLectureDetails()", e);