List of usage examples for org.joda.time LocalDate toDateMidnight
@Deprecated
public DateMidnight toDateMidnight()
From source file:org.mifos.clientportfolio.newloan.domain.VariableInstallmentsLoanDisbursementStrategyImpl.java
License:Open Source License
@Override public LocalDate findClosestMatchingDateFromAndInclusiveOf(LocalDate fromAndInclusiveOf) { LocalDate nearestMatchingDate = new LocalDate( scheduledEvent.nearestMatchNotTakingIntoAccountScheduleFrequency( fromAndInclusiveOf.minusDays(1).toDateMidnight().toDateTime())); if (nearestMatchingDate.isBefore(new LocalDate())) { nearestMatchingDate = new LocalDate(scheduledEvent.nearestMatchNotTakingIntoAccountScheduleFrequency( fromAndInclusiveOf.toDateMidnight().toDateTime())); }//from w ww.j a v a 2 s .c om return nearestMatchingDate; }
From source file:org.mifos.customers.business.CustomerAccountBO.java
License:Open Source License
/** * Create an initial meeting schedule with fees attached, if any. * * <p>PostConditions:</p>/* w w w . ja va 2 s .co m*/ * * <ul> * <li> <code>numberOfMeetingDatesToGenerateOnCreation</code> {@link CustomerScheduleEntity}s are created * starting with <code>customerMeeting</code>'s start date, scheduled according to <code>customerMeeting</code>'s * frequency and recurrence, and subject to rules for scheduling around on working days and around holidays. See * {@link HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration} for scheduling rules.</li> * <li> One-time upfront fees are attached to the first meeting.</li> * <li> Periodic fees are attached to the first meeting and subsequent meetings that match the fee's frequency * and recurrence</li> * <li> The <code>lastAppliedDate</code> for each fee is set to the date of the latest meeting to which the fee * is attached * </ul> */ public void createSchedulesAndFeeSchedulesForFirstTimeActiveCustomer(CustomerBO customer, List<AccountFeesEntity> accountFees, MeetingBO customerMeeting, CalendarEvent applicableCalendarEvents, DateTime scheduleGenerationStartingFrom) { final ScheduledEvent customerMeetingEvent = new RecurringScheduledEventFactoryImpl() .createScheduledEventFrom(customerMeeting); DateTime beginningFrom = scheduleGenerationStartingFrom; // synch up generated schedule for center/group/client or group/client hierarchy CustomerBO upmostParent = upmostParentOf(customer); if (upmostParent != null) { LocalDate parentCustomerActiviationDate = new LocalDate(upmostParent.getCustomerActivationDate()); LocalDate childCustomerActiviationDate = new LocalDate(customer.getCustomerActivationDate()); LocalDate validCustomerMeetingMatch = null; if (customerMeetingEvent instanceof DailyScheduledEvent) { validCustomerMeetingMatch = new LocalDate( parentCustomerActiviationDate.toDateMidnight().toDateTime()); } else { validCustomerMeetingMatch = new LocalDate( customerMeetingEvent.nearestMatchNotTakingIntoAccountScheduleFrequency( parentCustomerActiviationDate.toDateMidnight().toDateTime())); } while (childCustomerActiviationDate.isAfter(validCustomerMeetingMatch)) { validCustomerMeetingMatch = new LocalDate(customerMeetingEvent .rollFrowardDateByFrequency(validCustomerMeetingMatch.toDateMidnight().toDateTime())); } beginningFrom = validCustomerMeetingMatch.toDateMidnight().toDateTime(); } DateTime meetingStartDate = new DateTime(customer.getCustomerMeetingValue().getMeetingStartDate()); if (beginningFrom.isBefore(meetingStartDate)) { beginningFrom = meetingStartDate; } createInitialSetOfCustomerScheduleEntities(customer, beginningFrom, applicableCalendarEvents, customerMeetingEvent); applyFeesToInitialSetOfInstallments(new ArrayList<AccountFeesEntity>(accountFees), customerMeetingEvent); }
From source file:org.mifos.customers.business.service.CustomerServiceImpl.java
License:Open Source License
@Override public final void updateClientPersonalInfo(UserContext userContext, ClientPersonalInfoUpdate personalInfo) throws CustomerException { ClientBO client = (ClientBO) this.customerDao.findCustomerById(personalInfo.getCustomerId()); client.validateVersion(personalInfo.getOriginalClientVersionNumber()); client.updateDetails(userContext);/*w w w. j a va 2 s . co m*/ LocalDate currentDOB = new LocalDate(client.getDateOfBirth()); LocalDate newDOB = currentDOB; try { // updating Date of birth // doesn''t sound normal but it can be required in certain cases // see http://mifosforge.jira.com/browse/MIFOS-4368 newDOB = new LocalDate(DateUtils.getDateAsSentFromBrowser(personalInfo.getDateOfBirth())); } catch (InvalidDateException e) { throw new MifosRuntimeException(e); } if (!currentDOB.isEqual(newDOB)) { customerDao.validateClientForDuplicateNameOrGovtId(personalInfo.getClientDisplayName(), newDOB.toDateMidnight().toDate(), personalInfo.getGovernmentId()); } try { hibernateTransactionHelper.startTransaction(); hibernateTransactionHelper.beginAuditLoggingFor(client); client.updatePersonalInfo(personalInfo); clientPhotoService.update(personalInfo.getCustomerId().longValue(), personalInfo.getPicture()); customerDao.save(client); hibernateTransactionHelper.commitTransaction(); } catch (ApplicationException e) { hibernateTransactionHelper.rollbackTransaction(); throw new CustomerException(e.getKey(), e); } catch (Exception e) { hibernateTransactionHelper.rollbackTransaction(); throw new MifosRuntimeException(e); } finally { hibernateTransactionHelper.commitTransaction(); } }
From source file:org.mifos.customers.client.business.ClientBO.java
License:Open Source License
public static ClientBO createNewInGroupHierarchy(UserContext userContext, String clientName, CustomerStatus clientStatus, DateTime mfiJoiningDate, CustomerBO group, PersonnelBO formedBy, ClientNameDetailEntity clientNameDetailEntity, DateTime dateOfBirth, String governmentId, boolean trained, DateTime trainedDate, Short groupFlag, String clientFirstName, String clientLastName, String secondLastName, ClientNameDetailEntity spouseFatherNameDetailEntity, ClientDetailEntity clientDetailEntity, List<ClientInitialSavingsOfferingEntity> associatedOfferings, String externalId, Address address, LocalDate activationDate) { // inherit settings from parent (group) OfficeBO office = group.getOffice(); MeetingBO meeting = group.getCustomerMeetingValue(); if (clientStatus.isClientActive()) { Assert.notNull(meeting, "meeting inherited from parent group should not be null when client is active"); }/* ww w. java2 s . c o m*/ PersonnelBO loanOfficer = group.getPersonnel(); ClientBO client = new ClientBO(userContext, clientName, clientStatus, mfiJoiningDate, office, meeting, loanOfficer, formedBy, dateOfBirth, governmentId, trained, trainedDate, groupFlag, clientFirstName, clientLastName, secondLastName, clientDetailEntity); client.setParentCustomer(group); client.generateSearchId(); client.updateAddress(address); client.setExternalId(externalId); client.addNameDetailSet(clientNameDetailEntity); client.addNameDetailSet(spouseFatherNameDetailEntity); if (clientStatus.isClientActive()) { CustomerHierarchyEntity hierarchy = new CustomerHierarchyEntity(client, group); client.addCustomerHierarchy(hierarchy); client.setCustomerActivationDate(activationDate.toDateMidnight().toDate()); } for (ClientInitialSavingsOfferingEntity clientInitialSavingsOfferingEntity : associatedOfferings) { client.addOfferingAssociatedInCreate(clientInitialSavingsOfferingEntity); } return client; }
From source file:org.mifos.reports.pentaho.util.PentahoParamParser.java
License:Open Source License
public Object parseParamValue(AbstractPentahoParameter param, ParameterDefinitionEntry paramDefEntry) throws ReflectionException { Object result = null;//from w ww . j ava 2 s.co m Class<?> clazz = paramDefEntry.getValueType(); if (param instanceof PentahoDateParameter) { PentahoDateParameter dateParam = (PentahoDateParameter) param; LocalDate date = dateParam.getDate(); Date javaDate = (date == null) ? null : date.toDateMidnight().toDate(); result = ReflectionUtil.parseDateToClass(javaDate, clazz); } else if (param instanceof PentahoInputParameter) { PentahoInputParameter inputParam = (PentahoInputParameter) param; result = ReflectionUtil.parseStringToClass(inputParam.getValue(), clazz); } else if (param instanceof PentahoSingleSelectParameter) { PentahoSingleSelectParameter singleSelectParam = (PentahoSingleSelectParameter) param; result = ReflectionUtil.parseStringToClass(singleSelectParam.getSelectedValue(), clazz); } else if (param instanceof PentahoMultiSelectParameter) { PentahoMultiSelectParameter multiSelectParam = (PentahoMultiSelectParameter) param; Class<?> componentType = (clazz.isArray()) ? clazz.getComponentType() : clazz; result = ReflectionUtil.parseStringsToClass(multiSelectParam.getSelectedValues(), componentType); } return result; }
From source file:org.mifosplatform.portfolio.loanaccount.loanschedule.domain.EqualPrincipalAmortizationLoanScheduleGenerator.java
License:Mozilla Public License
@Override public LoanScheduleData generate(final ApplicationCurrency currency, final LoanProductRelatedDetail loanScheduleInfo, final LocalDate disbursementDate, final LocalDate interestCalculatedFrom, final BigDecimal periodInterestRateForRepaymentPeriod, final LocalDate idealDisbursementDateBasedOnFirstRepaymentDate, final List<LocalDate> scheduledDates, final Set<LoanCharge> loanCharges) { final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>(); // 1. we know 'principal' must be equal over repayments so use this to // calculate interest and thus total repayment due. final MonetaryCurrency monetaryCurrency = loanScheduleInfo.getPrincipal().getCurrency(); Money totalDuePerInstallment = Money.zero(monetaryCurrency); Money outstandingBalance = loanScheduleInfo.getPrincipal(); Money principalDisbursed = loanScheduleInfo.getPrincipal(); Money totalPrincipal = Money.zero(monetaryCurrency); Money totalInterest = Money.zero(monetaryCurrency); double interestCalculationGraceOnRepaymentPeriodFraction = this.paymentPeriodsInOneYearCalculator .calculateRepaymentPeriodAsAFractionOfDays(loanScheduleInfo.getRepaymentPeriodFrequencyType(), loanScheduleInfo.getRepayEvery(), interestCalculatedFrom, scheduledDates, idealDisbursementDateBasedOnFirstRepaymentDate); BigDecimal chargesDueAtTimeOfDisbursement = BigDecimal.ZERO; for (LoanCharge loanCharge : loanCharges) { if (loanCharge.isDueAtDisbursement()) { chargesDueAtTimeOfDisbursement = chargesDueAtTimeOfDisbursement.add(loanCharge.amount()); }//from w w w.j a va 2 s .c om } // create entries of disbursement period on loan schedule final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursementOnlyPeriod( disbursementDate, principalDisbursed.getAmount(), chargesDueAtTimeOfDisbursement, false); periods.add(disbursementPeriod); int loanTermInDays = Integer.valueOf(0); BigDecimal totalPrincipalDisbursed = principalDisbursed.getAmount(); BigDecimal totalPrincipalExpected = BigDecimal.ZERO; BigDecimal totalPrincipalPaid = BigDecimal.ZERO; BigDecimal totalInterestCharged = BigDecimal.ZERO; BigDecimal totalFeeChargesCharged = chargesDueAtTimeOfDisbursement; BigDecimal totalPenaltyChargesCharged = BigDecimal.ZERO; BigDecimal totalWaived = BigDecimal.ZERO; BigDecimal totalWrittenOff = BigDecimal.ZERO; BigDecimal totalRepaymentExpected = chargesDueAtTimeOfDisbursement; BigDecimal totalRepayment = BigDecimal.ZERO; BigDecimal totalOutstanding = BigDecimal.ZERO; LocalDate startDate = disbursementDate; int periodNumber = 1; for (LocalDate scheduledDueDate : scheduledDates) { // number of days from startDate to this scheduledDate int daysInPeriod = Days.daysBetween(startDate.toDateMidnight().toDateTime(), scheduledDueDate.toDateMidnight().toDateTime()).getDays(); Money interestForInstallment = this.periodicInterestRateCalculator.calculateInterestOn( outstandingBalance, periodInterestRateForRepaymentPeriod, daysInPeriod, loanScheduleInfo); Money principalForInstallment = this.periodicInterestRateCalculator .calculatePrincipalOn(totalDuePerInstallment, interestForInstallment, loanScheduleInfo); if (interestCalculationGraceOnRepaymentPeriodFraction >= Integer.valueOf(1).doubleValue()) { Money graceOnInterestForRepaymentPeriod = interestForInstallment; interestForInstallment = interestForInstallment.minus(graceOnInterestForRepaymentPeriod); interestCalculationGraceOnRepaymentPeriodFraction = interestCalculationGraceOnRepaymentPeriodFraction - Integer.valueOf(1).doubleValue(); } else if (interestCalculationGraceOnRepaymentPeriodFraction > Double.valueOf("0.25") && interestCalculationGraceOnRepaymentPeriodFraction < Integer.valueOf(1).doubleValue()) { Money graceOnInterestForRepaymentPeriod = interestForInstallment .multipliedBy(interestCalculationGraceOnRepaymentPeriodFraction); interestForInstallment = interestForInstallment.minus(graceOnInterestForRepaymentPeriod); interestCalculationGraceOnRepaymentPeriodFraction = Double.valueOf("0"); } totalPrincipal = totalPrincipal.plus(principalForInstallment); totalInterest = totalInterest.plus(interestForInstallment); if (periodNumber == loanScheduleInfo.getNumberOfRepayments()) { Money principalDifference = totalPrincipal.minus(loanScheduleInfo.getPrincipal()); if (principalDifference.isLessThanZero()) { principalForInstallment = principalForInstallment.plus(principalDifference.abs()); } else if (principalDifference.isGreaterThanZero()) { principalForInstallment = principalForInstallment.minus(principalDifference.abs()); } } outstandingBalance = outstandingBalance.minus(principalForInstallment); final Money feeChargesForInstallment = cumulativeFeeChargesDueWithin(startDate, scheduledDueDate, loanCharges, monetaryCurrency); final Money penaltyChargesForInstallment = cumulativePenaltyChargesDueWithin(startDate, scheduledDueDate, loanCharges, monetaryCurrency); final Money totalInstallmentDue = principalForInstallment.plus(interestForInstallment) .plus(feeChargesForInstallment).plus(penaltyChargesForInstallment); LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, startDate, scheduledDueDate, principalForInstallment.getAmount(), outstandingBalance.getAmount(), interestForInstallment.getAmount(), feeChargesForInstallment.getAmount(), penaltyChargesForInstallment.getAmount(), totalInstallmentDue.getAmount()); periods.add(installment); // handle cumulative fields loanTermInDays += daysInPeriod; totalPrincipalExpected = totalPrincipalExpected.add(principalForInstallment.getAmount()); totalInterestCharged = totalInterestCharged.add(interestForInstallment.getAmount()); totalFeeChargesCharged = totalFeeChargesCharged.add(feeChargesForInstallment.getAmount()); totalPenaltyChargesCharged = totalPenaltyChargesCharged.add(penaltyChargesForInstallment.getAmount()); totalRepaymentExpected = totalRepaymentExpected.add(totalInstallmentDue.getAmount()); startDate = scheduledDueDate; periodNumber++; } final CurrencyData currencyData = new CurrencyData(currency.getCode(), currency.getName(), monetaryCurrency.getDigitsAfterDecimal(), currency.getDisplaySymbol(), currency.getNameCode()); return new LoanScheduleData(currencyData, periods, loanTermInDays, totalPrincipalDisbursed, totalPrincipalExpected, totalPrincipalPaid, totalInterestCharged, totalFeeChargesCharged, totalPenaltyChargesCharged, totalWaived, totalWrittenOff, totalRepaymentExpected, totalRepayment, totalOutstanding); }
From source file:org.mifosplatform.portfolio.loanaccount.loanschedule.domain.FlatMethodLoanScheduleGenerator.java
License:Mozilla Public License
@Override public LoanScheduleData generate(final ApplicationCurrency currency, final LoanProductRelatedDetail loanScheduleInfo, final Integer loanTermFrequency, final PeriodFrequencyType loanTermFrequencyType, final LocalDate disbursementDate, final LocalDate firstRepaymentDate, final LocalDate interestCalculatedFrom, final Set<LoanCharge> loanCharges) { final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>(); final List<LocalDate> scheduledDates = this.scheduledDateGenerator.generate(loanScheduleInfo, disbursementDate, firstRepaymentDate); MathContext mc = new MathContext(8, RoundingMode.HALF_EVEN); BigDecimal loanTermPeriodsInYear = BigDecimal .valueOf(this.paymentPeriodsInOneYearCalculator.calculate(loanTermFrequencyType)); BigDecimal interestRateForLoanTerm = loanScheduleInfo.getAnnualNominalInterestRate() .divide(loanTermPeriodsInYear, mc).divide(BigDecimal.valueOf(Double.valueOf("100.0")), mc) .multiply(BigDecimal.valueOf(loanTermFrequency)); final MonetaryCurrency monetaryCurrency = loanScheduleInfo.getPrincipal().getCurrency(); Money totalInterestForLoanTerm = loanScheduleInfo.getPrincipal() .multiplyRetainScale(interestRateForLoanTerm, RoundingMode.HALF_EVEN); Money interestPerInstallment = totalInterestForLoanTerm .dividedBy(Long.valueOf(loanScheduleInfo.getNumberOfRepayments()), RoundingMode.HALF_EVEN); Money principalPerInstallment = loanScheduleInfo.getPrincipal() .dividedBy(loanScheduleInfo.getNumberOfRepayments(), RoundingMode.HALF_EVEN); Money outstandingBalance = loanScheduleInfo.getPrincipal(); Money principalDisbursed = loanScheduleInfo.getPrincipal(); Money totalPrincipal = Money.zero(outstandingBalance.getCurrency()); Money totalInterest = Money.zero(outstandingBalance.getCurrency()); BigDecimal chargesDueAtTimeOfDisbursement = BigDecimal.ZERO; for (LoanCharge loanCharge : loanCharges) { if (loanCharge.isDueAtDisbursement()) { chargesDueAtTimeOfDisbursement = chargesDueAtTimeOfDisbursement.add(loanCharge.amount()); }//w w w. ja v a 2 s . c om } // create entries of disbursement period on loan schedule final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursementOnlyPeriod( disbursementDate, principalDisbursed.getAmount(), chargesDueAtTimeOfDisbursement, false); periods.add(disbursementPeriod); int loanTermInDays = Integer.valueOf(0); BigDecimal totalPrincipalDisbursed = principalDisbursed.getAmount(); BigDecimal totalPrincipalExpected = BigDecimal.ZERO; BigDecimal totalPrincipalPaid = BigDecimal.ZERO; BigDecimal totalInterestCharged = BigDecimal.ZERO; BigDecimal totalFeeChargesCharged = chargesDueAtTimeOfDisbursement; BigDecimal totalPenaltyChargesCharged = BigDecimal.ZERO; BigDecimal totalWaived = BigDecimal.ZERO; BigDecimal totalWrittenOff = BigDecimal.ZERO; BigDecimal totalRepaymentExpected = chargesDueAtTimeOfDisbursement; BigDecimal totalRepayment = BigDecimal.ZERO; BigDecimal totalOutstanding = BigDecimal.ZERO; LocalDate startDate = disbursementDate; int periodNumber = 1; for (LocalDate scheduledDueDate : scheduledDates) { totalPrincipal = totalPrincipal.plus(principalPerInstallment); totalInterest = totalInterest.plus(interestPerInstallment); // number of days from startDate to this scheduledDate int daysInPeriod = Days.daysBetween(startDate.toDateMidnight().toDateTime(), scheduledDueDate.toDateMidnight().toDateTime()).getDays(); if (periodNumber == loanScheduleInfo.getNumberOfRepayments()) { final Money difference = totalPrincipal.minus(loanScheduleInfo.getPrincipal()); if (difference.isLessThanZero()) { principalPerInstallment = principalPerInstallment.plus(difference.abs()); } else if (difference.isGreaterThanZero()) { principalPerInstallment = principalPerInstallment.minus(difference.abs()); } final Money interestDifference = totalInterest.minus(totalInterestForLoanTerm); if (interestDifference.isLessThanZero()) { interestPerInstallment = interestPerInstallment.plus(interestDifference.abs()); } else if (interestDifference.isGreaterThanZero()) { interestPerInstallment = interestPerInstallment.minus(interestDifference.abs()); } } outstandingBalance = outstandingBalance.minus(principalPerInstallment); final Money feeChargesForInstallment = cumulativeFeeChargesDueWithin(startDate, scheduledDueDate, loanCharges, monetaryCurrency); final Money penaltyChargesForInstallment = cumulativePenaltyChargesDueWithin(startDate, scheduledDueDate, loanCharges, monetaryCurrency); final Money totalInstallmentDue = principalPerInstallment // .plus(interestPerInstallment) // .plus(feeChargesForInstallment) // .plus(penaltyChargesForInstallment); LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, startDate, scheduledDueDate, principalPerInstallment.getAmount(), outstandingBalance.getAmount(), interestPerInstallment.getAmount(), feeChargesForInstallment.getAmount(), penaltyChargesForInstallment.getAmount(), totalInstallmentDue.getAmount()); periods.add(installment); // handle cumulative fields loanTermInDays += daysInPeriod; totalPrincipalExpected = totalPrincipalExpected.add(principalPerInstallment.getAmount()); totalInterestCharged = totalInterestCharged.add(interestPerInstallment.getAmount()); totalFeeChargesCharged = totalFeeChargesCharged.add(feeChargesForInstallment.getAmount()); totalPenaltyChargesCharged = totalPenaltyChargesCharged.add(penaltyChargesForInstallment.getAmount()); totalRepaymentExpected = totalRepaymentExpected.add(totalInstallmentDue.getAmount()); startDate = scheduledDueDate; periodNumber++; } final CurrencyData currencyData = new CurrencyData(currency.getCode(), currency.getName(), monetaryCurrency.getDigitsAfterDecimal(), currency.getDisplaySymbol(), currency.getNameCode()); return new LoanScheduleData(currencyData, periods, loanTermInDays, totalPrincipalDisbursed, totalPrincipalExpected, totalPrincipalPaid, totalInterestCharged, totalFeeChargesCharged, totalPenaltyChargesCharged, totalWaived, totalWrittenOff, totalRepaymentExpected, totalRepayment, totalOutstanding); }
From source file:org.surfnet.cruncher.repository.StatisticsRepositoryImpl.java
License:Apache License
private Map<String, Object> getParameterMap(LocalDate start, LocalDate end, String idpEntityId, String spEntityId) {//from w w w.j ava2 s . c o m Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("startDate", new Date(start.toDateMidnight().getMillis())); parameterMap.put("endDate", new Date(end.toDateMidnight().getMillis())); parameterMap.put("spEntityId", spEntityId); parameterMap.put("idpEntityId", idpEntityId); return parameterMap; }
From source file:org.surfnet.cruncher.repository.StatisticsRepositoryImpl.java
License:Apache License
@Override public VersStatistic getVersStats(LocalDate startDate, LocalDate endDate, String spEntityId) { final VersStatistic result = new VersStatistic(); NamedParameterJdbcTemplate namedJdbcTemplate = new NamedParameterJdbcTemplate(cruncherJdbcTemplate); String query = "select idpentityid, sum(entrycount) as loginCount from aggregated_log_logins " + "where " + "entryday >= :startDate AND " + "entryday <= :endDate AND " + "spentityid = :spEntityId " + "group by idpentityid " + "order by idpentityid"; Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("startDate", new Date(startDate.toDateMidnight().getMillis())); parameterMap.put("endDate", new Date(endDate.toDateMidnight().getMillis())); parameterMap.put("spEntityId", spEntityId); namedJdbcTemplate.query(query, parameterMap, new RowMapper<VersStatistic>() { @Override/*from w w w .j av a 2 s . c om*/ public VersStatistic mapRow(ResultSet rs, int row) throws SQLException { String idpEntityId = rs.getString("idpEntityId"); result.addInstitutionLoginCount(idpEntityId, rs.getLong("loginCount")); // no rowbased result return null; } }); return result; }