diff -r 65d5a0ca49ae -r 1f2a96efa69f src/java/de/uapcore/lightpit/entities/ModuleDao.java --- a/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 15:34:11 2018 +0200 +++ b/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 16:41:02 2018 +0200 @@ -34,7 +34,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.AbstractMap; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -88,18 +87,16 @@ } /** - * Synchronizes a set of registered module classes with the database and gives a list of visible modules in return. + * Synchronizes a set of registered module classes with the database. * * Inserts module classes which are not known to the database and sets them to be visible by default. * Module classes known to the database, which are not in the given set, are ignored. * * @param conn the connection to use * @param moduleSet the module set to synchronize - * @return a list of elements from the given set, which should be visible in the menu * @throws SQLException */ - public final List> - syncRegisteredModuleClasses(Connection conn, Set> moduleSet) throws SQLException { + public final void syncRegisteredModuleClasses(Connection conn, Set> moduleSet) throws SQLException { PreparedStatement check = moduleCheckStatement(conn), @@ -107,30 +104,17 @@ insert.setBoolean(2, true); // update/delete not required, we do this in the module management UI - final List> visibleModules = new ArrayList<>(); + for (Map.Entry modEntry : moduleSet) { + if (modEntry.getValue().systemModule()) continue; - for (Map.Entry mod : moduleSet) { - if (mod.getValue().systemModule()) continue; - - check.setString(1, mod.getKey()); + check.setString(1, modEntry.getKey()); try (ResultSet r = check.executeQuery()) { - final boolean visible; - if (r.next()) { - visible = r.getBoolean(1); - } else { - insert.setString(1, mod.getKey()); + if (!r.next()) { + insert.setString(1, modEntry.getKey()); insert.executeUpdate(); - visible = !mod.getValue().menuKey().isEmpty(); - } - if (visible) { - visibleModules.add(new AbstractMap.SimpleEntry<>( - mod.getKey(), - mod.getValue() - )); } } } - return visibleModules; } /** @@ -144,8 +128,7 @@ */ public List listAll(Connection conn) throws SQLException { List list = new ArrayList<>(); - try ( - Statement stmt = conn.createStatement(); + try (Statement stmt = conn.createStatement(); ResultSet result = stmt.executeQuery("SELECT * FROM lpitcore_module")) { while (result.next()) { final Module mod = new Module();