1.1 --- a/webidor/pom.xml Sun Oct 25 14:23:51 2009 +0100
1.2 +++ b/webidor/pom.xml Sun Oct 25 14:24:58 2009 +0100
1.3 @@ -9,7 +9,7 @@
1.4 <groupId>org.apidesign</groupId>
1.5 <artifactId>webidor</artifactId>
1.6 <packaging>jar</packaging>
1.7 - <version>1.6</version>
1.8 + <version>1.7</version>
1.9 <name>webidor server</name>
1.10 <url>http://maven.apache.org</url>
1.11 <repositories>
2.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java Sun Oct 25 14:23:51 2009 +0100
2.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java Sun Oct 25 14:24:58 2009 +0100
2.3 @@ -106,12 +106,21 @@
2.4 if (when == null) {
2.5 when = new Date(id.getModified());
2.6 }
2.7 - id = new GameId(id.getId(), id.getWhite(), id.getBlack(), new Date(id.getStarted()), when, GameStatus.valueOf(board));
2.8 + id = new GameId(
2.9 + id.getId(), id.getWhite(), id.getBlack(),
2.10 + new Date(id.getStarted()), when,
2.11 + GameStatus.valueOf(board), id.getComments()
2.12 + );
2.13 getMoves().add(new CommentedMove(m, getMoves().size() + 1));
2.14 }
2.15
2.16 public void comment(String player, String comment, Date date) {
2.17 Note n = new Note(comment, date, player);
2.18 + id = new GameId(
2.19 + id.getId(), id.getWhite(), id.getBlack(),
2.20 + new Date(id.getStarted()), new Date(id.getModified()),
2.21 + GameStatus.valueOf(board), id.getComments() + 1
2.22 + );
2.23 getMoves().get(getMoves().size() - 1).addNote(n);
2.24 }
2.25
2.26 @@ -143,7 +152,7 @@
2.27 new GameId(
2.28 id.getId(), id.getWhite(), id.getBlack(),
2.29 new Date(id.getStarted()), new Date(id.getModified()),
2.30 - GameStatus.history
2.31 + GameStatus.history, id.getComments()
2.32 )
2.33 );
2.34 g.board = b;
3.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/GameId.java Sun Oct 25 14:23:51 2009 +0100
3.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/GameId.java Sun Oct 25 14:24:58 2009 +0100
3.3 @@ -56,6 +56,8 @@
3.4 private GameStatus status;
3.5 @XmlID @XmlAttribute
3.6 private String id;
3.7 + @XmlAttribute
3.8 + private int comments;
3.9
3.10 GameId() {
3.11 }
3.12 @@ -66,17 +68,18 @@
3.13 private GameId(String first, String second, Date d) {
3.14 this(
3.15 UUID.randomUUID().toString(),
3.16 - first, second, d, d, GameStatus.whiteMove
3.17 + first, second, d, d, GameStatus.whiteMove, 0
3.18 );
3.19 }
3.20
3.21 - public GameId(String id, String first, String second, Date started, Date last, GameStatus result) {
3.22 + public GameId(String id, String first, String second, Date started, Date last, GameStatus result, int comments) {
3.23 this.white = first;
3.24 this.black = second;
3.25 this.id = id;
3.26 this.started = started.getTime();
3.27 this.modified = last.getTime();
3.28 this.status = result;
3.29 + this.comments = comments;
3.30 }
3.31
3.32 public String getId() {
3.33 @@ -103,6 +106,10 @@
3.34 return status;
3.35 }
3.36
3.37 + public int getComments() {
3.38 + return comments;
3.39 + }
3.40 +
3.41 private static final class NewestFirst implements Comparator<GameId> {
3.42 public int compare(GameId o1, GameId o2) {
3.43 if (o1 == o2) {
4.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Games.java Sun Oct 25 14:23:51 2009 +0100
4.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Games.java Sun Oct 25 14:24:58 2009 +0100
4.3 @@ -276,7 +276,7 @@
4.4 throw new IOException("Missing white and black identification in " + f);
4.5 }
4.6 if (g == null) {
4.7 - GameId id = new GameId(f.getName(), white, black, new Date(f.lastModified()), new Date(f.lastModified()), GameStatus.whiteMove);
4.8 + GameId id = new GameId(f.getName(), white, black, new Date(f.lastModified()), new Date(f.lastModified()), GameStatus.whiteMove, 0);
4.9 g = new Game(id);
4.10 }
4.11 int hash = line.indexOf('#');