More Depot NWO.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@377 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-07-25 21:07:35 +00:00
parent e6b104f688
commit c826583754
@@ -29,8 +29,8 @@ import com.samskivert.io.PersistenceException;
import com.samskivert.jdbc.ConnectionProvider; import com.samskivert.jdbc.ConnectionProvider;
import com.samskivert.jdbc.depot.DepotRepository; import com.samskivert.jdbc.depot.DepotRepository;
import com.samskivert.jdbc.depot.clause.Where; import com.samskivert.jdbc.depot.clause.Where;
import com.samskivert.jdbc.depot.operator.Logic.*;
import com.samskivert.jdbc.depot.operator.Conditionals.*; import com.samskivert.jdbc.depot.operator.Conditionals.*;
import com.samskivert.jdbc.depot.operator.Logic.And;
/** /**
* Handles the persistent storage of per-user per-game ratings. * Handles the persistent storage of per-user per-game ratings.
@@ -52,10 +52,9 @@ public class RatingRepository extends DepotRepository
public RatingRecord getRating (int gameId, int playerId) public RatingRecord getRating (int gameId, int playerId)
throws PersistenceException throws PersistenceException
{ {
return load( return load(RatingRecord.class,
RatingRecord.class, RatingRecord.GAME_ID, gameId,
RatingRecord.GAME_ID, gameId, RatingRecord.PLAYER_ID, playerId);
RatingRecord.PLAYER_ID, playerId);
} }
/** /**
@@ -69,11 +68,9 @@ public class RatingRepository extends DepotRepository
if (players.length == 0) { if (players.length == 0) {
return Collections.emptyList(); return Collections.emptyList();
} }
return findAll( return findAll(RatingRecord.class,
RatingRecord.class, new Where(new And(new Equals(RatingRecord.GAME_ID_C, gameId),
new Where(new And( new In(RatingRecord.PLAYER_ID_C, players))));
new Equals(RatingRecord.GAME_ID, gameId),
new In(RatingRecord.PLAYER_ID, players))));
} }
/** /**
@@ -82,7 +79,7 @@ public class RatingRepository extends DepotRepository
public List<RatingRecord> getRatings (int playerId) public List<RatingRecord> getRatings (int playerId)
throws PersistenceException throws PersistenceException
{ {
return findAll(RatingRecord.class, new Where(RatingRecord.PLAYER_ID, playerId)); return findAll(RatingRecord.class, new Where(RatingRecord.PLAYER_ID_C, playerId));
} }
/** /**