summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java
index 8afe7988..2f21af99 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLectureFilter.java
@@ -28,21 +28,24 @@ public class DbLectureFilter {
return stmt;
}
- public static List<LdapFilter> getLectureLdapFilters(MysqlConnection connection, String lectureId)
- throws SQLException {
- List<LdapFilter> list = new ArrayList<>();
+ public static void getSplitForLectureLdap(MysqlConnection connection, String lectureId,
+ List<LdapFilter> custom, List<Integer> predef) throws SQLException {
MysqlStatement stmt = getLdapFilterStatement(connection, lectureId);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
- LdapFilter filter = new LdapFilter(rs.getString("filterkey"), rs.getString("filtervalue"));
- filter.setFilterId(rs.getInt("filterid"));
- filter.setTitle(rs.getString("filtername"));
- list.add(filter);
+ int id = rs.getInt("filterid");
+ if (id != 0) {
+ predef.add(id);
+ } else {
+ LdapFilter filter = new LdapFilter(rs.getString("filterkey"), rs.getString("filtervalue"));
+ filter.setFilterId(id);
+ filter.setTitle(rs.getString("filtername"));
+ custom.add(filter);
+ }
}
- return list;
}
- public static List<LdapFilter> getPredefinedLdapFilters()
+ public static List<LdapFilter> getPredefinedLdap()
throws SQLException {
try (MysqlConnection connection = Database.getConnection()) {
List<LdapFilter> list = new ArrayList<>();
@@ -78,7 +81,7 @@ public class DbLectureFilter {
return list;
}
- public static void writeLdapFilters(MysqlConnection connection, String lectureId, List<LdapFilter> list)
+ public static void writeForLectureLdap(MysqlConnection connection, String lectureId, List<LdapFilter> list)
throws SQLException {
if (lectureId == null || lectureId.isEmpty()) {
return;