/**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getCurrentTaxLotBalanceTotalHoldingUnits(org.kuali.kfs.module.endow.businessobject.FeeMethod)
   */
  public BigDecimal getCurrentTaxLotBalanceTotalHoldingUnits(FeeMethod feeMethod) {
    BigDecimal totalHoldingUnits = BigDecimal.ZERO;

    Collection securityClassCodes = new ArrayList();
    Collection securityIds = new ArrayList();
    String feeMethodCodeForClassCodes = feeMethod.getCode();
    if (StringUtils.isNotBlank(feeMethodCodeForClassCodes)) {

      if (dataDictionaryService.getAttributeForceUppercase(
          FeeClassCode.class, EndowPropertyConstants.FEE_METHOD_CODE)) {
        feeMethodCodeForClassCodes = feeMethodCodeForClassCodes.toUpperCase();
      }
    }
    securityClassCodes = currentTaxLotBalanceDao.getSecurityClassCodes(feeMethodCodeForClassCodes);

    String feeMethodCodeForSecurityIds = feeMethod.getCode();
    if (StringUtils.isNotBlank(feeMethodCodeForSecurityIds)) {

      if (dataDictionaryService.getAttributeForceUppercase(
          FeeSecurity.class, EndowPropertyConstants.FEE_METHOD_CODE)) {
        feeMethodCodeForSecurityIds = feeMethodCodeForSecurityIds.toUpperCase();
      }
    }
    securityIds = currentTaxLotBalanceDao.getSecurityIds(feeMethod.getCode());

    Collection<CurrentTaxLotBalance> currentTaxLotBalanceRecords =
        currentTaxLotBalanceDao.getCurrentTaxLotBalances(
            feeMethod, securityClassCodes, securityIds);
    for (CurrentTaxLotBalance currentTaxLotBalance : currentTaxLotBalanceRecords) {
      totalHoldingUnits = totalHoldingUnits.add(currentTaxLotBalance.getUnits());
    }

    return totalHoldingUnits;
  }
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getHoldingMarketValueSumForSecurity(java.lang.String)
   */
  public BigDecimal getHoldingMarketValueSumForSecurity(String securityId) {
    BigDecimal sum = BigDecimal.ZERO;

    List<CurrentTaxLotBalance> currentTaxLotBalances =
        (List<CurrentTaxLotBalance>)
            currentTaxLotBalanceDao.getAllCurrentTaxLotBalanceEntriesForSecurity(securityId);

    if (currentTaxLotBalances != null) {
      for (CurrentTaxLotBalance currentTaxLotBalance : currentTaxLotBalances) {
        if (currentTaxLotBalance.getHoldingMarketValue() != null) {
          sum = sum.add(currentTaxLotBalance.getHoldingMarketValue());
        }
      }
    }

    return sum;
  }