mifosx-58: wip - integrate charges at time of disbursement into loan create and modify flows. suppress non-relevant warnings for unused parameters in overiding classes.

This commit is contained in:
Keith Woodlock
2012-09-20 15:11:48 +01:00
parent ba8b24ac3b
commit 4f98144896
49 changed files with 240 additions and 123 deletions
@@ -9,6 +9,7 @@ import org.mifosng.platform.client.domain.Client;
import org.mifosng.platform.loan.domain.Loan; import org.mifosng.platform.loan.domain.Loan;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
@SuppressWarnings("unused")
public final class Specifications { public final class Specifications {
public static Specification<Loan> loansThatMatch(final Client client) { public static Specification<Loan> loansThatMatch(final Client client) {
@@ -303,17 +303,10 @@ public class LoansApiResource {
@Produces({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON})
public String modifyLoanApplication( public String modifyLoanApplication(
@PathParam("loanId") final Long loanId, @PathParam("loanId") final Long loanId,
// @QueryParam("command") final String commandParam,
// @Context final UriInfo uriInfo,
final String jsonRequestBody) { final String jsonRequestBody) {
final LoanApplicationCommand command = this.apiDataConversionService.convertJsonToLoanApplicationCommand(loanId, jsonRequestBody); final LoanApplicationCommand command = this.apiDataConversionService.convertJsonToLoanApplicationCommand(loanId, jsonRequestBody);
// if (is(commandParam, "calculateLoanSchedule")) {
// CalculateLoanScheduleCommand calculateLoanScheduleCommand = command.toCalculateLoanScheduleCommand();
// return calculateLoanSchedule(uriInfo, calculateLoanScheduleCommand);
// }
final EntityIdentifier identifier = this.loanWritePlatformService.modifyLoanApplication(command); final EntityIdentifier identifier = this.loanWritePlatformService.modifyLoanApplication(command);
return this.apiJsonSerializerService.serializeEntityIdentifier(identifier); return this.apiJsonSerializerService.serializeEntityIdentifier(identifier);
@@ -153,7 +153,7 @@ public class ReportsApiResource {
if (!parameterType) { if (!parameterType) {
AppUser currentUser = context.authenticatedUser(); AppUser currentUser = context.authenticatedUser();
if (currentUser.hasNotPermissionForReport(reportName)) { if (currentUser.hasNotPermissionForReport(reportName)) {
// TODO - message isnt passing back the message in the string in // FIXME - JW - message isnt passing back the message in the string in
// the json just a generalised not authorised message // the json just a generalised not authorised message
throw new NoAuthorizationException( throw new NoAuthorizationException(
"Not Authorised to Run Report: " + reportName); "Not Authorised to Run Report: " + reportName);
@@ -28,6 +28,7 @@ public class CalculateLoanScheduleCommand {
private final LocalDate expectedDisbursementDate; private final LocalDate expectedDisbursementDate;
private final LocalDate repaymentsStartingFromDate; private final LocalDate repaymentsStartingFromDate;
private final LocalDate interestChargedFromDate; private final LocalDate interestChargedFromDate;
private final LoanChargeCommand[] charges;
public CalculateLoanScheduleCommand( public CalculateLoanScheduleCommand(
final Long productId, final Long productId,
@@ -36,7 +37,7 @@ public class CalculateLoanScheduleCommand {
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod,
final Integer loanTermFrequency, final Integer loanTermFrequencyType, final Integer loanTermFrequency, final Integer loanTermFrequencyType,
final LocalDate expectedDisbursementDate, final LocalDate expectedDisbursementDate,
final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate) { final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate, final LoanChargeCommand[] charges) {
this.productId = productId; this.productId = productId;
this.principal = principal; this.principal = principal;
@@ -54,6 +55,7 @@ public class CalculateLoanScheduleCommand {
this.expectedDisbursementDate = expectedDisbursementDate; this.expectedDisbursementDate = expectedDisbursementDate;
this.repaymentsStartingFromDate = repaymentsStartingFromDate; this.repaymentsStartingFromDate = repaymentsStartingFromDate;
this.interestChargedFromDate= interestCalculatedFromDate; this.interestChargedFromDate= interestCalculatedFromDate;
this.charges = charges;
} }
public Long getProductId() { public Long getProductId() {
@@ -115,4 +117,8 @@ public class CalculateLoanScheduleCommand {
public LocalDate getInterestChargedFromDate() { public LocalDate getInterestChargedFromDate() {
return interestChargedFromDate; return interestChargedFromDate;
} }
public LoanChargeCommand[] getCharges() {
return charges;
}
} }
@@ -96,10 +96,12 @@ public class LoanApplicationCommand {
} }
public CalculateLoanScheduleCommand toCalculateLoanScheduleCommand() { public CalculateLoanScheduleCommand toCalculateLoanScheduleCommand() {
return new CalculateLoanScheduleCommand(productId, return new CalculateLoanScheduleCommand(this.productId,
principal, interestRatePerPeriod, interestRateFrequencyType, interestType, interestCalculationPeriodType, repaymentEvery, repaymentFrequencyType, numberOfRepayments, amortizationType, this.principal, this.interestRatePerPeriod, this.interestRateFrequencyType,
this.interestType, this.interestCalculationPeriodType, this.repaymentEvery,
this.repaymentFrequencyType, this.numberOfRepayments, this.amortizationType,
this.loanTermFrequency, this.loanTermFrequencyType, this.loanTermFrequency, this.loanTermFrequencyType,
expectedDisbursementDate, repaymentsStartingFromDate, interestChargedFromDate); this.expectedDisbursementDate, this.repaymentsStartingFromDate, this.interestChargedFromDate, this.charges);
} }
public Long getLoanId() { public Long getLoanId() {
@@ -200,7 +202,7 @@ public class LoanApplicationCommand {
public LoanProductCommand toLoanProductCommand() { public LoanProductCommand toLoanProductCommand() {
// TODO - FIX UP FOR CHARGES. // FIXME - KW - CHARGE - FIX UP FOR CHARGES - take look at loan product charges also and align usage with other loan areas.
return new LoanProductCommand(modifiedParameters, this.productId, null, null, return new LoanProductCommand(modifiedParameters, this.productId, null, null,
this.fundId, this.transactionProcessingStrategyId, this.fundId, this.transactionProcessingStrategyId,
null, null, null, null,
@@ -1,17 +1,11 @@
package org.mifosng.platform.api.data; package org.mifosng.platform.api.data;
import java.io.Serializable; public class DepositProductLookup {
public class DepositProductLookup implements Serializable { private final Long id;
private final String name;
private Long id;
private String name; public DepositProductLookup(final Long id, final String name) {
public DepositProductLookup() {
// TODO Auto-generated constructor stub
}
public DepositProductLookup(Long id, String name) {
this.id = id; this.id = id;
this.name = name; this.name = name;
} }
@@ -20,18 +14,7 @@ public class DepositProductLookup implements Serializable {
return id; return id;
} }
public void setId(Long id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }
}
public void setName(String name) {
this.name = name;
}
}
@@ -39,13 +39,16 @@ public class LoanSchedulePeriodData {
private final BigDecimal totalWaivedForPeriod; private final BigDecimal totalWaivedForPeriod;
private final BigDecimal totalOutstandingForPeriod; private final BigDecimal totalOutstandingForPeriod;
public static LoanSchedulePeriodData disbursement(final LocalDate disbursementDate, final BigDecimal principalDisbursed) { public static LoanSchedulePeriodData disbursementOnlyPeriod(
final LocalDate disbursementDate,
final BigDecimal principalDisbursed,
final BigDecimal chargesDueAtTimeOfDisbursement) {
Integer periodNumber = Integer.valueOf(0); Integer periodNumber = Integer.valueOf(0);
LocalDate from = null; LocalDate from = null;
return new LoanSchedulePeriodData(periodNumber, from, disbursementDate, principalDisbursed); return new LoanSchedulePeriodData(periodNumber, from, disbursementDate, principalDisbursed, chargesDueAtTimeOfDisbursement);
} }
public static LoanSchedulePeriodData repaymentPeriod(final Integer periodNumber, public static LoanSchedulePeriodData repaymentOnlyPeriod(final Integer periodNumber,
final LocalDate fromDate, final LocalDate dueDate, final BigDecimal principalDue, final LocalDate fromDate, final LocalDate dueDate, final BigDecimal principalDue,
final BigDecimal principalOutstanding, final BigDecimal interestDueOnPrincipalOutstanding, final BigDecimal totalDueForPeriod) { final BigDecimal principalOutstanding, final BigDecimal interestDueOnPrincipalOutstanding, final BigDecimal totalDueForPeriod) {
@@ -84,7 +87,8 @@ public class LoanSchedulePeriodData {
final Integer periodNumber, final Integer periodNumber,
final LocalDate fromDate, final LocalDate fromDate,
final LocalDate dueDate, final LocalDate dueDate,
final BigDecimal principalDisbursed) { final BigDecimal principalDisbursed,
final BigDecimal chargesDueAtTimeOfDisbursement) {
this.period = periodNumber; this.period = periodNumber;
this.fromDate = fromDate; this.fromDate = fromDate;
this.dueDate = dueDate; this.dueDate = dueDate;
@@ -106,12 +110,12 @@ public class LoanSchedulePeriodData {
this.interestWaived = null; this.interestWaived = null;
this.interestOutstanding = null; this.interestOutstanding = null;
this.chargesDue = BigDecimal.ZERO; this.chargesDue = chargesDueAtTimeOfDisbursement;
this.chargesPaid = null; this.chargesPaid = null;
this.chargesOutstanding = null; this.chargesOutstanding = chargesDueAtTimeOfDisbursement;
this.totalOriginalDueForPeriod = null; this.totalOriginalDueForPeriod = chargesDueAtTimeOfDisbursement;
this.totalDueForPeriod = null; this.totalDueForPeriod = chargesDueAtTimeOfDisbursement;
this.totalPaidForPeriod = BigDecimal.ZERO; this.totalPaidForPeriod = BigDecimal.ZERO;
this.totalWaivedForPeriod = null; this.totalWaivedForPeriod = null;
this.totalOutstandingForPeriod = null; this.totalOutstandingForPeriod = null;
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
public class AccessDeniedExceptionMapper implements ExceptionMapper<AccessDeniedException> { public class AccessDeniedExceptionMapper implements ExceptionMapper<AccessDeniedException> {
@Override @Override
public Response toResponse(AccessDeniedException exception) { public Response toResponse(@SuppressWarnings("unused") AccessDeniedException exception) {
// Status code 403 really reads as: "Authenticated - but not authorized": // Status code 403 really reads as: "Authenticated - but not authorized":
return Response.status(Status.FORBIDDEN).entity(ApiGlobalErrorResponse.unAuthorized()).type(MediaType.APPLICATION_JSON).build(); return Response.status(Status.FORBIDDEN).entity(ApiGlobalErrorResponse.unAuthorized()).type(MediaType.APPLICATION_JSON).build();
} }
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
public class BadCredentialsExceptionMapper implements ExceptionMapper<BadCredentialsException> { public class BadCredentialsExceptionMapper implements ExceptionMapper<BadCredentialsException> {
@Override @Override
public Response toResponse(BadCredentialsException exception) { public Response toResponse(@SuppressWarnings("unused") BadCredentialsException exception) {
return Response.status(Status.UNAUTHORIZED).entity(ApiGlobalErrorResponse.unAuthenticated()).type(MediaType.APPLICATION_JSON).build(); return Response.status(Status.UNAUTHORIZED).entity(ApiGlobalErrorResponse.unAuthenticated()).type(MediaType.APPLICATION_JSON).build();
} }
} }
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Component;
public class InvalidJsonExceptionMapper implements ExceptionMapper<InvalidJsonException> { public class InvalidJsonExceptionMapper implements ExceptionMapper<InvalidJsonException> {
@Override @Override
public Response toResponse(final InvalidJsonException exception) { public Response toResponse(@SuppressWarnings("unused") final InvalidJsonException exception) {
String globalisationMessageCode = "error.msg.invalid.request.body"; String globalisationMessageCode = "error.msg.invalid.request.body";
String defaultUserMessage = "The JSON provided in the body of the request is invalid or missing."; String defaultUserMessage = "The JSON provided in the body of the request is invalid or missing.";
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
public class InvalidTenantIdentifierExceptionMapper implements ExceptionMapper<InvalidTenantIdentiferException> { public class InvalidTenantIdentifierExceptionMapper implements ExceptionMapper<InvalidTenantIdentiferException> {
@Override @Override
public Response toResponse(final InvalidTenantIdentiferException e) { public Response toResponse(@SuppressWarnings("unused") final InvalidTenantIdentiferException e) {
return Response.status(Status.UNAUTHORIZED).entity(ApiGlobalErrorResponse.invalidTenantIdentifier()).type(MediaType.APPLICATION_JSON).build(); return Response.status(Status.UNAUTHORIZED).entity(ApiGlobalErrorResponse.invalidTenantIdentifier()).type(MediaType.APPLICATION_JSON).build();
} }
} }
@@ -21,7 +21,7 @@ import com.google.gson.stream.MalformedJsonException;
public class MalformedJsonExceptionMapper implements ExceptionMapper<MalformedJsonException> { public class MalformedJsonExceptionMapper implements ExceptionMapper<MalformedJsonException> {
@Override @Override
public Response toResponse(final MalformedJsonException exception) { public Response toResponse(@SuppressWarnings("unused") final MalformedJsonException exception) {
String globalisationMessageCode = "error.msg.invalid.request.body"; String globalisationMessageCode = "error.msg.invalid.request.body";
String defaultUserMessage = "The JSON provided in the body of the request is invalid or missing."; String defaultUserMessage = "The JSON provided in the body of the request is invalid or missing.";
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
public class NoAuthorizationExceptionMapper implements ExceptionMapper<NoAuthorizationException> { public class NoAuthorizationExceptionMapper implements ExceptionMapper<NoAuthorizationException> {
@Override @Override
public Response toResponse(NoAuthorizationException exception) { public Response toResponse(@SuppressWarnings("unused") NoAuthorizationException exception) {
// Status code 403 really reads as: "Authenticated - but not authorized": // Status code 403 really reads as: "Authenticated - but not authorized":
return Response.status(Status.FORBIDDEN).entity(ApiGlobalErrorResponse.unAuthorized()).type(MediaType.APPLICATION_JSON).build(); return Response.status(Status.FORBIDDEN).entity(ApiGlobalErrorResponse.unAuthorized()).type(MediaType.APPLICATION_JSON).build();
} }
@@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
public class UnAuthenticatedUserExceptionMapper implements ExceptionMapper<UnAuthenticatedUserException> { public class UnAuthenticatedUserExceptionMapper implements ExceptionMapper<UnAuthenticatedUserException> {
@Override @Override
public Response toResponse(UnAuthenticatedUserException exception) { public Response toResponse(@SuppressWarnings("unused") UnAuthenticatedUserException exception) {
// Status code 401 really reads as: "Unauthenticated": // Status code 401 really reads as: "Unauthenticated":
return Response.status(Status.UNAUTHORIZED).entity(ApiGlobalErrorResponse.unAuthenticated()).type(MediaType.APPLICATION_JSON).build(); return Response.status(Status.UNAUTHORIZED).entity(ApiGlobalErrorResponse.unAuthenticated()).type(MediaType.APPLICATION_JSON).build();
} }
@@ -14,6 +14,7 @@ import com.google.gson.JsonSerializer;
*/ */
public class JodaDateTimeAdapter implements JsonSerializer<DateTime> { public class JodaDateTimeAdapter implements JsonSerializer<DateTime> {
@SuppressWarnings("unused")
@Override @Override
public JsonElement serialize(DateTime src, Type typeOfSrc, JsonSerializationContext context) { public JsonElement serialize(DateTime src, Type typeOfSrc, JsonSerializationContext context) {
@@ -15,6 +15,7 @@ import com.google.gson.JsonSerializer;
*/ */
public class JodaLocalDateAdapter implements JsonSerializer<LocalDate> { public class JodaLocalDateAdapter implements JsonSerializer<LocalDate> {
@SuppressWarnings("unused")
@Override @Override
public JsonElement serialize(LocalDate src, Type typeOfSrc, JsonSerializationContext context) { public JsonElement serialize(LocalDate src, Type typeOfSrc, JsonSerializationContext context) {
@@ -18,6 +18,7 @@ public class ParameterListExclusionStrategy implements ExclusionStrategy {
return parameterNamesToSkip.contains(f.getName()); return parameterNamesToSkip.contains(f.getName());
} }
@SuppressWarnings("unused")
@Override @Override
public boolean shouldSkipClass(Class<?> clazz) { public boolean shouldSkipClass(Class<?> clazz) {
return false; return false;
@@ -163,7 +163,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
@Override @Override
public ChargeData mapRow(ResultSet rs, int rowNum) throws SQLException { public ChargeData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
String name = rs.getString("name"); String name = rs.getString("name");
BigDecimal amount = rs.getBigDecimal("amount"); BigDecimal amount = rs.getBigDecimal("amount");
@@ -205,7 +205,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
} }
@Override @Override
public LoanChargeData mapRow(ResultSet rs, int rowNum) throws SQLException { public LoanChargeData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
Long chargeId = rs.getLong("chargeId"); Long chargeId = rs.getLong("chargeId");
String name = rs.getString("name"); String name = rs.getString("name");
@@ -118,7 +118,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
} }
@Override @Override
public ClientData mapRow(final ResultSet rs, final int rowNum) public ClientData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long officeId = JdbcSupport.getLong(rs, "officeId"); Long officeId = JdbcSupport.getLong(rs, "officeId");
@@ -147,7 +147,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
} }
@Override @Override
public ClientLookup mapRow(ResultSet rs, int rowNum) throws SQLException { public ClientLookup mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
String firstname = rs.getString("firstname"); String firstname = rs.getString("firstname");
String lastname = rs.getString("lastname"); String lastname = rs.getString("lastname");
@@ -238,7 +238,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
@Override @Override
public ClientAccountSummaryData mapRow(final ResultSet rs, public ClientAccountSummaryData mapRow(final ResultSet rs,
final int rowNum) throws SQLException { @SuppressWarnings("unused") final int rowNum) throws SQLException {
Long id = JdbcSupport.getLong(rs, "id"); Long id = JdbcSupport.getLong(rs, "id");
String externalId = rs.getString("externalId"); String externalId = rs.getString("externalId");
@@ -265,7 +265,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
@Override @Override
public ClientAccountSummaryData mapRow(final ResultSet rs, public ClientAccountSummaryData mapRow(final ResultSet rs,
final int rowNum) throws SQLException { @SuppressWarnings("unused") final int rowNum) throws SQLException {
Long id = JdbcSupport.getLong(rs, "id"); Long id = JdbcSupport.getLong(rs, "id");
String externalId = rs.getString("externalId"); String externalId = rs.getString("externalId");
@@ -341,7 +341,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
} }
@Override @Override
public NoteData mapRow(final ResultSet rs, final int rowNum) public NoteData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = JdbcSupport.getLong(rs, "id"); Long id = JdbcSupport.getLong(rs, "id");
@@ -50,7 +50,7 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
private static final class CurrencyMapper implements RowMapper<CurrencyData> { private static final class CurrencyMapper implements RowMapper<CurrencyData> {
@Override @Override
public CurrencyData mapRow(final ResultSet rs, final int rowNum) public CurrencyData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
String code = rs.getString("code"); String code = rs.getString("code");
@@ -4,10 +4,7 @@ public class DepositProductNotFoundException extends
AbstractPlatformResourceNotFoundException { AbstractPlatformResourceNotFoundException {
public DepositProductNotFoundException(Long id) { public DepositProductNotFoundException(Long id) {
super("error.msg.depositproduct.id.invalid", "Deposit product with identifier " + id + " does not exist", id); super("error.msg.depositproduct.id.invalid",
// TODO Auto-generated constructor stub "Deposit product with identifier " + id + " does not exist", id);
} }
} }
@@ -34,7 +34,7 @@ public class FundReadPlatformServiceImpl implements FundReadPlatformService {
} }
@Override @Override
public FundData mapRow(final ResultSet rs, final int rowNum) public FundData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -80,7 +80,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
} }
@Override @Override
public GroupData mapRow(ResultSet rs, int rowNum) throws SQLException { public GroupData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
String name = rs.getString("name"); String name = rs.getString("name");
@@ -110,7 +110,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
} }
@Override @Override
public ClientLookup mapRow(ResultSet rs, int rowNum) throws SQLException { public ClientLookup mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
String firstname = rs.getString("firstname"); String firstname = rs.getString("firstname");
String lastname = rs.getString("lastname"); String lastname = rs.getString("lastname");
@@ -43,7 +43,7 @@ public class JdbcTenantDetailsService implements TenantDetailsService {
private static final class TenantMapper implements RowMapper<MifosPlatformTenant> { private static final class TenantMapper implements RowMapper<MifosPlatformTenant> {
@Override @Override
public MifosPlatformTenant mapRow(final ResultSet rs, final int rowNum) throws SQLException { public MifosPlatformTenant mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
String name = rs.getString("name"); String name = rs.getString("name");
@@ -25,6 +25,7 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessor extends AbstractLo
* For creocore, early is defined as any date before the installment due * For creocore, early is defined as any date before the installment due
* date * date
*/ */
@SuppressWarnings("unused")
@Override @Override
protected boolean isTransactionInAdvanceOfInstallment( protected boolean isTransactionInAdvanceOfInstallment(
final int currentInstallmentIndex, final int currentInstallmentIndex,
@@ -39,6 +40,7 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessor extends AbstractLo
/** /**
* For early/'in advance' repayments, pays off principal component only. * For early/'in advance' repayments, pays off principal component only.
*/ */
@SuppressWarnings("unused")
@Override @Override
protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment( protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment(
final LoanRepaymentScheduleInstallment currentInstallment, final LoanRepaymentScheduleInstallment currentInstallment,
@@ -53,6 +55,7 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessor extends AbstractLo
* For late repayments, pay off in the same way as on-time payments, * For late repayments, pay off in the same way as on-time payments,
* interest first then principal. * interest first then principal.
*/ */
@SuppressWarnings("unused")
@Override @Override
protected Money handleTransactionThatIsALateRepaymentOfInstallment( protected Money handleTransactionThatIsALateRepaymentOfInstallment(
final LoanRepaymentScheduleInstallment currentInstallment, final LoanRepaymentScheduleInstallment currentInstallment,
@@ -135,6 +138,7 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessor extends AbstractLo
return transactionAmountRemaining; return transactionAmountRemaining;
} }
@SuppressWarnings("unused")
@Override @Override
protected void onLoanOverpayment(final LoanTransaction loanTransaction, protected void onLoanOverpayment(final LoanTransaction loanTransaction,
final Money loanOverPaymentAmount) { final Money loanOverPaymentAmount) {
@@ -25,6 +25,7 @@ public class CreocoreLoanRepaymentScheduleTransactionProcessor extends
* For creocore, early is defined as any date before the installment due * For creocore, early is defined as any date before the installment due
* date * date
*/ */
@SuppressWarnings("unused")
@Override @Override
protected boolean isTransactionInAdvanceOfInstallment( protected boolean isTransactionInAdvanceOfInstallment(
final int currentInstallmentIndex, final int currentInstallmentIndex,
@@ -40,6 +41,7 @@ public class CreocoreLoanRepaymentScheduleTransactionProcessor extends
* For early/'in advance' repayments, pay off in the same way as on-time payments, * For early/'in advance' repayments, pay off in the same way as on-time payments,
* interest first then principal. * interest first then principal.
*/ */
@SuppressWarnings("unused")
@Override @Override
protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment( protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment(
final LoanRepaymentScheduleInstallment currentInstallment, final LoanRepaymentScheduleInstallment currentInstallment,
@@ -54,6 +56,7 @@ public class CreocoreLoanRepaymentScheduleTransactionProcessor extends
* For late repayments, pay off in the same way as on-time payments, * For late repayments, pay off in the same way as on-time payments,
* interest first then principal. * interest first then principal.
*/ */
@SuppressWarnings("unused")
@Override @Override
protected Money handleTransactionThatIsALateRepaymentOfInstallment( protected Money handleTransactionThatIsALateRepaymentOfInstallment(
final LoanRepaymentScheduleInstallment currentInstallment, final LoanRepaymentScheduleInstallment currentInstallment,
@@ -95,6 +98,7 @@ public class CreocoreLoanRepaymentScheduleTransactionProcessor extends
return transactionAmountRemaining; return transactionAmountRemaining;
} }
@SuppressWarnings("unused")
@Override @Override
protected void onLoanOverpayment(final LoanTransaction loanTransaction, protected void onLoanOverpayment(final LoanTransaction loanTransaction,
final Money loanOverPaymentAmount) { final Money loanOverPaymentAmount) {
@@ -9,6 +9,8 @@ import org.joda.time.LocalDate;
import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.MonetaryCurrency;
import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.currency.domain.Money;
// FIXME - KW - this might be deprecated now
@SuppressWarnings("unused")
public class DailyEquivalentFlatInterestRebateCalculator implements public class DailyEquivalentFlatInterestRebateCalculator implements
InterestRebateCalculator { InterestRebateCalculator {
@@ -18,6 +18,7 @@ import org.mifosng.platform.currency.domain.Money;
* *
* If the entire principal of an installment is paid in advance then the interest component is waived. * If the entire principal of an installment is paid in advance then the interest component is waived.
*/ */
@SuppressWarnings("unused")
public class HeavensFamilyLoanRepaymentScheduleTransactionProcessor extends AbstractLoanRepaymentScheduleTransactionProcessor { public class HeavensFamilyLoanRepaymentScheduleTransactionProcessor extends AbstractLoanRepaymentScheduleTransactionProcessor {
/** /**
@@ -2,6 +2,8 @@ package org.mifosng.platform.loan.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@@ -13,6 +15,7 @@ import org.mifosng.platform.api.commands.LoanChargeCommand;
import org.mifosng.platform.charge.domain.Charge; import org.mifosng.platform.charge.domain.Charge;
import org.mifosng.platform.charge.domain.ChargeCalculationType; import org.mifosng.platform.charge.domain.ChargeCalculationType;
import org.mifosng.platform.charge.domain.ChargeTimeType; import org.mifosng.platform.charge.domain.ChargeTimeType;
import org.mifosng.platform.currency.domain.Money;
import org.springframework.data.jpa.domain.AbstractPersistable; import org.springframework.data.jpa.domain.AbstractPersistable;
@Entity @Entity
@@ -23,7 +26,6 @@ public class LoanCharge extends AbstractPersistable<Long> {
@JoinColumn(name = "loan_id", referencedColumnName = "id", nullable=false) @JoinColumn(name = "loan_id", referencedColumnName = "id", nullable=false)
private Loan loan; private Loan loan;
@SuppressWarnings("unused")
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "charge_id", referencedColumnName = "id", nullable=false) @JoinColumn(name = "charge_id", referencedColumnName = "id", nullable=false)
private Charge charge; private Charge charge;
@@ -92,7 +94,7 @@ public class LoanCharge extends AbstractPersistable<Long> {
return ChargeTimeType.fromInt(this.chargeTime).equals(ChargeTimeType.DISBURSEMENT); return ChargeTimeType.fromInt(this.chargeTime).equals(ChargeTimeType.DISBURSEMENT);
} }
public BigDecimal calculateMonetaryAmount() { public BigDecimal calculateMonetaryAmount(final Money principalDisbursed) {
BigDecimal calculatedAmount = BigDecimal.ZERO; BigDecimal calculatedAmount = BigDecimal.ZERO;
if (ChargeCalculationType.fromInt(chargeCalculation).equals(ChargeCalculationType.FLAT)) { if (ChargeCalculationType.fromInt(chargeCalculation).equals(ChargeCalculationType.FLAT)) {
@@ -104,13 +106,22 @@ public class LoanCharge extends AbstractPersistable<Long> {
amountAsPercentageFactor = this.amount.divide(BigDecimal.valueOf(Double.valueOf("100"))); amountAsPercentageFactor = this.amount.divide(BigDecimal.valueOf(Double.valueOf("100")));
} }
calculatedAmount = this.loan.getPrincpal().multiplyRetainScale(amountAsPercentageFactor, RoundingMode.HALF_EVEN).getAmount(); calculatedAmount = principalDisbursed.multiplyRetainScale(amountAsPercentageFactor, RoundingMode.HALF_EVEN).getAmount();
} }
return calculatedAmount; return calculatedAmount;
} }
public BigDecimal calculateMonetaryAmount() {
return calculateMonetaryAmount(this.loan.getPrincpal());
}
private boolean isGreaterThanZero(final BigDecimal value) { private boolean isGreaterThanZero(final BigDecimal value) {
return value.compareTo(BigDecimal.ZERO) == 1; return value.compareTo(BigDecimal.ZERO) == 1;
} }
public LoanChargeCommand toData() {
Set<String> modifiedParameters = new HashSet<String>();
return new LoanChargeCommand(modifiedParameters, this.getId(), this.charge.getId(), this.amount, this.chargeTime, this.chargeCalculation);
}
} }
@@ -15,6 +15,7 @@ import org.mifosng.platform.currency.domain.Money;
* means, recalculate the interest component based on the how much principal is outstanding at a point in time; * means, recalculate the interest component based on the how much principal is outstanding at a point in time;
* but this isnt trying to model that option only the basic one for now. * but this isnt trying to model that option only the basic one for now.
*/ */
@SuppressWarnings("unused")
public class MifosStyleLoanRepaymentScheduleTransactionProcessor extends public class MifosStyleLoanRepaymentScheduleTransactionProcessor extends
AbstractLoanRepaymentScheduleTransactionProcessor { AbstractLoanRepaymentScheduleTransactionProcessor {
@@ -1,5 +1,7 @@
package org.mifosng.platform.loan.service; package org.mifosng.platform.loan.service;
import java.util.Set;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.LoanScheduleNewData; import org.mifosng.platform.api.LoanScheduleNewData;
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand; import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
@@ -11,6 +13,7 @@ import org.mifosng.platform.exceptions.CurrencyNotFoundException;
import org.mifosng.platform.exceptions.LoanNotFoundException; import org.mifosng.platform.exceptions.LoanNotFoundException;
import org.mifosng.platform.loan.domain.InterestMethod; import org.mifosng.platform.loan.domain.InterestMethod;
import org.mifosng.platform.loan.domain.Loan; import org.mifosng.platform.loan.domain.Loan;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanPayoffSummary; import org.mifosng.platform.loan.domain.LoanPayoffSummary;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
import org.mifosng.platform.loan.domain.LoanRepository; import org.mifosng.platform.loan.domain.LoanRepository;
@@ -30,18 +33,21 @@ public class CalculationPlatformServiceImpl implements CalculationPlatformServic
private final ApplicationCurrencyRepository applicationCurrencyRepository; private final ApplicationCurrencyRepository applicationCurrencyRepository;
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final LoanProductRelatedDetailAssembler loanProductRelatedDetailAssembler; private final LoanProductRelatedDetailAssembler loanProductRelatedDetailAssembler;
private final LoanChargeAssembler loanChargeAssembler;
@Autowired @Autowired
public CalculationPlatformServiceImpl( public CalculationPlatformServiceImpl(
final PlatformSecurityContext context, final PlatformSecurityContext context,
final LoanRepository loanRepository, final LoanRepository loanRepository,
final ApplicationCurrencyRepository applicationCurrencyRepository, final ApplicationCurrencyRepository applicationCurrencyRepository,
final LoanProductRelatedDetailAssembler loanProductRelatedDetailAssembler) { final LoanProductRelatedDetailAssembler loanProductRelatedDetailAssembler,
final LoanChargeAssembler loanChargeAssembler) {
this.context = context; this.context = context;
this.loanRepository = loanRepository; this.loanRepository = loanRepository;
this.applicationCurrencyRepository = applicationCurrencyRepository; this.applicationCurrencyRepository = applicationCurrencyRepository;
this.loanScheduleFactory = new DefaultLoanScheduleGeneratorFactory(); this.loanScheduleFactory = new DefaultLoanScheduleGeneratorFactory();
this.loanProductRelatedDetailAssembler = loanProductRelatedDetailAssembler; this.loanProductRelatedDetailAssembler = loanProductRelatedDetailAssembler;
this.loanChargeAssembler = loanChargeAssembler;
} }
@Override @Override
@@ -49,24 +55,26 @@ public class CalculationPlatformServiceImpl implements CalculationPlatformServic
context.authenticatedUser(); context.authenticatedUser();
CalculateLoanScheduleCommandValidator validator = new CalculateLoanScheduleCommandValidator(command); final CalculateLoanScheduleCommandValidator validator = new CalculateLoanScheduleCommandValidator(command);
validator.validate(); validator.validate();
LoanProductRelatedDetail loanScheduleRelatedDetails = this.loanProductRelatedDetailAssembler.assembleFrom(command); final LoanProductRelatedDetail loanScheduleRelatedDetails = this.loanProductRelatedDetailAssembler.assembleFrom(command);
final Integer loanTermFrequency = command.getLoanTermFrequency(); final Integer loanTermFrequency = command.getLoanTermFrequency();
final PeriodFrequencyType loanTermFrequencyType = PeriodFrequencyType.fromInt(command.getLoanTermFrequencyType()); final PeriodFrequencyType loanTermFrequencyType = PeriodFrequencyType.fromInt(command.getLoanTermFrequencyType());
final InterestMethod interestMethod = InterestMethod.fromInt(command.getInterestType()); final InterestMethod interestMethod = InterestMethod.fromInt(command.getInterestType());
LoanScheduleGenerator loanScheduleGenerator = this.loanScheduleFactory.create(interestMethod); final LoanScheduleGenerator loanScheduleGenerator = this.loanScheduleFactory.create(interestMethod);
ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneByCode(loanScheduleRelatedDetails.getCurrency().getCode()); final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneByCode(loanScheduleRelatedDetails.getCurrency().getCode());
final Set<LoanCharge> loanCharges = this.loanChargeAssembler.assembleFrom(command.getCharges());
return loanScheduleGenerator.generate(applicationCurrency, return loanScheduleGenerator.generate(applicationCurrency,
loanScheduleRelatedDetails, loanTermFrequency, loanScheduleRelatedDetails, loanTermFrequency,
loanTermFrequencyType, command.getExpectedDisbursementDate(), loanTermFrequencyType, command.getExpectedDisbursementDate(),
command.getRepaymentsStartingFromDate(), command.getRepaymentsStartingFromDate(),
command.getInterestChargedFromDate()); command.getInterestChargedFromDate(), loanCharges);
} }
@Override @Override
@@ -0,0 +1,38 @@
package org.mifosng.platform.loan.service;
import java.util.HashSet;
import java.util.Set;
import org.mifosng.platform.api.commands.LoanChargeCommand;
import org.mifosng.platform.charge.domain.Charge;
import org.mifosng.platform.charge.domain.ChargeRepository;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class LoanChargeAssembler {
private ChargeRepository chargeRepository;
@Autowired
public LoanChargeAssembler(final ChargeRepository chargeRepository) {
this.chargeRepository = chargeRepository;
}
public Set<LoanCharge> assembleFrom(final LoanChargeCommand[] charges) {
final Set<LoanCharge> loanCharges = new HashSet<LoanCharge>();
// FIXME - KW - what if loanChargeCommands contains the actual loanCharge id, use loanChargeRepository to fetch it then.
if (charges != null) {
for (LoanChargeCommand loanChargeCommand : charges) {
Charge chargeDefinition = this.chargeRepository.findOne(loanChargeCommand.getChargeId());
LoanCharge loanCharge = LoanCharge.createNew(chargeDefinition, loanChargeCommand);
loanCharges.add(loanCharge);
}
}
return loanCharges;
}
}
@@ -99,7 +99,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
final LoanScheduleMapper rm = new LoanScheduleMapper(disbursement); final LoanScheduleMapper rm = new LoanScheduleMapper(disbursement);
final String sql = "select " + rm.loanScheduleSchema() + " where l.id = ? order by ls.loan_id, ls.installment"; final String sql = "select " + rm.loanScheduleSchema() + " where l.id = ? order by ls.loan_id, ls.installment";
final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursement(disbursement.disbursementDate(), disbursement.amount()); // FIXME - KW - pass through total chargesDueAtTimeOfDisbursementFigure
final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursementOnlyPeriod(disbursement.disbursementDate(), disbursement.amount(), BigDecimal.ZERO);
final Collection<LoanSchedulePeriodData> repaymentSchedulePeriods = this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); final Collection<LoanSchedulePeriodData> repaymentSchedulePeriods = this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
@@ -12,6 +12,7 @@ import org.mifosng.platform.api.LoanScheduleNewData;
import org.mifosng.platform.api.commands.AdjustLoanTransactionCommand; import org.mifosng.platform.api.commands.AdjustLoanTransactionCommand;
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand; import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
import org.mifosng.platform.api.commands.LoanApplicationCommand; import org.mifosng.platform.api.commands.LoanApplicationCommand;
import org.mifosng.platform.api.commands.LoanChargeCommand;
import org.mifosng.platform.api.commands.LoanStateTransitionCommand; import org.mifosng.platform.api.commands.LoanStateTransitionCommand;
import org.mifosng.platform.api.commands.LoanTransactionCommand; import org.mifosng.platform.api.commands.LoanTransactionCommand;
import org.mifosng.platform.api.commands.UndoStateTransitionCommand; import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
@@ -342,13 +343,21 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
Integer interestMethod = loan.repaymentScheduleDetail().getInterestMethod().getValue(); Integer interestMethod = loan.repaymentScheduleDetail().getInterestMethod().getValue();
Integer interestCalculationInPeriod = loan.repaymentScheduleDetail().getInterestCalculationPeriodMethod().getValue(); Integer interestCalculationInPeriod = loan.repaymentScheduleDetail().getInterestCalculationPeriodMethod().getValue();
Set<LoanCharge> loanCharges = loan.getCharges();
List<LoanChargeCommand> commands = new ArrayList<LoanChargeCommand>();
for (LoanCharge loanCharge : loanCharges) {
commands.add(loanCharge.toData());
}
LoanChargeCommand[] loanChargeCommands = commands.toArray(new LoanChargeCommand[commands.size()]);
CalculateLoanScheduleCommand calculateCommand = new CalculateLoanScheduleCommand( CalculateLoanScheduleCommand calculateCommand = new CalculateLoanScheduleCommand(
loan.loanProduct().getId(), loan.loanProduct().getId(),
principalAsDecimal, principalAsDecimal,
interestRatePerPeriod, interestRateFrequencyMethod, interestMethod, interestCalculationInPeriod, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod, interestCalculationInPeriod,
repaidEvery, selectedRepaymentFrequency, numberOfInstallments, selectedAmortizationMethod, repaidEvery, selectedRepaymentFrequency, numberOfInstallments, selectedAmortizationMethod,
loanTermFrequency, loanTermFrequencyType, loanTermFrequency, loanTermFrequencyType,
actualDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate); actualDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate, loanChargeCommands);
LoanScheduleNewData loanSchedule = this.calculationPlatformService.calculateLoanScheduleNew(calculateCommand); LoanScheduleNewData loanSchedule = this.calculationPlatformService.calculateLoanScheduleNew(calculateCommand);
@@ -167,7 +167,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
} }
@Override @Override
public LoanProductData mapRow(final ResultSet rs, final int rowNum) public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -246,7 +246,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
} }
@Override @Override
public LoanProductLookup mapRow(final ResultSet rs, final int rowNum) public LoanProductLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -2,10 +2,12 @@ package org.mifosng.platform.loanschedule.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Set;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.LoanScheduleNewData; import org.mifosng.platform.api.LoanScheduleNewData;
import org.mifosng.platform.currency.domain.ApplicationCurrency; import org.mifosng.platform.currency.domain.ApplicationCurrency;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
public interface AmortizationLoanScheduleGenerator { public interface AmortizationLoanScheduleGenerator {
@@ -18,5 +20,6 @@ public interface AmortizationLoanScheduleGenerator {
LocalDate interestCalculatedFrom, LocalDate interestCalculatedFrom,
BigDecimal periodInterestRateForRepaymentPeriod, BigDecimal periodInterestRateForRepaymentPeriod,
LocalDate idealDisbursementDateBasedOnFirstRepaymentDate, LocalDate idealDisbursementDateBasedOnFirstRepaymentDate,
List<LocalDate> scheduledDates); List<LocalDate> scheduledDates,
Set<LoanCharge> loanCharges);
} }
@@ -2,11 +2,13 @@ package org.mifosng.platform.loanschedule.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Set;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.LoanScheduleNewData; import org.mifosng.platform.api.LoanScheduleNewData;
import org.mifosng.platform.currency.domain.ApplicationCurrency; import org.mifosng.platform.currency.domain.ApplicationCurrency;
import org.mifosng.platform.loan.domain.AmortizationMethod; import org.mifosng.platform.loan.domain.AmortizationMethod;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
@@ -41,7 +43,8 @@ public class DecliningBalanceMethodLoanScheduleGenerator implements LoanSchedule
final PeriodFrequencyType loanTermFrequencyType, final PeriodFrequencyType loanTermFrequencyType,
final LocalDate disbursementDate, final LocalDate disbursementDate,
final LocalDate firstRepaymentDate, final LocalDate firstRepaymentDate,
final LocalDate interestCalculatedFrom) { final LocalDate interestCalculatedFrom,
final Set<LoanCharge> loanCharges) {
// 1. generate valid set of 'due dates' based on some of the 'loan attributes' // 1. generate valid set of 'due dates' based on some of the 'loan attributes'
final List<LocalDate> scheduledDates = this.scheduledDateGenerator.generate(loanScheduleInfo, disbursementDate, firstRepaymentDate); final List<LocalDate> scheduledDates = this.scheduledDateGenerator.generate(loanScheduleInfo, disbursementDate, firstRepaymentDate);
@@ -61,6 +64,6 @@ public class DecliningBalanceMethodLoanScheduleGenerator implements LoanSchedule
interestCalculatedFrom, interestCalculatedFrom,
periodInterestRateForRepaymentPeriod, periodInterestRateForRepaymentPeriod,
idealDisbursementDateBasedOnFirstRepaymentDate, idealDisbursementDateBasedOnFirstRepaymentDate,
scheduledDates); scheduledDates, loanCharges);
} }
} }
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
import org.joda.time.Days; import org.joda.time.Days;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@@ -13,6 +14,7 @@ import org.mifosng.platform.api.data.LoanSchedulePeriodData;
import org.mifosng.platform.currency.domain.ApplicationCurrency; import org.mifosng.platform.currency.domain.ApplicationCurrency;
import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.MonetaryCurrency;
import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.currency.domain.Money;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
/** /**
@@ -33,7 +35,8 @@ public class EqualInstallmentsAmortizationLoanScheduleGenerator implements Amort
final LocalDate interestCalculatedFrom, final LocalDate interestCalculatedFrom,
final BigDecimal periodInterestRateForRepaymentPeriod, final BigDecimal periodInterestRateForRepaymentPeriod,
final LocalDate idealDisbursementDateBasedOnFirstRepaymentDate, final LocalDate idealDisbursementDateBasedOnFirstRepaymentDate,
final List<LocalDate> scheduledDates) { final List<LocalDate> scheduledDates,
final Set<LoanCharge> loanCharges) {
final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>(); final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>();
@@ -44,6 +47,7 @@ public class EqualInstallmentsAmortizationLoanScheduleGenerator implements Amort
Money totalInterestDue = totalRepaymentDueForLoanTerm.minus(loanScheduleInfo.getPrincipal()); Money totalInterestDue = totalRepaymentDueForLoanTerm.minus(loanScheduleInfo.getPrincipal());
Money outstandingBalance = loanScheduleInfo.getPrincipal(); Money outstandingBalance = loanScheduleInfo.getPrincipal();
Money principalDisbursed = loanScheduleInfo.getPrincipal();
Money totalPrincipal = Money.zero(monetaryCurrency); Money totalPrincipal = Money.zero(monetaryCurrency);
Money totalInterest = Money.zero(monetaryCurrency); Money totalInterest = Money.zero(monetaryCurrency);
@@ -54,16 +58,25 @@ public class EqualInstallmentsAmortizationLoanScheduleGenerator implements Amort
scheduledDates, scheduledDates,
idealDisbursementDateBasedOnFirstRepaymentDate); idealDisbursementDateBasedOnFirstRepaymentDate);
BigDecimal chargesDueAtTimeOfDisbursement = BigDecimal.ZERO;
for (LoanCharge loanCharge : loanCharges) {
// FIXME - KW - right now only charges at disbursement are supported.
if (loanCharge.isDueAtDisbursement()) {
chargesDueAtTimeOfDisbursement = chargesDueAtTimeOfDisbursement.add(loanCharge.calculateMonetaryAmount(principalDisbursed));
}
}
BigDecimal cumulativeChargesToDate = chargesDueAtTimeOfDisbursement;
// create entries of disbursement period on loan schedule // create entries of disbursement period on loan schedule
final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursement(disbursementDate, loanScheduleInfo.getPrincipal().getAmount()); final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursementOnlyPeriod(disbursementDate, principalDisbursed.getAmount(), chargesDueAtTimeOfDisbursement);
periods.add(disbursementPeriod); periods.add(disbursementPeriod);
int loanTermInDays = Integer.valueOf(0); int loanTermInDays = Integer.valueOf(0);
BigDecimal cumulativePrincipalDisbursed = loanScheduleInfo.getPrincipal().getAmount(); BigDecimal cumulativePrincipalDisbursed = loanScheduleInfo.getPrincipal().getAmount();
BigDecimal cumulativePrincipalDue = BigDecimal.ZERO; BigDecimal cumulativePrincipalDue = BigDecimal.ZERO;
BigDecimal cumulativeInterestExpected = BigDecimal.ZERO; BigDecimal cumulativeInterestExpected = BigDecimal.ZERO;
BigDecimal cumulativeChargesToDate = BigDecimal.ZERO; BigDecimal totalExpectedRepayment = chargesDueAtTimeOfDisbursement;
BigDecimal totalExpectedRepayment = BigDecimal.ZERO;
LocalDate startDate = disbursementDate; LocalDate startDate = disbursementDate;
int periodNumber = 1; int periodNumber = 1;
@@ -110,7 +123,7 @@ public class EqualInstallmentsAmortizationLoanScheduleGenerator implements Amort
outstandingBalance = outstandingBalance.minus(principalForInstallment); outstandingBalance = outstandingBalance.minus(principalForInstallment);
LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentPeriod(periodNumber, startDate, LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, startDate,
scheduledDueDate, scheduledDueDate,
principalForInstallment.getAmount(), principalForInstallment.getAmount(),
outstandingBalance.getAmount(), outstandingBalance.getAmount(),
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
import org.joda.time.Days; import org.joda.time.Days;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@@ -13,6 +14,7 @@ import org.mifosng.platform.api.data.LoanSchedulePeriodData;
import org.mifosng.platform.currency.domain.ApplicationCurrency; import org.mifosng.platform.currency.domain.ApplicationCurrency;
import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.MonetaryCurrency;
import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.currency.domain.Money;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
public class EqualPrincipalAmortizationLoanScheduleGenerator implements AmortizationLoanScheduleGenerator { public class EqualPrincipalAmortizationLoanScheduleGenerator implements AmortizationLoanScheduleGenerator {
@@ -22,13 +24,15 @@ public class EqualPrincipalAmortizationLoanScheduleGenerator implements Amortiza
@Override @Override
public LoanScheduleNewData generate( public LoanScheduleNewData generate(
ApplicationCurrency currency, final ApplicationCurrency currency,
LoanProductRelatedDetail loanScheduleInfo, final LoanProductRelatedDetail loanScheduleInfo,
LocalDate disbursementDate, LocalDate firstRepaymentDate, final LocalDate disbursementDate,
LocalDate interestCalculatedFrom, final LocalDate firstRepaymentDate,
BigDecimal periodInterestRateForRepaymentPeriod, final LocalDate interestCalculatedFrom,
LocalDate idealDisbursementDateBasedOnFirstRepaymentDate, final BigDecimal periodInterestRateForRepaymentPeriod,
List<LocalDate> scheduledDates) { final LocalDate idealDisbursementDateBasedOnFirstRepaymentDate,
final List<LocalDate> scheduledDates,
final Set<LoanCharge> loanCharges) {
final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>(); final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>();
@@ -37,22 +41,32 @@ public class EqualPrincipalAmortizationLoanScheduleGenerator implements Amortiza
Money totalDuePerInstallment = Money.zero(monetaryCurrency); Money totalDuePerInstallment = Money.zero(monetaryCurrency);
Money outstandingBalance = loanScheduleInfo.getPrincipal(); Money outstandingBalance = loanScheduleInfo.getPrincipal();
Money principalDisbursed = loanScheduleInfo.getPrincipal();
Money totalPrincipal = Money.zero(monetaryCurrency); Money totalPrincipal = Money.zero(monetaryCurrency);
Money totalInterest = Money.zero(monetaryCurrency); Money totalInterest = Money.zero(monetaryCurrency);
double interestCalculationGraceOnRepaymentPeriodFraction = this.paymentPeriodsInOneYearCalculator.calculateRepaymentPeriodAsAFractionOfDays(loanScheduleInfo.getRepaymentPeriodFrequencyType(), double interestCalculationGraceOnRepaymentPeriodFraction = this.paymentPeriodsInOneYearCalculator.calculateRepaymentPeriodAsAFractionOfDays(loanScheduleInfo.getRepaymentPeriodFrequencyType(),
loanScheduleInfo.getRepayEvery(), interestCalculatedFrom, scheduledDates, idealDisbursementDateBasedOnFirstRepaymentDate); loanScheduleInfo.getRepayEvery(), interestCalculatedFrom, scheduledDates, idealDisbursementDateBasedOnFirstRepaymentDate);
BigDecimal chargesDueAtTimeOfDisbursement = BigDecimal.ZERO;
for (LoanCharge loanCharge : loanCharges) {
// FIXME - KW - right now only charges at disbursement are supported.
if (loanCharge.isDueAtDisbursement()) {
chargesDueAtTimeOfDisbursement = chargesDueAtTimeOfDisbursement.add(loanCharge.calculateMonetaryAmount(principalDisbursed));
}
}
BigDecimal cumulativeChargesToDate = chargesDueAtTimeOfDisbursement;
// create entries of disbursement period on loan schedule // create entries of disbursement period on loan schedule
final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursement(disbursementDate, loanScheduleInfo.getPrincipal().getAmount()); final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursementOnlyPeriod(disbursementDate, principalDisbursed.getAmount(), chargesDueAtTimeOfDisbursement);
periods.add(disbursementPeriod); periods.add(disbursementPeriod);
int loanTermInDays = Integer.valueOf(0); int loanTermInDays = Integer.valueOf(0);
BigDecimal cumulativePrincipalDisbursed = loanScheduleInfo.getPrincipal().getAmount(); BigDecimal cumulativePrincipalDisbursed = principalDisbursed.getAmount();
BigDecimal cumulativePrincipalDue = BigDecimal.ZERO; BigDecimal cumulativePrincipalDue = BigDecimal.ZERO;
BigDecimal cumulativeInterestExpected = BigDecimal.ZERO; BigDecimal cumulativeInterestExpected = BigDecimal.ZERO;
BigDecimal cumulativeChargesToDate = BigDecimal.ZERO; BigDecimal totalExpectedRepayment = chargesDueAtTimeOfDisbursement;
BigDecimal totalExpectedRepayment = BigDecimal.ZERO;
LocalDate startDate = disbursementDate; LocalDate startDate = disbursementDate;
int periodNumber = 1; int periodNumber = 1;
@@ -90,7 +104,7 @@ public class EqualPrincipalAmortizationLoanScheduleGenerator implements Amortiza
outstandingBalance = outstandingBalance.minus(principalForInstallment); outstandingBalance = outstandingBalance.minus(principalForInstallment);
LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentPeriod(periodNumber, startDate, LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, startDate,
scheduledDueDate, scheduledDueDate,
principalForInstallment.getAmount(), principalForInstallment.getAmount(),
outstandingBalance.getAmount(), outstandingBalance.getAmount(),
@@ -6,6 +6,7 @@ import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
import org.joda.time.Days; import org.joda.time.Days;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@@ -15,6 +16,7 @@ import org.mifosng.platform.api.data.LoanSchedulePeriodData;
import org.mifosng.platform.currency.domain.ApplicationCurrency; import org.mifosng.platform.currency.domain.ApplicationCurrency;
import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.MonetaryCurrency;
import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.currency.domain.Money;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
@@ -31,7 +33,8 @@ public class FlatMethodLoanScheduleGenerator implements LoanScheduleGenerator {
final PeriodFrequencyType loanTermFrequencyType, final PeriodFrequencyType loanTermFrequencyType,
final LocalDate disbursementDate, final LocalDate disbursementDate,
final LocalDate firstRepaymentDate, final LocalDate firstRepaymentDate,
final LocalDate interestCalculatedFrom) { final LocalDate interestCalculatedFrom,
final Set<LoanCharge> loanCharges) {
final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>(); final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>();
@@ -56,19 +59,29 @@ public class FlatMethodLoanScheduleGenerator implements LoanScheduleGenerator {
RoundingMode.HALF_EVEN); RoundingMode.HALF_EVEN);
Money outstandingBalance = loanScheduleInfo.getPrincipal(); Money outstandingBalance = loanScheduleInfo.getPrincipal();
Money principalDisbursed = loanScheduleInfo.getPrincipal();
Money totalPrincipal = Money.zero(outstandingBalance.getCurrency()); Money totalPrincipal = Money.zero(outstandingBalance.getCurrency());
Money totalInterest = Money.zero(outstandingBalance.getCurrency()); Money totalInterest = Money.zero(outstandingBalance.getCurrency());
BigDecimal chargesDueAtTimeOfDisbursement = BigDecimal.ZERO;
for (LoanCharge loanCharge : loanCharges) {
// FIXME - KW - right now only charges at disbursement are supported.
if (loanCharge.isDueAtDisbursement()) {
chargesDueAtTimeOfDisbursement = chargesDueAtTimeOfDisbursement.add(loanCharge.calculateMonetaryAmount(principalDisbursed));
}
}
BigDecimal cumulativeChargesToDate = chargesDueAtTimeOfDisbursement;
// create entries of disbursement period on loan schedule // create entries of disbursement period on loan schedule
final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursement(disbursementDate, loanScheduleInfo.getPrincipal().getAmount()); final LoanSchedulePeriodData disbursementPeriod = LoanSchedulePeriodData.disbursementOnlyPeriod(disbursementDate, principalDisbursed.getAmount(), chargesDueAtTimeOfDisbursement);
periods.add(disbursementPeriod); periods.add(disbursementPeriod);
int loanTermInDays = Integer.valueOf(0); int loanTermInDays = Integer.valueOf(0);
BigDecimal cumulativePrincipalDisbursed = loanScheduleInfo.getPrincipal().getAmount(); BigDecimal cumulativePrincipalDisbursed = principalDisbursed.getAmount();
BigDecimal cumulativePrincipalDue = BigDecimal.ZERO; BigDecimal cumulativePrincipalDue = BigDecimal.ZERO;
BigDecimal cumulativeInterestExpected = BigDecimal.ZERO; BigDecimal cumulativeInterestExpected = BigDecimal.ZERO;
BigDecimal cumulativeChargesToDate = BigDecimal.ZERO; BigDecimal totalExpectedRepayment = chargesDueAtTimeOfDisbursement;
BigDecimal totalExpectedRepayment = BigDecimal.ZERO;
LocalDate startDate = disbursementDate; LocalDate startDate = disbursementDate;
int periodNumber = 1; int periodNumber = 1;
@@ -98,7 +111,7 @@ public class FlatMethodLoanScheduleGenerator implements LoanScheduleGenerator {
Money totalInstallmentDue = principalPerInstallment.plus(interestPerInstallment); Money totalInstallmentDue = principalPerInstallment.plus(interestPerInstallment);
outstandingBalance = outstandingBalance.minus(principalPerInstallment); outstandingBalance = outstandingBalance.minus(principalPerInstallment);
LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentPeriod(periodNumber, startDate, LoanSchedulePeriodData installment = LoanSchedulePeriodData.repaymentOnlyPeriod(periodNumber, startDate,
scheduledDueDate, scheduledDueDate,
principalPerInstallment.getAmount(), principalPerInstallment.getAmount(),
outstandingBalance.getAmount(), outstandingBalance.getAmount(),
@@ -1,8 +1,11 @@
package org.mifosng.platform.loanschedule.domain; package org.mifosng.platform.loanschedule.domain;
import java.util.Set;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.LoanScheduleNewData; import org.mifosng.platform.api.LoanScheduleNewData;
import org.mifosng.platform.currency.domain.ApplicationCurrency; import org.mifosng.platform.currency.domain.ApplicationCurrency;
import org.mifosng.platform.loan.domain.LoanCharge;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
@@ -12,6 +15,6 @@ public interface LoanScheduleGenerator {
LoanProductRelatedDetail loanScheduleInfo, LoanProductRelatedDetail loanScheduleInfo,
Integer loanTermFrequency, Integer loanTermFrequency,
PeriodFrequencyType loanTermFrequencyType, PeriodFrequencyType loanTermFrequencyType,
LocalDate disbursementDate, LocalDate firstRepaymentDate, LocalDate interestCalculatedFrom); LocalDate disbursementDate, LocalDate firstRepaymentDate, LocalDate interestCalculatedFrom, Set<LoanCharge> loanCharges);
} }
@@ -51,7 +51,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
} }
@Override @Override
public OfficeData mapRow(final ResultSet rs, final int rowNum) public OfficeData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -79,7 +79,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
} }
@Override @Override
public OfficeLookup mapRow(final ResultSet rs, final int rowNum) public OfficeLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -106,7 +106,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
} }
@Override @Override
public OfficeTransactionData mapRow(final ResultSet rs, final int rowNum) public OfficeTransactionData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -165,7 +165,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
} }
@Override @Override
public DepositAccountData mapRow(ResultSet rs, int rowNum) public DepositAccountData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -229,7 +229,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
} }
@Override @Override
public DepositAccountTransactionData mapRow(ResultSet rs, int rowNum) public DepositAccountTransactionData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum)
throws SQLException { throws SQLException {
Long transactionId = rs.getLong("transactionId"); Long transactionId = rs.getLong("transactionId");
@@ -79,7 +79,7 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
} }
@Override @Override
public DepositProductData mapRow(ResultSet rs, int rowNum) public DepositProductData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -125,7 +125,7 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
} }
@Override @Override
public DepositProductLookup mapRow(final ResultSet rs, final int rowNum) public DepositProductLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -77,7 +77,7 @@ public class SavingProductReadPlatformServiceImpl implements
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
throw new LoanProductNotFoundException(savingProductId); throw new LoanProductNotFoundException(savingProductId);
} }
} // TODO Auto-generated method stub }
@Override @Override
public SavingProductData retrieveNewSavingProductDetails() { public SavingProductData retrieveNewSavingProductDetails() {
@@ -98,7 +98,7 @@ public class SavingProductReadPlatformServiceImpl implements
} }
@Override @Override
public SavingProductData mapRow(ResultSet rs, int rowNum) public SavingProductData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -132,7 +132,7 @@ public class SavingProductReadPlatformServiceImpl implements
} }
@Override @Override
public SavingProductLookup mapRow(final ResultSet rs, final int rowNum) public SavingProductLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -37,7 +37,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
} }
@Override @Override
public StaffData mapRow(final ResultSet rs, final int rowNum) public StaffData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -120,7 +120,7 @@ public class AppUserReadPlatformServiceImpl implements AppUserReadPlatformServic
} }
@Override @Override
public AppUserData mapRow(final ResultSet rs, final int rowNum) public AppUserData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = rs.getLong("id"); Long id = rs.getLong("id");
@@ -39,7 +39,7 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform
private static final class PermissionMapper implements RowMapper<PermissionData> { private static final class PermissionMapper implements RowMapper<PermissionData> {
@Override @Override
public PermissionData mapRow(final ResultSet rs, final int rowNum) throws SQLException { public PermissionData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
Long id = JdbcSupport.getLong(rs, "id"); Long id = JdbcSupport.getLong(rs, "id");
String name = rs.getString("name"); String name = rs.getString("name");
@@ -56,7 +56,7 @@ public class RoleReadPlatformServiceImpl implements RoleReadPlatformService {
protected static final class RoleMapper implements RowMapper<RoleData> { protected static final class RoleMapper implements RowMapper<RoleData> {
@Override @Override
public RoleData mapRow(final ResultSet rs, final int rowNum) public RoleData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException { throws SQLException {
Long id = JdbcSupport.getLong(rs, "id"); Long id = JdbcSupport.getLong(rs, "id");