Added purgePlayers().
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@803 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -42,13 +42,11 @@ public class StatRecord extends PersistentRecord
|
||||
public static final int SCHEMA_VERSION = 4;
|
||||
|
||||
/** The identifier of the player this is a stat for. */
|
||||
@Id
|
||||
@Column(name="PLAYER_ID")
|
||||
@Id @Column(name="PLAYER_ID")
|
||||
public int playerId;
|
||||
|
||||
/** The code of the stat. */
|
||||
@Id
|
||||
@Column(name="STAT_CODE")
|
||||
@Id @Column(name="STAT_CODE")
|
||||
public int statCode;
|
||||
|
||||
/** The data associated with the stat. */
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package com.threerings.stats.server.persist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -24,6 +25,7 @@ import com.samskivert.depot.DuplicateKeyException;
|
||||
import com.samskivert.depot.Key;
|
||||
import com.samskivert.depot.PersistenceContext;
|
||||
import com.samskivert.depot.PersistentRecord;
|
||||
import com.samskivert.depot.operator.Conditionals;
|
||||
import com.samskivert.depot.clause.FieldDefinition;
|
||||
import com.samskivert.depot.clause.FromOverride;
|
||||
import com.samskivert.depot.clause.QueryClause;
|
||||
@@ -180,6 +182,15 @@ public class StatRepository extends DepotRepository
|
||||
_codeToString.get(type).remove(ocode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all data associated with the supplied players.
|
||||
*/
|
||||
public void purgePlayers (Collection<Integer> playerIds)
|
||||
{
|
||||
deleteAll(StatRecord.class,
|
||||
new Where(new Conditionals.In(StatRecord.PLAYER_ID, playerIds)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the appropriate stat class and decodes the stat from the data.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user