/** * @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; }
/** * Service Method to create a new current tax lot balance record and copy HoldingTaxLot record to * it * * @param holdingTaxLot * @return currentTaxLotBalance */ public CurrentTaxLotBalance copyHoldingTaxLotToCurrentTaxLotBalance(HoldingTaxLot holdingTaxLot) { CurrentTaxLotBalance currentTaxLotBalance = new CurrentTaxLotBalance(); currentTaxLotBalance.setKemid(holdingTaxLot.getKemid()); currentTaxLotBalance.setSecurityId(holdingTaxLot.getSecurityId()); currentTaxLotBalance.setRegistrationCode(holdingTaxLot.getRegistrationCode()); currentTaxLotBalance.setLotNumber(holdingTaxLot.getLotNumber()); currentTaxLotBalance.setIncomePrincipalIndicator(holdingTaxLot.getIncomePrincipalIndicator()); currentTaxLotBalance.setUnits(holdingTaxLot.getUnits()); currentTaxLotBalance.setCost(holdingTaxLot.getCost()); currentTaxLotBalance.setAcquiredDate(holdingTaxLot.getAcquiredDate()); currentTaxLotBalance.setPriorAccrual(holdingTaxLot.getPriorAccrual()); currentTaxLotBalance.setCurrentAccrual(holdingTaxLot.getCurrentAccrual()); currentTaxLotBalance.setLastTransactionDate(holdingTaxLot.getLastTransactionDate()); return currentTaxLotBalance; }