Added two methods we want in SK.

Also made registerMigration public, temporarily.
This commit is contained in:
Ray J. Greenwell
2012-04-04 11:06:22 -07:00
parent 28fedf8848
commit efa397559a
@@ -1,5 +1,5 @@
//
// $Id$
// $Id: RewardRepository.java 3547 2011-03-03 04:40:51Z jamie $
package com.threerings.user.depot;
@@ -52,6 +52,12 @@ public class RewardRepository extends DepotRepository
super(new PersistenceContext(OOOUserRepository.USER_REPOSITORY_IDENT, provider, null));
}
@Override // TEMP: just make it public
public void registerMigration (com.samskivert.depot.DataMigration mig)
{
super.registerMigration(mig);
}
/**
* Creates a new RewardInfo record in the database. <code>info</code> should have the
* <code>description</code>, <code>data</code> and <code>expiration</code> filled in.
@@ -196,6 +202,16 @@ public class RewardRepository extends DepotRepository
return findAll(RewardInfoRecord.class, OrderBy.descending(RewardInfoRecord.REWARD_ID));
}
/**
* Return just the ids of all activated rewards for the specified account.
*/
public List<Integer> loadActivatedRewardIds (String account)
{
return from(RewardRecord.class)
.where(RewardRecord.ACCOUNT.eq(account))
.select(RewardRecord.REWARD_ID);
}
/**
* Returns all <code>RewardRecord</code>s that match the given account name and whose eligible
* date is in the past. The returned list will be sorted by <code>rewardId</code>.
@@ -207,6 +223,16 @@ public class RewardRepository extends DepotRepository
OrderBy.ascending(RewardRecord.REWARD_ID));
}
/**
* Load the redeemable reward records.
*/
public List<RewardRecord> loadRedeemableRewards (String account)
{
return from(RewardRecord.class)
.where(RewardRecord.ACCOUNT.eq(account), RewardRecord.REDEEMER_IDENT.isNull())
.select();
}
/**
* Returns all <code>RewardRecord</code>s that match either the account or redeemer identifier.
* The returned list will be sorted by <code>rewardId</code>.