Beispiel #1
0
  public List<CharityBlingInfo> getCharityBlingInfo() {
    // Get all charity members.
    List<CharityRecord> charities = _memberRepo.getCharities();
    Set<Integer> memberIds = Sets.newHashSet();
    for (CharityRecord charity : charities) {
      memberIds.add(charity.memberId);
    }
    Map<Integer, MemberRecord> memberMap = Maps.newHashMap();
    for (MemberRecord member : _memberRepo.loadMembers(memberIds)) {
      memberMap.put(member.memberId, member);
    }

    // Get money info for all the members.
    Map<Integer, MemberMoney> monies = _moneyLogic.getMoneyFor(memberIds);

    // Create CharityBlingInfo objects from this information.
    List<CharityBlingInfo> charityBlingInfos = Lists.newArrayListWithExpectedSize(charities.size());
    for (CharityRecord charity : charities) {
      MemberRecord member = memberMap.get(charity.memberId);
      MemberMoney money = monies.get(charity.memberId);
      charityBlingInfos.add(
          new CharityBlingInfo(
              charity.memberId,
              member.getName().getNormal(),
              member.accountName,
              money.bling,
              _runtime.money.blingWorth * money.bling / 100,
              charity.core));
    }
    return charityBlingInfos;
  }
Beispiel #2
0
 public void supportAdjust(int memberId, Currency currency, int delta) throws ServiceException {
   // support can modify coins, but only admin can modify other currencies
   MemberRecord mrec = (currency == Currency.COINS) ? requireSupportUser() : requireAdminUser();
   // additional safety checks in MoneyLogic
   _moneyLogic.supportAdjust(memberId, currency, delta, mrec.getName());
 }