update loan creation and retrieval.
This commit is contained in:
+12
-12
@@ -5,20 +5,20 @@ package org.mifosplatform.audit.api;
|
||||
*/
|
||||
public class ProcessingResultLookup {
|
||||
|
||||
private final Long id;
|
||||
private final String processingResult;
|
||||
private final Long id;
|
||||
private final String processingResult;
|
||||
|
||||
public ProcessingResultLookup(final Long id, final String processingResult) {
|
||||
this.id = id;
|
||||
this.processingResult = processingResult;
|
||||
}
|
||||
public ProcessingResultLookup(final Long id, final String processingResult) {
|
||||
this.id = id;
|
||||
this.processingResult = processingResult;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getProcessingResult() {
|
||||
return this.processingResult;
|
||||
}
|
||||
public String getProcessingResult() {
|
||||
return this.processingResult;
|
||||
}
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package org.mifosplatform.infrastructure.security.data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang.time.StopWatch;
|
||||
|
||||
/**
|
||||
* Immutable data object representing platform API request used for
|
||||
* logging/debugging.
|
||||
*/
|
||||
public class PlatformRequestLog {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long startTime;
|
||||
@SuppressWarnings("unused")
|
||||
private long totalTime;
|
||||
@SuppressWarnings("unused")
|
||||
private final String method;
|
||||
@SuppressWarnings("unused")
|
||||
private String url;
|
||||
@SuppressWarnings("unused")
|
||||
private Map<String, String> parameters;
|
||||
|
||||
public static PlatformRequestLog from(final StopWatch task, final HttpServletRequest request) throws IOException {
|
||||
|
||||
final String requestUrl = request.getRequestURL().toString();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> parameters = new HashMap<String, String>(request.getParameterMap());
|
||||
parameters.remove("password");
|
||||
parameters.remove("_");
|
||||
|
||||
return new PlatformRequestLog(task.getStartTime(), task.getTime(), request.getMethod(), requestUrl, parameters);
|
||||
}
|
||||
|
||||
private PlatformRequestLog(final long startTime, final long time, final String method, final String requestUrl,
|
||||
final Map<String, String> parameters) {
|
||||
this.startTime = startTime;
|
||||
this.totalTime = time;
|
||||
this.method = method;
|
||||
this.url = requestUrl;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -9,10 +9,15 @@ import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.time.StopWatch;
|
||||
import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant;
|
||||
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.mifosplatform.infrastructure.security.data.PlatformRequestLog;
|
||||
import org.mifosplatform.infrastructure.security.exception.InvalidTenantIdentiferException;
|
||||
import org.mifosplatform.infrastructure.security.service.TenantDetailsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
@@ -36,9 +41,14 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
|
||||
*/
|
||||
public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFilter {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(TenantAwareBasicAuthenticationFilter.class);
|
||||
|
||||
@Autowired
|
||||
private TenantDetailsService tenantDetailsService;
|
||||
|
||||
@Autowired
|
||||
private ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer;
|
||||
|
||||
private String tenantRequestHeader = "X-Mifos-Platform-TenantId";
|
||||
private boolean exceptionIfHeaderMissing = true;
|
||||
|
||||
@@ -53,6 +63,9 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
|
||||
StopWatch task = new StopWatch();
|
||||
task.start();
|
||||
|
||||
try {
|
||||
|
||||
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
||||
@@ -83,7 +96,9 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
||||
response.addHeader("WWW-Authenticate", "Basic realm=\"" + "Mifos Platform API" + "\"");
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
|
||||
} finally {
|
||||
|
||||
task.stop();
|
||||
final PlatformRequestLog log = PlatformRequestLog.from(task, request);
|
||||
logger.info(toApiJsonSerializer.serialize(log));
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -116,6 +116,12 @@ public class LoanApplicationCommand {
|
||||
baseDataValidator.reset().parameter("groupId").value(this.groupId).mustBeBlankWhenParameterProvided("clientId", this.clientId)
|
||||
.longGreaterThanZero();
|
||||
}
|
||||
|
||||
if (this.clientId == null && this.groupId == null) {
|
||||
baseDataValidator.reset().parameter("clientId").value(this.clientId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
baseDataValidator.reset().parameter("productId").value(this.productId).notNull().integerGreaterThanZero();
|
||||
|
||||
if (this.submittedOnDate == null) {
|
||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.submitted.on.date.cannot.be.blank",
|
||||
|
||||
+146
-165
@@ -20,174 +20,155 @@ import org.mifosplatform.portfolio.loanproduct.data.TransactionProcessingStrateg
|
||||
@SuppressWarnings("unused")
|
||||
public class LoanAccountData {
|
||||
|
||||
// basic loan details
|
||||
private final Long id;
|
||||
private final String externalId;
|
||||
private final Long clientId;
|
||||
private final String clientName;
|
||||
private final Long groupId;
|
||||
private final String groupName;
|
||||
private final Long loanProductId;
|
||||
private final String loanProductName;
|
||||
private final String loanProductDescription;
|
||||
private final EnumOptionData status;
|
||||
private final Long fundId;
|
||||
private final String fundName;
|
||||
private final Long loanOfficerId;
|
||||
private final String loanOfficerName;
|
||||
private final CurrencyData currency;
|
||||
private final BigDecimal principal;
|
||||
private final BigDecimal inArrearsTolerance;
|
||||
|
||||
private final Integer termFrequency;
|
||||
private final EnumOptionData termPeriodFrequencyType;
|
||||
private final Integer numberOfRepayments;
|
||||
private final Integer repaymentEvery;
|
||||
private final EnumOptionData repaymentFrequencyType;
|
||||
private final Integer transactionStrategyId;
|
||||
private final EnumOptionData amortizationType;
|
||||
private final BigDecimal interestRatePerPeriod;
|
||||
private final EnumOptionData interestRateFrequencyType;
|
||||
private final BigDecimal annualInterestRate;
|
||||
private final EnumOptionData interestType;
|
||||
private final EnumOptionData interestCalculationPeriodType;
|
||||
|
||||
private final LocalDate submittedOnDate;
|
||||
private final LocalDate approvedOnDate;
|
||||
private final LocalDate expectedDisbursementDate;
|
||||
private final LocalDate actualDisbursementDate;
|
||||
private final LocalDate repaymentsStartingFromDate;
|
||||
private final LocalDate interestChargedFromDate;
|
||||
private final LocalDate closedOnDate;
|
||||
private final LocalDate expectedMaturityDate;
|
||||
private final LocalDate lifeCycleStatusDate;
|
||||
|
||||
// associations
|
||||
private final LoanScheduleData repaymentSchedule;
|
||||
private final Collection<LoanTransactionData> transactions;
|
||||
private final Collection<LoanChargeData> charges;
|
||||
private final LoanPermissionData permissions;
|
||||
private final LoanConvenienceData convenienceData;
|
||||
private final GuarantorData guarantorData;
|
||||
|
||||
// template
|
||||
private final Collection<StaffData> loanOfficerOptions;
|
||||
private final Collection<LoanProductData> productOptions;
|
||||
private final Collection<EnumOptionData> termFrequencyTypeOptions;
|
||||
private final Collection<EnumOptionData> repaymentFrequencyTypeOptions;
|
||||
private final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions;
|
||||
private final Collection<EnumOptionData> interestRateFrequencyTypeOptions;
|
||||
private final Collection<EnumOptionData> amortizationTypeOptions;
|
||||
private final Collection<EnumOptionData> interestTypeOptions;
|
||||
private final Collection<EnumOptionData> interestCalculationPeriodTypeOptions;
|
||||
private final Collection<FundData> fundOptions;
|
||||
private final Collection<ChargeData> chargeOptions;
|
||||
private final ChargeData chargeTemplate;
|
||||
|
||||
public LoanAccountData(
|
||||
final LoanBasicDetailsData basicDetails,
|
||||
final boolean convenienceDataRequired,
|
||||
final LoanScheduleData repaymentSchedule,
|
||||
final Collection<LoanTransactionData> transactions,
|
||||
final LoanPermissionData permissions,
|
||||
final Collection<LoanChargeData> charges,
|
||||
final Collection<LoanProductData> productOptions,
|
||||
final Collection<EnumOptionData> termFrequencyTypeOptions,
|
||||
final Collection<EnumOptionData> repaymentFrequencyTypeOptions,
|
||||
final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions,
|
||||
final Collection<EnumOptionData> interestRateFrequencyTypeOptions,
|
||||
final Collection<EnumOptionData> amortizationTypeOptions,
|
||||
final Collection<EnumOptionData> interestTypeOptions,
|
||||
final Collection<EnumOptionData> interestCalculationPeriodTypeOptions,
|
||||
final Collection<FundData> fundOptions,
|
||||
final Collection<ChargeData> chargeOptions,
|
||||
final ChargeData chargeTemplate,
|
||||
final Collection<StaffData> loanOfficerOptions,
|
||||
final GuarantorData guarantorData) {
|
||||
this.repaymentSchedule = repaymentSchedule;
|
||||
this.transactions = transactions;
|
||||
this.permissions = permissions;
|
||||
// basic loan details
|
||||
private final Long id;
|
||||
private final String externalId;
|
||||
private final Long clientId;
|
||||
private final String clientName;
|
||||
private final Long groupId;
|
||||
private final String groupName;
|
||||
private final Long loanProductId;
|
||||
private final String loanProductName;
|
||||
private final String loanProductDescription;
|
||||
private final EnumOptionData status;
|
||||
private final Long fundId;
|
||||
private final String fundName;
|
||||
private final Long loanOfficerId;
|
||||
private final String loanOfficerName;
|
||||
private final CurrencyData currency;
|
||||
private final BigDecimal principal;
|
||||
private final BigDecimal inArrearsTolerance;
|
||||
|
||||
private final Integer termFrequency;
|
||||
private final EnumOptionData termPeriodFrequencyType;
|
||||
private final Integer numberOfRepayments;
|
||||
private final Integer repaymentEvery;
|
||||
private final EnumOptionData repaymentFrequencyType;
|
||||
private final Integer transactionProcessingStrategyId;
|
||||
private final EnumOptionData amortizationType;
|
||||
private final BigDecimal interestRatePerPeriod;
|
||||
private final EnumOptionData interestRateFrequencyType;
|
||||
private final BigDecimal annualInterestRate;
|
||||
private final EnumOptionData interestType;
|
||||
private final EnumOptionData interestCalculationPeriodType;
|
||||
|
||||
private final LocalDate submittedOnDate;
|
||||
private final LocalDate approvedOnDate;
|
||||
private final LocalDate expectedDisbursementDate;
|
||||
private final LocalDate actualDisbursementDate;
|
||||
private final LocalDate repaymentsStartingFromDate;
|
||||
private final LocalDate interestChargedFromDate;
|
||||
private final LocalDate closedOnDate;
|
||||
private final LocalDate expectedMaturityDate;
|
||||
private final LocalDate lifeCycleStatusDate;
|
||||
|
||||
// associations
|
||||
private final LoanScheduleData repaymentSchedule;
|
||||
private final Collection<LoanTransactionData> transactions;
|
||||
private final Collection<LoanChargeData> charges;
|
||||
private final LoanPermissionData permissions;
|
||||
private final LoanConvenienceData convenienceData;
|
||||
private final GuarantorData guarantorData;
|
||||
|
||||
// template
|
||||
private final Collection<StaffData> loanOfficerOptions;
|
||||
private final Collection<LoanProductData> productOptions;
|
||||
private final Collection<EnumOptionData> termFrequencyTypeOptions;
|
||||
private final Collection<EnumOptionData> repaymentFrequencyTypeOptions;
|
||||
private final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions;
|
||||
private final Collection<EnumOptionData> interestRateFrequencyTypeOptions;
|
||||
private final Collection<EnumOptionData> amortizationTypeOptions;
|
||||
private final Collection<EnumOptionData> interestTypeOptions;
|
||||
private final Collection<EnumOptionData> interestCalculationPeriodTypeOptions;
|
||||
private final Collection<FundData> fundOptions;
|
||||
private final Collection<ChargeData> chargeOptions;
|
||||
private final ChargeData chargeTemplate;
|
||||
|
||||
public LoanAccountData(final LoanBasicDetailsData basicDetails, final boolean convenienceDataRequired,
|
||||
final LoanScheduleData repaymentSchedule, final Collection<LoanTransactionData> transactions,
|
||||
final LoanPermissionData permissions, final Collection<LoanChargeData> charges,
|
||||
final Collection<LoanProductData> productOptions, final Collection<EnumOptionData> termFrequencyTypeOptions,
|
||||
final Collection<EnumOptionData> repaymentFrequencyTypeOptions,
|
||||
final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions,
|
||||
final Collection<EnumOptionData> interestRateFrequencyTypeOptions, final Collection<EnumOptionData> amortizationTypeOptions,
|
||||
final Collection<EnumOptionData> interestTypeOptions, final Collection<EnumOptionData> interestCalculationPeriodTypeOptions,
|
||||
final Collection<FundData> fundOptions, final Collection<ChargeData> chargeOptions, final ChargeData chargeTemplate,
|
||||
final Collection<StaffData> loanOfficerOptions, final GuarantorData guarantorData) {
|
||||
this.repaymentSchedule = repaymentSchedule;
|
||||
this.transactions = transactions;
|
||||
this.permissions = permissions;
|
||||
this.charges = charges;
|
||||
this.productOptions = productOptions;
|
||||
this.termFrequencyTypeOptions = termFrequencyTypeOptions;
|
||||
this.repaymentFrequencyTypeOptions = repaymentFrequencyTypeOptions;
|
||||
this.repaymentStrategyOptions = repaymentStrategyOptions;
|
||||
this.interestRateFrequencyTypeOptions = interestRateFrequencyTypeOptions;
|
||||
this.amortizationTypeOptions = amortizationTypeOptions;
|
||||
this.interestTypeOptions = interestTypeOptions;
|
||||
this.interestCalculationPeriodTypeOptions = interestCalculationPeriodTypeOptions;
|
||||
this.fundOptions = fundOptions;
|
||||
this.chargeOptions = chargeOptions;
|
||||
this.productOptions = productOptions;
|
||||
this.termFrequencyTypeOptions = termFrequencyTypeOptions;
|
||||
this.repaymentFrequencyTypeOptions = repaymentFrequencyTypeOptions;
|
||||
this.repaymentStrategyOptions = repaymentStrategyOptions;
|
||||
this.interestRateFrequencyTypeOptions = interestRateFrequencyTypeOptions;
|
||||
this.amortizationTypeOptions = amortizationTypeOptions;
|
||||
this.interestTypeOptions = interestTypeOptions;
|
||||
this.interestCalculationPeriodTypeOptions = interestCalculationPeriodTypeOptions;
|
||||
this.fundOptions = fundOptions;
|
||||
this.chargeOptions = chargeOptions;
|
||||
this.chargeTemplate = chargeTemplate;
|
||||
this.loanOfficerOptions = loanOfficerOptions;
|
||||
this.guarantorData = guarantorData;
|
||||
this.loanOfficerOptions = loanOfficerOptions;
|
||||
this.guarantorData = guarantorData;
|
||||
|
||||
if (convenienceDataRequired) {
|
||||
int maxSubmittedOnOffsetFromToday = basicDetails
|
||||
.getMaxSubmittedOnOffsetFromToday();
|
||||
int maxApprovedOnOffsetFromToday = basicDetails
|
||||
.getMaxApprovedOnOffsetFromToday();
|
||||
int maxDisbursedOnOffsetFromToday = basicDetails
|
||||
.getMaxDisbursedOnOffsetFromToday();
|
||||
int expectedLoanTermInDays = basicDetails.getLoanTermInDays();
|
||||
int expectedLoanTermInMonths = basicDetails.getLoanTermInMonths();
|
||||
int actualLoanTermInDays = basicDetails.getActualLoanTermInDays();
|
||||
int actualLoanTermInMonths = basicDetails.getActualLoanTermInMonths();
|
||||
|
||||
this.convenienceData = new LoanConvenienceData(
|
||||
maxSubmittedOnOffsetFromToday, maxApprovedOnOffsetFromToday,
|
||||
maxDisbursedOnOffsetFromToday, expectedLoanTermInDays,
|
||||
actualLoanTermInDays, expectedLoanTermInMonths,
|
||||
actualLoanTermInMonths);
|
||||
} else {
|
||||
this.convenienceData = null;
|
||||
}
|
||||
if (convenienceDataRequired) {
|
||||
int maxSubmittedOnOffsetFromToday = basicDetails.getMaxSubmittedOnOffsetFromToday();
|
||||
int maxApprovedOnOffsetFromToday = basicDetails.getMaxApprovedOnOffsetFromToday();
|
||||
int maxDisbursedOnOffsetFromToday = basicDetails.getMaxDisbursedOnOffsetFromToday();
|
||||
int expectedLoanTermInDays = basicDetails.getLoanTermInDays();
|
||||
int expectedLoanTermInMonths = basicDetails.getLoanTermInMonths();
|
||||
int actualLoanTermInDays = basicDetails.getActualLoanTermInDays();
|
||||
int actualLoanTermInMonths = basicDetails.getActualLoanTermInMonths();
|
||||
|
||||
this.id = basicDetails.getId();
|
||||
this.externalId = basicDetails.getExternalId();
|
||||
this.clientId = basicDetails.getClientId();
|
||||
this.clientName = basicDetails.getClientName();
|
||||
this.groupId = basicDetails.getGroupId();
|
||||
this.groupName = basicDetails.getGroupName();
|
||||
this.loanProductId = basicDetails.getLoanProductId();
|
||||
this.loanProductName = basicDetails.getLoanProductName();
|
||||
this.loanProductDescription = basicDetails.getLoanProductDescription();
|
||||
this.fundId = basicDetails.getFundId();
|
||||
this.fundName = basicDetails.getFundName();
|
||||
this.loanOfficerId = basicDetails.getLoanOfficerId();
|
||||
this.loanOfficerName = basicDetails.getLoanOfficerName();
|
||||
this.convenienceData = new LoanConvenienceData(maxSubmittedOnOffsetFromToday, maxApprovedOnOffsetFromToday,
|
||||
maxDisbursedOnOffsetFromToday, expectedLoanTermInDays, actualLoanTermInDays, expectedLoanTermInMonths,
|
||||
actualLoanTermInMonths);
|
||||
} else {
|
||||
this.convenienceData = null;
|
||||
}
|
||||
|
||||
|
||||
this.submittedOnDate = basicDetails.getSubmittedOnDate();
|
||||
this.approvedOnDate = basicDetails.getApprovedOnDate();
|
||||
this.expectedDisbursementDate = basicDetails
|
||||
.getExpectedDisbursementDate();
|
||||
this.actualDisbursementDate = basicDetails.getActualDisbursementDate();
|
||||
this.closedOnDate = basicDetails.getClosedOnDate();
|
||||
this.expectedMaturityDate = basicDetails.getExpectedMaturityDate();
|
||||
this.repaymentsStartingFromDate = basicDetails.getRepaymentsStartingFromDate();
|
||||
this.interestChargedFromDate = basicDetails.getInterestChargedFromDate();
|
||||
|
||||
this.currency = basicDetails.getCurrency();
|
||||
this.principal = basicDetails.getPrincipal();
|
||||
this.inArrearsTolerance = basicDetails.getInArrearsTolerance();
|
||||
|
||||
this.termFrequency = basicDetails.getTermFrequency();
|
||||
this.termPeriodFrequencyType = basicDetails.getTermPeriodFrequencyType();
|
||||
this.numberOfRepayments = basicDetails.getNumberOfRepayments();
|
||||
this.repaymentEvery = basicDetails.getRepaymentEvery();
|
||||
this.transactionStrategyId = basicDetails.getTransactionStrategyId();
|
||||
this.interestRatePerPeriod = basicDetails.getInterestRatePerPeriod();
|
||||
this.annualInterestRate = basicDetails.getAnnualInterestRate();
|
||||
this.repaymentFrequencyType = basicDetails.getRepaymentFrequencyType();
|
||||
this.interestRateFrequencyType = basicDetails
|
||||
.getInterestRateFrequencyType();
|
||||
this.amortizationType = basicDetails.getAmortizationType();
|
||||
this.interestType = basicDetails.getInterestType();
|
||||
this.interestCalculationPeriodType = basicDetails
|
||||
.getInterestCalculationPeriodType();
|
||||
|
||||
this.status = basicDetails.getStatus();
|
||||
this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate();
|
||||
}
|
||||
this.id = basicDetails.getId();
|
||||
this.externalId = basicDetails.getExternalId();
|
||||
this.clientId = basicDetails.getClientId();
|
||||
this.clientName = basicDetails.getClientName();
|
||||
this.groupId = basicDetails.getGroupId();
|
||||
this.groupName = basicDetails.getGroupName();
|
||||
this.loanProductId = basicDetails.getLoanProductId();
|
||||
this.loanProductName = basicDetails.getLoanProductName();
|
||||
this.loanProductDescription = basicDetails.getLoanProductDescription();
|
||||
this.fundId = basicDetails.getFundId();
|
||||
this.fundName = basicDetails.getFundName();
|
||||
this.loanOfficerId = basicDetails.getLoanOfficerId();
|
||||
this.loanOfficerName = basicDetails.getLoanOfficerName();
|
||||
|
||||
this.submittedOnDate = basicDetails.getSubmittedOnDate();
|
||||
this.approvedOnDate = basicDetails.getApprovedOnDate();
|
||||
this.expectedDisbursementDate = basicDetails.getExpectedDisbursementDate();
|
||||
this.actualDisbursementDate = basicDetails.getActualDisbursementDate();
|
||||
this.closedOnDate = basicDetails.getClosedOnDate();
|
||||
this.expectedMaturityDate = basicDetails.getExpectedMaturityDate();
|
||||
this.repaymentsStartingFromDate = basicDetails.getRepaymentsStartingFromDate();
|
||||
this.interestChargedFromDate = basicDetails.getInterestChargedFromDate();
|
||||
|
||||
this.currency = basicDetails.getCurrency();
|
||||
this.principal = basicDetails.getPrincipal();
|
||||
this.inArrearsTolerance = basicDetails.getInArrearsTolerance();
|
||||
|
||||
this.termFrequency = basicDetails.getTermFrequency();
|
||||
this.termPeriodFrequencyType = basicDetails.getTermPeriodFrequencyType();
|
||||
this.numberOfRepayments = basicDetails.getNumberOfRepayments();
|
||||
this.repaymentEvery = basicDetails.getRepaymentEvery();
|
||||
this.transactionProcessingStrategyId = basicDetails.getTransactionStrategyId();
|
||||
this.interestRatePerPeriod = basicDetails.getInterestRatePerPeriod();
|
||||
this.annualInterestRate = basicDetails.getAnnualInterestRate();
|
||||
this.repaymentFrequencyType = basicDetails.getRepaymentFrequencyType();
|
||||
this.interestRateFrequencyType = basicDetails.getInterestRateFrequencyType();
|
||||
this.amortizationType = basicDetails.getAmortizationType();
|
||||
this.interestType = basicDetails.getInterestType();
|
||||
this.interestCalculationPeriodType = basicDetails.getInterestCalculationPeriodType();
|
||||
|
||||
this.status = basicDetails.getStatus();
|
||||
this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate();
|
||||
}
|
||||
}
|
||||
+433
-481
@@ -14,561 +14,513 @@ import org.mifosplatform.portfolio.charge.data.ChargeData;
|
||||
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
|
||||
|
||||
/**
|
||||
* Immutable data object for core details of loan to be combined with {@link LoanAccountData} usage.
|
||||
* Immutable data object for core details of loan to be combined with
|
||||
* {@link LoanAccountData} usage.
|
||||
*/
|
||||
public class LoanBasicDetailsData {
|
||||
|
||||
private final Long id;
|
||||
private final String externalId;
|
||||
private final Long clientId;
|
||||
private final Long clientOfficeId;
|
||||
private final String clientName;
|
||||
private final Long groupId;
|
||||
private final Long groupOfficeId;
|
||||
private final String groupName;
|
||||
private final Long loanProductId;
|
||||
private final String loanProductName;
|
||||
private final String loanProductDescription;
|
||||
private final EnumOptionData status;
|
||||
private final Long fundId;
|
||||
private final String fundName;
|
||||
private final Long loanOfficerId;
|
||||
private final String loanOfficerName;
|
||||
private final CurrencyData currency;
|
||||
private final BigDecimal principal;
|
||||
private final BigDecimal inArrearsTolerance;
|
||||
|
||||
private final Integer termFrequency;
|
||||
private final EnumOptionData termPeriodFrequencyType;
|
||||
private final Integer numberOfRepayments;
|
||||
private final Integer repaymentEvery;
|
||||
private final EnumOptionData repaymentFrequencyType;
|
||||
private final Integer transactionStrategyId;
|
||||
private final EnumOptionData amortizationType;
|
||||
private final BigDecimal interestRatePerPeriod;
|
||||
private final EnumOptionData interestRateFrequencyType;
|
||||
private final BigDecimal annualInterestRate;
|
||||
private final EnumOptionData interestType;
|
||||
private final EnumOptionData interestCalculationPeriodType;
|
||||
|
||||
private final LocalDate submittedOnDate;
|
||||
private final LocalDate approvedOnDate;
|
||||
private final LocalDate expectedDisbursementDate;
|
||||
private final LocalDate actualDisbursementDate;
|
||||
private final LocalDate repaymentsStartingFromDate;
|
||||
private final LocalDate interestChargedFromDate;
|
||||
private final LocalDate closedOnDate;
|
||||
private final LocalDate expectedMaturityDate;
|
||||
private final LocalDate lifeCycleStatusDate;
|
||||
|
||||
private final BigDecimal totalDisbursementCharges;
|
||||
private final Collection<LoanChargeData> charges;
|
||||
|
||||
public static LoanBasicDetailsData populateForNewIndividualClientLoanCreation(final Long clientId, final String clientName, final LocalDate expectedDisbursementDate,
|
||||
final Long clientOfficeId) {
|
||||
return new LoanBasicDetailsData(clientId, clientName, clientOfficeId, null, null, null, expectedDisbursementDate);
|
||||
}
|
||||
private final Long id;
|
||||
private final String externalId;
|
||||
private final Long clientId;
|
||||
private final Long clientOfficeId;
|
||||
private final String clientName;
|
||||
private final Long groupId;
|
||||
private final Long groupOfficeId;
|
||||
private final String groupName;
|
||||
private final Long loanProductId;
|
||||
private final String loanProductName;
|
||||
private final String loanProductDescription;
|
||||
private final EnumOptionData status;
|
||||
private final Long fundId;
|
||||
private final String fundName;
|
||||
private final Long loanOfficerId;
|
||||
private final String loanOfficerName;
|
||||
private final CurrencyData currency;
|
||||
private final BigDecimal principal;
|
||||
private final BigDecimal inArrearsTolerance;
|
||||
|
||||
public static LoanBasicDetailsData populateForNewGroupLoanCreation(final Long groupId, final String groupName,
|
||||
final LocalDate expectedDisbursementDate,
|
||||
final Long groupOfficeId){
|
||||
return new LoanBasicDetailsData(null, null, null, groupId, groupName, groupOfficeId, expectedDisbursementDate);
|
||||
}
|
||||
private final Integer termFrequency;
|
||||
private final EnumOptionData termPeriodFrequencyType;
|
||||
private final Integer numberOfRepayments;
|
||||
private final Integer repaymentEvery;
|
||||
private final EnumOptionData repaymentFrequencyType;
|
||||
private final Integer transactionProcessingStrategyId;
|
||||
private final EnumOptionData amortizationType;
|
||||
private final BigDecimal interestRatePerPeriod;
|
||||
private final EnumOptionData interestRateFrequencyType;
|
||||
private final BigDecimal annualInterestRate;
|
||||
private final EnumOptionData interestType;
|
||||
private final EnumOptionData interestCalculationPeriodType;
|
||||
|
||||
public static LoanBasicDetailsData populateForNewLoanCreation(final LoanBasicDetailsData loanAccount, final LoanProductData product) {
|
||||
|
||||
final Integer termFrequency = product.getNumberOfRepayments() * product.getRepaymentEvery();
|
||||
final EnumOptionData termPeriodFrequencyType = product.getRepaymentFrequencyType();
|
||||
private final LocalDate submittedOnDate;
|
||||
private final LocalDate approvedOnDate;
|
||||
private final LocalDate expectedDisbursementDate;
|
||||
private final LocalDate actualDisbursementDate;
|
||||
private final LocalDate repaymentsStartingFromDate;
|
||||
private final LocalDate interestChargedFromDate;
|
||||
private final LocalDate closedOnDate;
|
||||
private final LocalDate expectedMaturityDate;
|
||||
private final LocalDate lifeCycleStatusDate;
|
||||
|
||||
private final BigDecimal totalDisbursementCharges;
|
||||
private final Collection<LoanChargeData> charges;
|
||||
|
||||
public static LoanBasicDetailsData populateForNewIndividualClientLoanCreation(final Long clientId, final String clientName,
|
||||
final LocalDate expectedDisbursementDate, final Long clientOfficeId) {
|
||||
return new LoanBasicDetailsData(clientId, clientName, clientOfficeId, null, null, null, expectedDisbursementDate);
|
||||
}
|
||||
|
||||
public static LoanBasicDetailsData populateForNewGroupLoanCreation(final Long groupId, final String groupName,
|
||||
final LocalDate expectedDisbursementDate, final Long groupOfficeId) {
|
||||
return new LoanBasicDetailsData(null, null, null, groupId, groupName, groupOfficeId, expectedDisbursementDate);
|
||||
}
|
||||
|
||||
public static LoanBasicDetailsData populateForNewLoanCreation(final LoanBasicDetailsData loanAccount, final LoanProductData product) {
|
||||
|
||||
final Integer termFrequency = product.getNumberOfRepayments() * product.getRepaymentEvery();
|
||||
final EnumOptionData termPeriodFrequencyType = product.getRepaymentFrequencyType();
|
||||
final Collection<LoanChargeData> charges = new ArrayList<LoanChargeData>();
|
||||
|
||||
|
||||
for (ChargeData charge : product.charges()) {
|
||||
charges.add(LoanChargeData.newLoanChargeDetails(charge.getId(), charge.getName(), charge.getCurrency(),
|
||||
charge.getAmount(), charge.getChargeTimeType(), charge.getChargeCalculationType(), charge.isPenalty()));
|
||||
charges.add(LoanChargeData.newLoanChargeDetails(charge.getId(), charge.getName(), charge.getCurrency(), charge.getAmount(),
|
||||
charge.getChargeTimeType(), charge.getChargeCalculationType(), charge.isPenalty()));
|
||||
}
|
||||
|
||||
return new LoanBasicDetailsData(
|
||||
loanAccount.clientId, loanAccount.clientName, loanAccount.clientOfficeId,
|
||||
loanAccount.groupId, loanAccount.groupName, loanAccount.groupOfficeId,
|
||||
product.getId(), product.getName(), product.getDescription(), product.getFundId(), product.getFundName(),
|
||||
product.getCurrency(), product.getPrincipal(), product.getInArrearsTolerance(),
|
||||
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(), product.getRepaymentFrequencyType(),
|
||||
product.getTransactionProcessingStrategyId(), product.getAmortizationType(),
|
||||
product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(), product.getInterestType(), product.getInterestCalculationPeriodType(),
|
||||
loanAccount.expectedDisbursementDate, charges);
|
||||
}
|
||||
|
||||
private LoanBasicDetailsData(
|
||||
final Long clientId, final String clientName, final Long clientOfficeId,
|
||||
final Long groupId, final String groupName, final Long groupOfficeId,
|
||||
final Long productId, final String productName, final String productDescription, final Long fundId, final String fundName,
|
||||
final CurrencyData currency, final BigDecimal principal, final BigDecimal inArrearsTolerance,
|
||||
final Integer termFrequency,
|
||||
final EnumOptionData termPeriodFrequencyType,
|
||||
final Integer numberOfRepayments,
|
||||
final Integer repaymentEvery,
|
||||
final EnumOptionData repaymentFrequencyType,
|
||||
final Long transactionStrategyId,
|
||||
final EnumOptionData amortizationType,
|
||||
final BigDecimal interestRatePerPeriod,
|
||||
final EnumOptionData interestRateFrequencyType,
|
||||
final EnumOptionData interestType,
|
||||
final EnumOptionData interestCalculationPeriodType,
|
||||
final LocalDate expectedDisbursementDate, final Collection<LoanChargeData> charges) {
|
||||
this.id = null;
|
||||
this.externalId = null;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.clientOfficeId = clientOfficeId;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.groupOfficeId = groupOfficeId;
|
||||
this.loanProductId = productId;
|
||||
this.loanProductName = productName;
|
||||
this.loanProductDescription= productDescription;
|
||||
this.status = null;
|
||||
this.fundId = fundId;
|
||||
this.fundName = fundName;
|
||||
this.loanOfficerId = null;
|
||||
this.loanOfficerName = null;
|
||||
this.currency = currency;
|
||||
this.principal = principal;
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
|
||||
this.termFrequency = termFrequency;
|
||||
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
this.repaymentEvery = repaymentEvery;
|
||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||
|
||||
// FIXME - kw - settle on using either long or integer for this throughout product and account fields for loan.
|
||||
if (transactionStrategyId != null) {
|
||||
this.transactionStrategyId = transactionStrategyId.intValue();
|
||||
} else {
|
||||
this.transactionStrategyId = null;
|
||||
}
|
||||
this.amortizationType = amortizationType;
|
||||
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.annualInterestRate = null;
|
||||
this.interestRateFrequencyType = interestRateFrequencyType;
|
||||
this.interestType = interestType;
|
||||
this.interestCalculationPeriodType = interestCalculationPeriodType;
|
||||
|
||||
this.submittedOnDate = null;
|
||||
this.approvedOnDate = null;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
|
||||
this.actualDisbursementDate = null;
|
||||
this.closedOnDate = null;
|
||||
this.expectedMaturityDate = null;
|
||||
this.repaymentsStartingFromDate = null;
|
||||
this.interestChargedFromDate = null;
|
||||
this.lifeCycleStatusDate = null;
|
||||
|
||||
this.charges = charges;
|
||||
this.totalDisbursementCharges = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private LoanBasicDetailsData(final Long clientId, final String clientName, final Long clientOfficeId,
|
||||
final Long groupId, final String groupName, final Long groupOfficeId,
|
||||
final LocalDate expectedDisbursementDate) {
|
||||
this.id = null;
|
||||
this.externalId = null;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.clientOfficeId = clientOfficeId;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.groupOfficeId = groupOfficeId;
|
||||
this.loanProductId = null;
|
||||
this.loanProductName = null;
|
||||
this.loanProductDescription= null;
|
||||
this.status = null;
|
||||
this.fundId = null;
|
||||
this.fundName = null;
|
||||
this.loanOfficerId = null;
|
||||
this.loanOfficerName = null;
|
||||
this.currency = null;
|
||||
this.principal = null;
|
||||
this.inArrearsTolerance = null;
|
||||
this.termFrequency = null;
|
||||
this.termPeriodFrequencyType = null;
|
||||
this.numberOfRepayments = null;
|
||||
this.repaymentEvery = null;
|
||||
this.transactionStrategyId = null;
|
||||
this.interestRatePerPeriod = null;
|
||||
this.annualInterestRate = null;
|
||||
this.repaymentFrequencyType = null;
|
||||
this.interestRateFrequencyType = null;
|
||||
this.amortizationType = null;
|
||||
this.interestType = null;
|
||||
this.interestCalculationPeriodType = null;
|
||||
|
||||
this.lifeCycleStatusDate = null;
|
||||
|
||||
this.submittedOnDate = null;
|
||||
this.approvedOnDate = null;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
|
||||
this.actualDisbursementDate = null;
|
||||
this.closedOnDate = null;
|
||||
this.expectedMaturityDate = null;
|
||||
this.repaymentsStartingFromDate = null;
|
||||
this.interestChargedFromDate = null;
|
||||
|
||||
this.charges = null;
|
||||
this.totalDisbursementCharges = BigDecimal.ZERO;
|
||||
}
|
||||
return new LoanBasicDetailsData(loanAccount.clientId, loanAccount.clientName, loanAccount.clientOfficeId, loanAccount.groupId,
|
||||
loanAccount.groupName, loanAccount.groupOfficeId, product.getId(), product.getName(), product.getDescription(),
|
||||
product.getFundId(), product.getFundName(), product.getCurrency(), product.getPrincipal(), product.getInArrearsTolerance(),
|
||||
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(),
|
||||
product.getRepaymentFrequencyType(), product.getTransactionProcessingStrategyId(), product.getAmortizationType(),
|
||||
product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(), product.getInterestType(),
|
||||
product.getInterestCalculationPeriodType(), loanAccount.expectedDisbursementDate, charges);
|
||||
}
|
||||
|
||||
public LoanBasicDetailsData(
|
||||
final Long id,
|
||||
final String externalId,
|
||||
final Long clientId, final String clientName,
|
||||
final Long clientOfficeId,
|
||||
final Long groupId,
|
||||
final String groupName,
|
||||
final Long groupOfficeId,
|
||||
final Long loanProductId,
|
||||
final String loanProductName,
|
||||
final String loanProductDescription,
|
||||
final Long fundId, String fundName,
|
||||
final LocalDate closedOnDate,
|
||||
final LocalDate submittedOnDate,
|
||||
final LocalDate approvedOnDate,
|
||||
final LocalDate expectedDisbursementDate,
|
||||
final LocalDate actualDisbursementDate,
|
||||
final LocalDate expectedMaturityDate,
|
||||
final LocalDate repaymentsStartingFromDate,
|
||||
final LocalDate interestChargedFromDate,
|
||||
final CurrencyData currency,
|
||||
final BigDecimal principal,
|
||||
final BigDecimal inArrearsTolerance,
|
||||
final Integer numberOfRepayments,
|
||||
final Integer repaymentEvery,
|
||||
final BigDecimal interestRatePerPeriod,
|
||||
final BigDecimal annualInterestRate,
|
||||
final EnumOptionData repaymentFrequencyType,
|
||||
final EnumOptionData interestRateFrequencyType,
|
||||
final EnumOptionData amortizationType,
|
||||
final EnumOptionData interestType,
|
||||
final EnumOptionData interestCalculationPeriodType,
|
||||
final EnumOptionData status,
|
||||
final LocalDate lifeCycleStatusDate,
|
||||
final Integer termFrequency,
|
||||
final EnumOptionData termPeriodFrequencyType,
|
||||
final Integer transactionStrategyId,
|
||||
final Collection<LoanChargeData> charges,
|
||||
final Long loanOfficerId, String loanOfficerName,
|
||||
final BigDecimal totalDisbursementCharges) {
|
||||
this.id = id;
|
||||
this.externalId = externalId;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.clientOfficeId = clientOfficeId;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.groupOfficeId = groupOfficeId;
|
||||
this.loanProductId = loanProductId;
|
||||
this.loanProductName = loanProductName;
|
||||
this.loanProductDescription = loanProductDescription;
|
||||
this.fundId = fundId;
|
||||
this.fundName = fundName;
|
||||
this.loanOfficerId = loanOfficerId;
|
||||
this.loanOfficerName = loanOfficerName;
|
||||
this.closedOnDate = closedOnDate;
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
this.actualDisbursementDate = actualDisbursementDate;
|
||||
this.expectedMaturityDate = expectedMaturityDate;
|
||||
this.repaymentsStartingFromDate = repaymentsStartingFromDate;
|
||||
this.interestChargedFromDate = interestChargedFromDate;
|
||||
this.currency = currency;
|
||||
this.principal = principal;
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
this.repaymentEvery = repaymentEvery;
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.annualInterestRate = annualInterestRate;
|
||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||
this.interestRateFrequencyType = interestRateFrequencyType;
|
||||
this.amortizationType = amortizationType;
|
||||
this.interestType = interestType;
|
||||
this.interestCalculationPeriodType = interestCalculationPeriodType;
|
||||
this.status = status;
|
||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||
this.termFrequency = termFrequency;
|
||||
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
||||
this.transactionStrategyId = transactionStrategyId;
|
||||
this.charges = charges;
|
||||
this.totalDisbursementCharges = totalDisbursementCharges;
|
||||
}
|
||||
private LoanBasicDetailsData(final Long clientId, final String clientName, final Long clientOfficeId, final Long groupId,
|
||||
final String groupName, final Long groupOfficeId, final Long productId, final String productName,
|
||||
final String productDescription, final Long fundId, final String fundName, final CurrencyData currency,
|
||||
final BigDecimal principal, final BigDecimal inArrearsTolerance, final Integer termFrequency,
|
||||
final EnumOptionData termPeriodFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery,
|
||||
final EnumOptionData repaymentFrequencyType, final Long transactionStrategyId, final EnumOptionData amortizationType,
|
||||
final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType, final EnumOptionData interestType,
|
||||
final EnumOptionData interestCalculationPeriodType, final LocalDate expectedDisbursementDate,
|
||||
final Collection<LoanChargeData> charges) {
|
||||
this.id = null;
|
||||
this.externalId = null;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.clientOfficeId = clientOfficeId;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.groupOfficeId = groupOfficeId;
|
||||
this.loanProductId = productId;
|
||||
this.loanProductName = productName;
|
||||
this.loanProductDescription = productDescription;
|
||||
this.status = null;
|
||||
this.fundId = fundId;
|
||||
this.fundName = fundName;
|
||||
this.loanOfficerId = null;
|
||||
this.loanOfficerName = null;
|
||||
this.currency = currency;
|
||||
this.principal = principal;
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
|
||||
public int getMaxSubmittedOnOffsetFromToday() {
|
||||
return Days.daysBetween(new DateTime(),
|
||||
this.getSubmittedOnDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
this.termFrequency = termFrequency;
|
||||
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
this.repaymentEvery = repaymentEvery;
|
||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||
|
||||
public int getMaxApprovedOnOffsetFromToday() {
|
||||
// FIXME - kw - settle on using either long or integer for this
|
||||
// throughout product and account fields for loan.
|
||||
if (transactionStrategyId != null) {
|
||||
this.transactionProcessingStrategyId = transactionStrategyId.intValue();
|
||||
} else {
|
||||
this.transactionProcessingStrategyId = null;
|
||||
}
|
||||
this.amortizationType = amortizationType;
|
||||
|
||||
int offset = 0;
|
||||
if (this.getApprovedOnDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(),
|
||||
this.getApprovedOnDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.annualInterestRate = null;
|
||||
this.interestRateFrequencyType = interestRateFrequencyType;
|
||||
this.interestType = interestType;
|
||||
this.interestCalculationPeriodType = interestCalculationPeriodType;
|
||||
|
||||
return offset;
|
||||
}
|
||||
this.submittedOnDate = null;
|
||||
this.approvedOnDate = null;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
|
||||
public int getMaxDisbursedOnOffsetFromToday() {
|
||||
this.actualDisbursementDate = null;
|
||||
this.closedOnDate = null;
|
||||
this.expectedMaturityDate = null;
|
||||
this.repaymentsStartingFromDate = null;
|
||||
this.interestChargedFromDate = null;
|
||||
this.lifeCycleStatusDate = null;
|
||||
|
||||
int offset = 0;
|
||||
if (this.getActualDisbursementDate() != null) {
|
||||
offset = Days.daysBetween(
|
||||
new DateTime(),
|
||||
this.getActualDisbursementDate().toDateMidnight()
|
||||
.toDateTime()).getDays();
|
||||
}
|
||||
this.charges = charges;
|
||||
this.totalDisbursementCharges = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
private LoanBasicDetailsData(final Long clientId, final String clientName, final Long clientOfficeId, final Long groupId,
|
||||
final String groupName, final Long groupOfficeId, final LocalDate expectedDisbursementDate) {
|
||||
this.id = null;
|
||||
this.externalId = null;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.clientOfficeId = clientOfficeId;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.groupOfficeId = groupOfficeId;
|
||||
this.loanProductId = null;
|
||||
this.loanProductName = null;
|
||||
this.loanProductDescription = null;
|
||||
this.status = null;
|
||||
this.fundId = null;
|
||||
this.fundName = null;
|
||||
this.loanOfficerId = null;
|
||||
this.loanOfficerName = null;
|
||||
this.currency = null;
|
||||
this.principal = null;
|
||||
this.inArrearsTolerance = null;
|
||||
this.termFrequency = null;
|
||||
this.termPeriodFrequencyType = null;
|
||||
this.numberOfRepayments = null;
|
||||
this.repaymentEvery = null;
|
||||
this.transactionProcessingStrategyId = null;
|
||||
this.interestRatePerPeriod = null;
|
||||
this.annualInterestRate = null;
|
||||
this.repaymentFrequencyType = null;
|
||||
this.interestRateFrequencyType = null;
|
||||
this.amortizationType = null;
|
||||
this.interestType = null;
|
||||
this.interestCalculationPeriodType = null;
|
||||
|
||||
public int getActualLoanTermInDays() {
|
||||
this.lifeCycleStatusDate = null;
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
this.submittedOnDate = null;
|
||||
this.approvedOnDate = null;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
this.actualDisbursementDate = null;
|
||||
this.closedOnDate = null;
|
||||
this.expectedMaturityDate = null;
|
||||
this.repaymentsStartingFromDate = null;
|
||||
this.interestChargedFromDate = null;
|
||||
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(),
|
||||
closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
this.charges = null;
|
||||
this.totalDisbursementCharges = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public int getActualLoanTermInMonths() {
|
||||
public LoanBasicDetailsData(final Long id, final String externalId, final Long clientId, final String clientName,
|
||||
final Long clientOfficeId, final Long groupId, final String groupName, final Long groupOfficeId, final Long loanProductId,
|
||||
final String loanProductName, final String loanProductDescription, final Long fundId, String fundName,
|
||||
final LocalDate closedOnDate, final LocalDate submittedOnDate, final LocalDate approvedOnDate,
|
||||
final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate, final LocalDate expectedMaturityDate,
|
||||
final LocalDate repaymentsStartingFromDate, final LocalDate interestChargedFromDate, final CurrencyData currency,
|
||||
final BigDecimal principal, final BigDecimal inArrearsTolerance, final Integer numberOfRepayments,
|
||||
final Integer repaymentEvery, final BigDecimal interestRatePerPeriod, final BigDecimal annualInterestRate,
|
||||
final EnumOptionData repaymentFrequencyType, final EnumOptionData interestRateFrequencyType,
|
||||
final EnumOptionData amortizationType, final EnumOptionData interestType, final EnumOptionData interestCalculationPeriodType,
|
||||
final EnumOptionData status, final LocalDate lifeCycleStatusDate, final Integer termFrequency,
|
||||
final EnumOptionData termPeriodFrequencyType, final Integer transactionStrategyId, final Collection<LoanChargeData> charges,
|
||||
final Long loanOfficerId, String loanOfficerName, final BigDecimal totalDisbursementCharges) {
|
||||
this.id = id;
|
||||
this.externalId = externalId;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.clientOfficeId = clientOfficeId;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.groupOfficeId = groupOfficeId;
|
||||
this.loanProductId = loanProductId;
|
||||
this.loanProductName = loanProductName;
|
||||
this.loanProductDescription = loanProductDescription;
|
||||
this.fundId = fundId;
|
||||
this.fundName = fundName;
|
||||
this.loanOfficerId = loanOfficerId;
|
||||
this.loanOfficerName = loanOfficerName;
|
||||
this.closedOnDate = closedOnDate;
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
this.actualDisbursementDate = actualDisbursementDate;
|
||||
this.expectedMaturityDate = expectedMaturityDate;
|
||||
this.repaymentsStartingFromDate = repaymentsStartingFromDate;
|
||||
this.interestChargedFromDate = interestChargedFromDate;
|
||||
this.currency = currency;
|
||||
this.principal = principal;
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
this.repaymentEvery = repaymentEvery;
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.annualInterestRate = annualInterestRate;
|
||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||
this.interestRateFrequencyType = interestRateFrequencyType;
|
||||
this.amortizationType = amortizationType;
|
||||
this.interestType = interestType;
|
||||
this.interestCalculationPeriodType = interestCalculationPeriodType;
|
||||
this.status = status;
|
||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||
this.termFrequency = termFrequency;
|
||||
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
||||
this.transactionProcessingStrategyId = transactionStrategyId;
|
||||
this.charges = charges;
|
||||
this.totalDisbursementCharges = totalDisbursementCharges;
|
||||
}
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
public int getMaxSubmittedOnOffsetFromToday() {
|
||||
return Days.daysBetween(new DateTime(), this.getSubmittedOnDate().toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
public int getMaxApprovedOnOffsetFromToday() {
|
||||
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(),
|
||||
closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
int offset = 0;
|
||||
if (this.getApprovedOnDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(), this.getApprovedOnDate().toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public int getLoanTermInDays() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
public int getMaxDisbursedOnOffsetFromToday() {
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
int offset = 0;
|
||||
if (this.getActualDisbursementDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(), this.getActualDisbursementDate().toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(),
|
||||
closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
public int getLoanTermInMonths() {
|
||||
public int getActualLoanTermInDays() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(),
|
||||
closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public int getActualLoanTermInMonths() {
|
||||
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
public Long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
public Long getClientOfficeId() {
|
||||
return clientOfficeId;
|
||||
}
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public int getLoanTermInDays() {
|
||||
|
||||
public Long getGroupOfficeId() {
|
||||
return groupOfficeId;
|
||||
}
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
|
||||
public Long getFundId() {
|
||||
return fundId;
|
||||
}
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public String getFundName() {
|
||||
return fundName;
|
||||
}
|
||||
public int getLoanTermInMonths() {
|
||||
|
||||
public Long getLoanProductId() {
|
||||
return loanProductId;
|
||||
}
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
public String getLoanProductName() {
|
||||
return loanProductName;
|
||||
}
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
|
||||
public String getLoanProductDescription() {
|
||||
return loanProductDescription;
|
||||
}
|
||||
|
||||
public EnumOptionData getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public Integer getTermFrequency() {
|
||||
return termFrequency;
|
||||
}
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
|
||||
public EnumOptionData getTermPeriodFrequencyType() {
|
||||
return termPeriodFrequencyType;
|
||||
}
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return submittedOnDate;
|
||||
}
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
public LocalDate getApprovedOnDate() {
|
||||
return approvedOnDate;
|
||||
}
|
||||
public Long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedDisbursementDate() {
|
||||
return expectedDisbursementDate;
|
||||
}
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
public LocalDate getActualDisbursementDate() {
|
||||
return actualDisbursementDate;
|
||||
}
|
||||
|
||||
public LocalDate getRepaymentsStartingFromDate() {
|
||||
return repaymentsStartingFromDate;
|
||||
}
|
||||
public Long getClientOfficeId() {
|
||||
return clientOfficeId;
|
||||
}
|
||||
|
||||
public LocalDate getInterestChargedFromDate() {
|
||||
return interestChargedFromDate;
|
||||
}
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public LocalDate getClosedOnDate() {
|
||||
return closedOnDate;
|
||||
}
|
||||
public Long getGroupOfficeId() {
|
||||
return groupOfficeId;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedMaturityDate() {
|
||||
return expectedMaturityDate;
|
||||
}
|
||||
|
||||
public CurrencyData getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public BigDecimal getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
public Long getFundId() {
|
||||
return fundId;
|
||||
}
|
||||
|
||||
public BigDecimal getInArrearsTolerance() {
|
||||
return inArrearsTolerance;
|
||||
}
|
||||
public String getFundName() {
|
||||
return fundName;
|
||||
}
|
||||
|
||||
public Integer getNumberOfRepayments() {
|
||||
return numberOfRepayments;
|
||||
}
|
||||
public Long getLoanProductId() {
|
||||
return loanProductId;
|
||||
}
|
||||
|
||||
public Integer getRepaymentEvery() {
|
||||
return repaymentEvery;
|
||||
}
|
||||
public String getLoanProductName() {
|
||||
return loanProductName;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestRatePerPeriod() {
|
||||
return interestRatePerPeriod;
|
||||
}
|
||||
public String getLoanProductDescription() {
|
||||
return loanProductDescription;
|
||||
}
|
||||
|
||||
public BigDecimal getAnnualInterestRate() {
|
||||
return annualInterestRate;
|
||||
}
|
||||
public EnumOptionData getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public EnumOptionData getRepaymentFrequencyType() {
|
||||
return repaymentFrequencyType;
|
||||
}
|
||||
public Integer getTermFrequency() {
|
||||
return termFrequency;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestRateFrequencyType() {
|
||||
return interestRateFrequencyType;
|
||||
}
|
||||
public EnumOptionData getTermPeriodFrequencyType() {
|
||||
return termPeriodFrequencyType;
|
||||
}
|
||||
|
||||
public EnumOptionData getAmortizationType() {
|
||||
return amortizationType;
|
||||
}
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return submittedOnDate;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestType() {
|
||||
return interestType;
|
||||
}
|
||||
public LocalDate getApprovedOnDate() {
|
||||
return approvedOnDate;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCalculationPeriodType() {
|
||||
return interestCalculationPeriodType;
|
||||
}
|
||||
public LocalDate getExpectedDisbursementDate() {
|
||||
return expectedDisbursementDate;
|
||||
}
|
||||
|
||||
public LocalDate getLifeCycleStatusDate() {
|
||||
return lifeCycleStatusDate;
|
||||
}
|
||||
public LocalDate getActualDisbursementDate() {
|
||||
return actualDisbursementDate;
|
||||
}
|
||||
|
||||
public Integer getTransactionStrategyId() {
|
||||
return transactionStrategyId;
|
||||
}
|
||||
public LocalDate getRepaymentsStartingFromDate() {
|
||||
return repaymentsStartingFromDate;
|
||||
}
|
||||
|
||||
public Collection<LoanChargeData> getCharges() {
|
||||
return charges;
|
||||
}
|
||||
public LocalDate getInterestChargedFromDate() {
|
||||
return interestChargedFromDate;
|
||||
}
|
||||
|
||||
public Long getLoanOfficerId() {
|
||||
return loanOfficerId;
|
||||
}
|
||||
public LocalDate getClosedOnDate() {
|
||||
return closedOnDate;
|
||||
}
|
||||
|
||||
public String getLoanOfficerName() {
|
||||
return loanOfficerName;
|
||||
}
|
||||
public LocalDate getExpectedMaturityDate() {
|
||||
return expectedMaturityDate;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalDisbursementCharges() {
|
||||
return totalDisbursementCharges;
|
||||
}
|
||||
public CurrencyData getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public DisbursementData toDisburementData() {
|
||||
return new DisbursementData(this.expectedDisbursementDate, this.actualDisbursementDate, this.principal);
|
||||
}
|
||||
public BigDecimal getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
|
||||
public Long getOfficeId(){
|
||||
public BigDecimal getInArrearsTolerance() {
|
||||
return inArrearsTolerance;
|
||||
}
|
||||
|
||||
public Integer getNumberOfRepayments() {
|
||||
return numberOfRepayments;
|
||||
}
|
||||
|
||||
public Integer getRepaymentEvery() {
|
||||
return repaymentEvery;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestRatePerPeriod() {
|
||||
return interestRatePerPeriod;
|
||||
}
|
||||
|
||||
public BigDecimal getAnnualInterestRate() {
|
||||
return annualInterestRate;
|
||||
}
|
||||
|
||||
public EnumOptionData getRepaymentFrequencyType() {
|
||||
return repaymentFrequencyType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestRateFrequencyType() {
|
||||
return interestRateFrequencyType;
|
||||
}
|
||||
|
||||
public EnumOptionData getAmortizationType() {
|
||||
return amortizationType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestType() {
|
||||
return interestType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCalculationPeriodType() {
|
||||
return interestCalculationPeriodType;
|
||||
}
|
||||
|
||||
public LocalDate getLifeCycleStatusDate() {
|
||||
return lifeCycleStatusDate;
|
||||
}
|
||||
|
||||
public Integer getTransactionStrategyId() {
|
||||
return this.transactionProcessingStrategyId;
|
||||
}
|
||||
|
||||
public Collection<LoanChargeData> getCharges() {
|
||||
return charges;
|
||||
}
|
||||
|
||||
public Long getLoanOfficerId() {
|
||||
return loanOfficerId;
|
||||
}
|
||||
|
||||
public String getLoanOfficerName() {
|
||||
return loanOfficerName;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalDisbursementCharges() {
|
||||
return totalDisbursementCharges;
|
||||
}
|
||||
|
||||
public DisbursementData toDisburementData() {
|
||||
return new DisbursementData(this.expectedDisbursementDate, this.actualDisbursementDate, this.principal);
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
Long officeId = this.clientOfficeId;
|
||||
|
||||
if (officeId == null){
|
||||
if (officeId == null) {
|
||||
officeId = this.groupOfficeId;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user