diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/DeckDAO.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/DeckDAO.java index 0bd3019f6..c00e7897c 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/DeckDAO.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/DeckDAO.java @@ -119,24 +119,24 @@ public class DeckDAO { throw new RuntimeException("Unable to store player deck to DB", exp); } } - - private void appendList(StringBuilder sb, List cards) { - for (String card : cards) - sb.append("," + card); - } - - private LotroDeck getDeckFromDB(int playerId, String name) { - try { - String contents = getDeckContentsFromDB(playerId, name); - if (contents != null) { - return buildDeckFromContents(contents); - } else { - return null; - } - } catch (SQLException exp) { - throw new RuntimeException("Unable to get player deck from DB", exp); - } - } +// +// private void appendList(StringBuilder sb, List cards) { +// for (String card : cards) +// sb.append("," + card); +// } +// +// private LotroDeck getDeckFromDB(int playerId, String name) { +// try { +// String contents = getDeckContentsFromDB(playerId, name); +// if (contents != null) { +// return buildDeckFromContents(contents); +// } else { +// return null; +// } +// } catch (SQLException exp) { +// throw new RuntimeException("Unable to get player deck from DB", exp); +// } +// } private String buildContentsFromDeck(LotroDeck deck) { StringBuilder sb = new StringBuilder(); @@ -253,29 +253,29 @@ public class DeckDAO { connection.close(); } } - - private String getDeckContentsFromDB(int playerId, String name) throws SQLException { - Connection connection = _dbAccess.getDataSource().getConnection(); - try { - PreparedStatement statement = connection.prepareStatement("select contents from deck where player_id=? and name=?"); - try { - statement.setInt(1, playerId); - statement.setString(2, name); - ResultSet rs = statement.executeQuery(); - try { - if (rs.next()) { - return rs.getString(1); - } else { - return null; - } - } finally { - rs.close(); - } - } finally { - statement.close(); - } - } finally { - connection.close(); - } - } +// +// private String getDeckContentsFromDB(int playerId, String name) throws SQLException { +// Connection connection = _dbAccess.getDataSource().getConnection(); +// try { +// PreparedStatement statement = connection.prepareStatement("select contents from deck where player_id=? and name=?"); +// try { +// statement.setInt(1, playerId); +// statement.setString(2, name); +// ResultSet rs = statement.executeQuery(); +// try { +// if (rs.next()) { +// return rs.getString(1); +// } else { +// return null; +// } +// } finally { +// rs.close(); +// } +// } finally { +// statement.close(); +// } +// } finally { +// connection.close(); +// } +// } } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/LeagueDAO.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/LeagueDAO.java index 482229055..27f1c7484 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/LeagueDAO.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/LeagueDAO.java @@ -17,15 +17,18 @@ public class LeagueDAO { _dbAccess = dbAccess; } - public void addLeague(String name, String type, int startTime, int endTime) throws SQLException, IOException { + public void addLeague(String name, String type, String clazz, String parameters, int startTime, int endTime) throws SQLException, IOException { Connection conn = _dbAccess.getDataSource().getConnection(); try { - PreparedStatement statement = conn.prepareStatement("insert into league (name, type, start, end) values (?, ?, ?, ?)"); + PreparedStatement statement = conn.prepareStatement("insert into league (name, type, class, parameters, start, end, status) values (?, ?, ?, ?, ?, ?, ?)"); try { statement.setString(1, name); statement.setString(2, type); - statement.setInt(3, startTime); - statement.setInt(4, endTime); + statement.setString(3, clazz); + statement.setString(4, parameters); + statement.setInt(5, startTime); + statement.setInt(6, endTime); + statement.setInt(7, 0); statement.execute(); } finally { statement.close(); diff --git a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/AdminResource.java b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/AdminResource.java index 4ec959423..17f44481a 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/AdminResource.java +++ b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/AdminResource.java @@ -56,17 +56,6 @@ public class AdminResource extends AbstractResource { return "OK"; } -// @Path("/migrate") -// @GET -// public String migrate( -// @Context HttpServletRequest request) throws Exception { -// validateAdmin(request); -// -// _lotroServer.migrateReplays(); -// -// return "OK"; -// } - @Path("/shutdown") @GET public String shutdown( @@ -96,12 +85,14 @@ public class AdminResource extends AbstractResource { public String addLeague( @FormParam("name") String name, @FormParam("type") String type, + @FormParam("class") String clazz, + @FormParam("parameters") String parameters, @FormParam("start") int start, @FormParam("end") int end, @Context HttpServletRequest request) throws Exception { validateAdmin(request); - _leagueDao.addLeague(name, type, start, end); + _leagueDao.addLeague(name, type, clazz, parameters, start, end); return "OK"; } @@ -132,24 +123,6 @@ public class AdminResource extends AbstractResource { return "OK"; } - // @Path("/moveCollections") -// @POST -// public String moveCollections( -// @FormParam("collectionFrom") String collectionFrom, -// @FormParam("collectionTo") String collectionTo, -// @Context HttpServletRequest request) throws Exception { -// validateAdmin(request); -// -// Map playerCollections = _collectionsManager.getPlayersCollection(collectionFrom); -// for (Map.Entry playerCollection : playerCollections.entrySet()) { -// Player player = playerCollection.getKey(); -// -// _collectionsManager.moveCollectionToCollection(player, createCollectionType(collectionFrom), createCollectionType(collectionTo)); -// } -// -// return "OK"; -// } -// private List getItems(String values) { List result = new LinkedList(); for (String pack : values.split("\n")) { diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/admin.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/admin.html index a7400047c..e03475164 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/admin.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/admin.html @@ -16,34 +16,17 @@
Name:
- Type:
+ Code:
+ Type:
+ Parameters:
Start:
End:
-

Add season

- -
- League type:
- Season type:
- Format:
- Product:
- Start:
- End:
- Max matches:
- -
- -

Add league product

- -
- Type:
- Product:
- Skip base collection:
- -
-

Collections

Add items

@@ -55,13 +38,5 @@ -

Move cards in collections

- -
- Collection from:
- Collection to:
- -
- \ No newline at end of file