src/main/java/de/uapcore/lightpit/dao/ModuleDao.java

changeset 31
58f78f0142e8
parent 30
fb30f7b78f9b
child 33
fd8c40ff78c3
     1.1 --- a/src/main/java/de/uapcore/lightpit/dao/ModuleDao.java	Sat May 09 14:37:15 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/dao/ModuleDao.java	Sat May 09 14:58:20 2020 +0200
     1.3 @@ -50,6 +50,7 @@
     1.4          mod.setModID(result.getInt("modid"));
     1.5          mod.setClassname(result.getString("classname"));
     1.6          mod.setVisible(result.getBoolean("visible"));
     1.7 +        mod.setPriority(result.getInt("priority"));
     1.8      }
     1.9              
    1.10      
    1.11 @@ -68,21 +69,22 @@
    1.12      protected PreparedStatement moduleCheckStatement(Connection conn) throws SQLException {
    1.13          return conn.prepareStatement("SELECT visible FROM lpitcore_module WHERE classname = ?");
    1.14      }
    1.15 -    
    1.16 +
    1.17      /**
    1.18       * Must return a prepared statement for insertion with the specified properties.
    1.19 -     * 
    1.20 +     *
    1.21       * <ul>
    1.22       * <li>Parameter 1: classname</li>
    1.23       * <li>Parameter 2: visible</li>
    1.24 +     * <li>Parameter 3: priority</li>
    1.25       * </ul>
    1.26 -     * 
    1.27 +     *
    1.28       * @param conn the connection to use
    1.29       * @return the prepared statement
    1.30 -     * @throws SQLException 
    1.31 +     * @throws SQLException
    1.32       */
    1.33      protected PreparedStatement moduleInsertStatement(Connection conn) throws SQLException {
    1.34 -        return conn.prepareStatement("INSERT INTO lpitcore_module (classname, visible) VALUES (?, ?)");
    1.35 +        return conn.prepareStatement("INSERT INTO lpitcore_module (classname, visible, priority) VALUES (?, ?, ?)");
    1.36      }
    1.37      
    1.38      /**
    1.39 @@ -110,6 +112,7 @@
    1.40              try (ResultSet r = check.executeQuery()) {
    1.41                  if (!r.next()) {
    1.42                      insert.setString(1, modEntry.getKey());
    1.43 +                    insert.setInt(3, modEntry.getValue().defaultPriority());
    1.44                      insert.executeUpdate();
    1.45                  }
    1.46              }

mercurial